fix(仪表板、数据大屏): 修复历史出现重复id组件无法删除情况 (#16545)

This commit is contained in:
王嘉豪
2025-07-22 14:57:27 +08:00
committed by GitHub
parent c5d24775d8
commit 6e6e0ddcd3

View File

@@ -555,10 +555,10 @@ export const dvMainStore = defineStore('dataVisualization', {
deleteComponentById(componentId, componentData = this.componentData, deep = false) {
if (componentId) {
let indexResult
const indexResult = []
componentData.forEach((component, index) => {
if (componentId === component.id) {
indexResult = index
indexResult.push(index)
} else if (deep && component.component === 'Group') {
this.deleteComponentById(componentId, component.propValue || [])
} else if (deep && component.innerType === 'DeTabs') {
@@ -567,7 +567,9 @@ export const dvMainStore = defineStore('dataVisualization', {
})
}
})
this.deleteComponent(indexResult, componentData)
indexResult.forEach(indexItem => {
this.deleteComponent(indexItem, componentData)
})
}
},