Merge pull request #11492 from dataease/pr@dev-v2@feat_dataset-params

feat(仪表板): 数据集计算字段支持设置参数
This commit is contained in:
王嘉豪 2024-08-12 15:21:21 +08:00 committed by GitHub
commit b23c0d5651
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1192,9 +1192,20 @@ 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]
if (viewInfo.tableId !== chartDataInfo.tableId) { const oldCalParams = viewInfo.calParams
this.canvasViewInfo[viewId]['calcParams'] = chartDataInfo.calcParams || null ? viewInfo.calParams.reduce((map, params) => {
map[params.id] = params.value
return map
}, {})
: {}
if (chartDataInfo.calParams) {
chartDataInfo.calParams.forEach(paramsItem => {
if (oldCalParams[paramsItem.id]) {
paramsItem.value = oldCalParams[paramsItem.id]
} }
})
}
this.canvasViewInfo[viewId]['calParams'] = chartDataInfo.calParams || null
}, },
getViewDataDetails(viewId) { getViewDataDetails(viewId) {
return this.canvasViewDataInfo[viewId] return this.canvasViewDataInfo[viewId]