fix(工作台): 修复导出的模板再导入到模板管理中无法使用问题

This commit is contained in:
wangjiahao 2024-08-01 11:00:08 +08:00
parent dc074f4b26
commit c22c3605eb
2 changed files with 14 additions and 7 deletions

View File

@ -576,12 +576,19 @@ public class DataVisualizationServer implements DataVisualizationApi {
// 模板市场记录
coreOptRecentManage.saveOpt(request.getResourceName(), OptConstants.OPT_RESOURCE_TYPE.TEMPLATE, OptConstants.OPT_TYPE.NEW);
}
if(StringUtils.isNotEmpty(appDataStr)){
VisualizationExport2AppVO appDataFormat = JsonUtil.parseObject(appDataStr,VisualizationExport2AppVO.class);
String dvInfo = appDataFormat.getVisualizationInfo();
VisualizationBaseInfoVO baseInfoVO = JsonUtil.parseObject(dvInfo,VisualizationBaseInfoVO.class);
Long sourceDvId = baseInfoVO.getId();
appDataStr = appDataStr.replaceAll(sourceDvId.toString(), newDvId.toString());
if(StringUtils.isNotEmpty(appDataStr) && appDataStr.length()>10){
try{
VisualizationExport2AppVO appDataFormat = JsonUtil.parseObject(appDataStr,VisualizationExport2AppVO.class);
String dvInfo = appDataFormat.getVisualizationInfo();
VisualizationBaseInfoVO baseInfoVO = JsonUtil.parseObject(dvInfo,VisualizationBaseInfoVO.class);
Long sourceDvId = baseInfoVO.getId();
appDataStr = appDataStr.replaceAll(sourceDvId.toString(), newDvId.toString());
}catch (Exception e){
LogUtil.error(e);
appDataStr = null;
}
}else{
appDataStr = null;
}
// 解析动态数据
Map<String, String> dynamicDataMap = JsonUtil.parseObject(dynamicData, Map.class);

View File

@ -56,7 +56,7 @@ export function download2AppTemplate(downloadType, canvasDom, name, attachParams
componentData: JSON.stringify(componentData.value),
dynamicData: JSON.stringify(canvasViewDataTemplate),
staticResource: JSON.stringify(staticResource || {}),
appData: JSON.stringify(attachParams || {})
appData: attachParams ? JSON.stringify(attachParams) : null
}
const blob = new Blob([JSON.stringify(templateInfo)], { type: '' })
if (downloadType === 'template') {