fix(仪表板): 修复存量指标卡批量设置属性时可能因为缺少属性导致编辑区空白问题

This commit is contained in:
wangjiahao 2024-04-17 09:32:51 +08:00
parent a281060b1e
commit 65b411cd7d

View File

@ -1,7 +1,11 @@
import { defineStore } from 'pinia'
import { store } from '../../index'
import { deepCopy } from '@/utils/utils'
import { BASE_VIEW_CONFIG } from '@/views/chart/components/editor/util/chart'
import {
BASE_VIEW_CONFIG,
DEFAULT_INDICATOR_NAME_STYLE,
DEFAULT_INDICATOR_STYLE
} from '@/views/chart/components/editor/util/chart'
import {
DEFAULT_CANVAS_STYLE_DATA_DARK,
DEFAULT_CANVAS_STYLE_DATA_LIGHT,
@ -508,6 +512,12 @@ export const dvMainStore = defineStore('dataVisualization', {
if (this.curBatchOptComponents.length === 1) {
this.changeProperties.customAttr = viewBaseInfo.customAttr
this.changeProperties.customStyle = viewBaseInfo.customStyle
// 补充历史指标卡缺失属性
this.changeProperties.customAttr['indicator'] =
this.changeProperties.customAttr.indicator || deepCopy(DEFAULT_INDICATOR_STYLE)
this.changeProperties.customAttr['indicatorName'] =
this.changeProperties.customAttr.indicatorName ||
deepCopy(DEFAULT_INDICATOR_NAME_STYLE)
}
this.batchOptComponents[id] = {
properties: chartViewInstance.properties,