Merge pull request #12000 from dataease/pr@dev-v2@fix_copy

fix(图表): 修复复用时部分图表不显示问题
This commit is contained in:
王嘉豪 2024-09-04 15:15:26 +08:00 committed by GitHub
commit 1bfd6c6abe
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 15 additions and 14 deletions

View File

@ -1230,20 +1230,22 @@ export const dvMainStore = defineStore('dataVisualization', {
setViewDataDetails(viewId, chartDataInfo) { setViewDataDetails(viewId, chartDataInfo) {
this.canvasViewDataInfo[viewId] = chartDataInfo.data this.canvasViewDataInfo[viewId] = chartDataInfo.data
const viewInfo = this.canvasViewInfo[viewId] const viewInfo = this.canvasViewInfo[viewId]
const oldCalParams = viewInfo.calParams if (viewInfo) {
? viewInfo.calParams.reduce((map, params) => { const oldCalParams = viewInfo.calParams
map[params.id] = params.value ? viewInfo.calParams.reduce((map, params) => {
return map map[params.id] = params.value
}, {}) return map
: {} }, {})
if (chartDataInfo.calParams) { : {}
chartDataInfo.calParams.forEach(paramsItem => { if (chartDataInfo.calParams) {
if (oldCalParams[paramsItem.id]) { chartDataInfo.calParams.forEach(paramsItem => {
paramsItem.value = oldCalParams[paramsItem.id] if (oldCalParams[paramsItem.id]) {
} paramsItem.value = oldCalParams[paramsItem.id]
}) }
})
}
this.canvasViewInfo[viewId]['calParams'] = chartDataInfo.calParams || null
} }
this.canvasViewInfo[viewId]['calParams'] = chartDataInfo.calParams || null
}, },
getViewDataDetails(viewId) { getViewDataDetails(viewId) {
return this.canvasViewDataInfo[viewId] return this.canvasViewDataInfo[viewId]

View File

@ -246,7 +246,6 @@ const importTemplate = () => {
ElMessage.warning('当前名称已在模版管理中存在,请修改') ElMessage.warning('当前名称已在模版管理中存在,请修改')
} else { } else {
save(state.templateInfo).then(rsp => { save(state.templateInfo).then(rsp => {
console.log('====' + JSON.stringify(rsp))
ElMessage.success(t('导入成功')) ElMessage.success(t('导入成功'))
emits('refresh', getRefreshPInfo()) emits('refresh', getRefreshPInfo())
emits('closeEditTemplateDialog') emits('closeEditTemplateDialog')