fix(图表): 修复外部参数跳转,级联条件容易受初始条件影响而不准确问题 #14656 #14352
Some checks are pending
Typos Check / Spell Check with Typos (push) Waiting to run

This commit is contained in:
wangjiahao 2025-01-19 16:21:07 +08:00 committed by 王嘉豪
parent 586b47a731
commit 9f6744ef4b

View File

@ -1202,6 +1202,7 @@ export const dvMainStore = defineStore('dataVisualization', {
preActiveComponentIds.push(element.id)
}
if (element.component === 'VQuery') {
const defaultValueMap = {}
element.propValue.forEach(filterItem => {
if (filterItem.id === targetViewId) {
let queryParams = paramValue
@ -1245,8 +1246,30 @@ export const dvMainStore = defineStore('dataVisualization', {
filterItem['conditionValueF'] = null
filterItem['defaultConditionValueF'] = null
}
if (filterItem['defaultValue']) {
defaultValueMap[filterItem.id] = filterItem['defaultValue']
}
}
})
// 级联条件处理
if (element.cascade?.length && Object.keys(defaultValueMap).length) {
element.cascade.forEach(cascadeItem => {
Object.keys(defaultValueMap).forEach(key => {
const curDefaultValue = defaultValueMap[key]
if (cascadeItem.length) {
cascadeItem.forEach(itemInner => {
if (itemInner.datasetId.includes(key) && curDefaultValue) {
itemInner['currentSelectValue'] = Array.isArray(curDefaultValue)
? curDefaultValue
: [curDefaultValue]
} else {
itemInner['currentSelectValue'] = []
}
})
}
})
})
}
}
})
})