From 25b3aef84721755162294aef3e001e693b4a45be Mon Sep 17 00:00:00 2001 From: wangjiahao <1522128093@qq.com> Date: Wed, 29 May 2024 16:56:50 +0800 Subject: [PATCH] =?UTF-8?q?refactor(=E5=B7=A5=E4=BD=9C=E5=8F=B0):=20?= =?UTF-8?q?=E6=A8=A1=E6=9D=BF=E6=95=B0=E6=8D=AE=E9=80=82=E9=85=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../server/DataVisualizationServer.java | 14 ++++++++++---- core/core-frontend/src/utils/canvasUtils.ts | 7 +++++-- .../src/views/chart/components/views/index.vue | 2 +- 3 files changed, 16 insertions(+), 7 deletions(-) diff --git a/core/core-backend/src/main/java/io/dataease/visualization/server/DataVisualizationServer.java b/core/core-backend/src/main/java/io/dataease/visualization/server/DataVisualizationServer.java index 1cdf69a02a..144dbd8cac 100644 --- a/core/core-backend/src/main/java/io/dataease/visualization/server/DataVisualizationServer.java +++ b/core/core-backend/src/main/java/io/dataease/visualization/server/DataVisualizationServer.java @@ -30,10 +30,7 @@ import io.dataease.template.dao.auto.entity.VisualizationTemplateExtendData; import io.dataease.template.dao.auto.mapper.VisualizationTemplateExtendDataMapper; import io.dataease.template.dao.auto.mapper.VisualizationTemplateMapper; import io.dataease.template.manage.TemplateCenterManage; -import io.dataease.utils.AuthUtils; -import io.dataease.utils.BeanUtils; -import io.dataease.utils.IDUtils; -import io.dataease.utils.JsonUtil; +import io.dataease.utils.*; import io.dataease.visualization.dao.auto.entity.DataVisualizationInfo; import io.dataease.visualization.dao.auto.entity.VisualizationWatermark; import io.dataease.visualization.dao.auto.mapper.DataVisualizationInfoMapper; @@ -327,6 +324,15 @@ public class DataVisualizationServer implements DataVisualizationApi { Map extendDataInfo = new HashMap<>(); for (Map.Entry entry : dynamicDataMap.entrySet()) { String originViewId = entry.getKey(); + Object viewInfo = entry.getValue(); + try{ + // 旧模板图表过滤器适配 + if(viewInfo instanceof Map && ((Map)viewInfo).get("customFilter") instanceof ArrayList){ + ((Map)viewInfo).put("customFilter",new HashMap<>()); + } + }catch(Exception e){ + LogUtil.error("History Adaptor Error",e); + } String originViewData = JsonUtil.toJSONString(entry.getValue()).toString(); ChartViewDTO chartView = JsonUtil.parseObject(originViewData, ChartViewDTO.class); if (chartView == null) { diff --git a/core/core-frontend/src/utils/canvasUtils.ts b/core/core-frontend/src/utils/canvasUtils.ts index e106b35000..a59498aa2f 100644 --- a/core/core-frontend/src/utils/canvasUtils.ts +++ b/core/core-frontend/src/utils/canvasUtils.ts @@ -119,8 +119,8 @@ export function initCanvasDataPrepare(dvId, busiFlag, callBack) { const canvasStyleResult = JSON.parse(canvasInfo.canvasStyleData) const canvasViewInfoPreview = canvasInfo.canvasViewInfo //历史字段适配 - canvasStyleResult.component.seniorStyleSetting = - canvasStyleResult.component.seniorStyleSetting || deepCopy(SENIOR_STYLE_SETTING_LIGHT) + canvasStyleResult.component['seniorStyleSetting'] = + canvasStyleResult.component['seniorStyleSetting'] || deepCopy(SENIOR_STYLE_SETTING_LIGHT) canvasDataResult.forEach(componentItem => { componentItem['canvasActive'] = false @@ -420,6 +420,9 @@ export async function decompressionPre(params, callBack) { } }) const sourceCanvasStyle = JSON.parse(deTemplateDataTemp['canvasStyleData']) + //历史字段适配 + sourceCanvasStyle.component['seniorStyleSetting'] = + sourceCanvasStyle.component['seniorStyleSetting'] || deepCopy(SENIOR_STYLE_SETTING_LIGHT) deTemplateData = { canvasStyleData: sourceCanvasStyle, componentData: sourceComponentData, diff --git a/core/core-frontend/src/views/chart/components/views/index.vue b/core/core-frontend/src/views/chart/components/views/index.vue index a04e18d39b..e9568b22d8 100644 --- a/core/core-frontend/src/views/chart/components/views/index.vue +++ b/core/core-frontend/src/views/chart/components/views/index.vue @@ -565,7 +565,7 @@ const chartAreaShow = computed(() => { if (view.value['dataFrom'] === 'template') { return true } - if (view.value.customAttr.map.id) { + if (view.value.customAttr?.map?.id) { const MAP_CHARTS = ['map', 'bubble-map', 'flow-map'] if (MAP_CHARTS.includes(view.value.type)) { return true