refactor(工作台): 模板数据适配

This commit is contained in:
wangjiahao 2024-05-29 16:56:50 +08:00
parent 01d6cc7a93
commit 25b3aef847
3 changed files with 16 additions and 7 deletions

View File

@ -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<Long, VisualizationTemplateExtendDataDTO> extendDataInfo = new HashMap<>();
for (Map.Entry<String, String> 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) {

View File

@ -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,

View File

@ -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