From 4c83cd52d94a3812a97800f37f73107245382a27 Mon Sep 17 00:00:00 2001 From: wangjiahao <1522128093@qq.com> Date: Thu, 17 Oct 2024 10:14:00 +0800 Subject: [PATCH] =?UTF-8?q?refactor(=E5=B7=A5=E4=BD=9C=E5=8F=B0):=20?= =?UTF-8?q?=E5=8E=86=E5=8F=B2=E6=A8=A1=E7=89=88=E5=8F=AF=E5=85=BC=E5=AE=B9?= =?UTF-8?q?=E6=94=AF=E6=8C=81=E6=9C=80=E6=96=B0=E7=89=B9=E6=80=A7#12666?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/core-frontend/src/utils/canvasUtils.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/core/core-frontend/src/utils/canvasUtils.ts b/core/core-frontend/src/utils/canvasUtils.ts index bdc0352fcb..098457efa8 100644 --- a/core/core-frontend/src/utils/canvasUtils.ts +++ b/core/core-frontend/src/utils/canvasUtils.ts @@ -131,7 +131,7 @@ export function historyItemAdaptor( // 定时报告过滤组件适配 如果当前是定时报告默认切有设置对应的过滤组件默认值,则替换过滤组件 if ( componentItem.component === 'VQuery' && - attachInfo.source === 'report' && + attachInfo?.source === 'report' && !!reportFilterInfo ) { componentItem.propValue.forEach((filterItem, index) => { @@ -180,7 +180,7 @@ export function historyItemAdaptor( componentItem.actionSelection = componentItem.actionSelection || deepCopy(ACTION_SELECTION) } // 2 为基础版本 此处需要增加仪表板矩阵密度 - if ((!canvasVersion || canvasVersion === 2) && canvasInfo.type === 'dashboard') { + if ((!canvasVersion || canvasVersion === 2) && canvasInfo?.type === 'dashboard') { matrixAdaptor(componentItem) } // 组件事件适配 @@ -233,7 +233,7 @@ export function historyAdaptor( canvasStyleResult['popupButtonAvailable'] === undefined ? true : canvasStyleResult['popupButtonAvailable'] //兼容弹框区域按钮开关 - const reportFilterInfo = canvasInfo.reportFilterInfo + const reportFilterInfo = canvasInfo?.reportFilterInfo canvasDataResult.forEach(componentItem => { historyItemAdaptor(componentItem, reportFilterInfo, attachInfo, canvasVersion, canvasInfo) }) @@ -657,6 +657,7 @@ export async function decompressionPre(params, callBack) { const deTemplateDataTemp = response.data const sourceComponentData = JSON.parse(deTemplateDataTemp['componentData']) const appData = deTemplateDataTemp['appData'] + const sourceCanvasStyle = JSON.parse(deTemplateDataTemp['canvasStyleData']) sourceComponentData.forEach(componentItem => { // 2 为基础版本 此处需要增加仪表板矩阵密度 if ( @@ -666,7 +667,6 @@ export async function decompressionPre(params, callBack) { matrixAdaptor(componentItem) } }) - const sourceCanvasStyle = JSON.parse(deTemplateDataTemp['canvasStyleData']) //历史字段适配 sourceCanvasStyle.component['seniorStyleSetting'] = sourceCanvasStyle.component['seniorStyleSetting'] || deepCopy(SENIOR_STYLE_SETTING_LIGHT) @@ -685,6 +685,7 @@ export async function decompressionPre(params, callBack) { .catch(e => { console.error(e) }) + historyAdaptor(deTemplateData.canvasStyleData, deTemplateData.componentData, null, null, null) callBack(deTemplateData) }