Merge pull request #11262 from dataease/pr@dev-v2@fix_refresh

fix(数据大屏): 修复部分组件可能不跟随大屏刷新的问题
This commit is contained in:
王嘉豪 2024-07-30 14:54:19 +08:00 committed by GitHub
commit 6b30b7ce4b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -182,14 +182,16 @@ export function refreshOtherComponent(dvId, busiFlag) {
const canvasInfo = rsp.data
const canvasDataResult = JSON.parse(canvasInfo.componentData)
const canvasDataResultMap = canvasDataResult.reduce((acc, comp) => {
acc.set(comp.id, comp)
acc[comp.id] = comp
return acc
}, new Map())
componentData.value.map(component =>
refreshIdList.includes(component.id) && canvasDataResultMap[component.id]
? canvasDataResultMap[component.id]
: component
)
}, {})
// 遍历数组并替换
for (let i = 0; i < componentData.value.length; i++) {
const component = componentData.value[i]
if (refreshIdList.includes(component.id) && canvasDataResultMap[component.id]) {
componentData.value[i] = canvasDataResultMap[component.id]
}
}
})
}
}