fix(数据大屏): 修复部分组件可能不跟随大屏刷新的问题

This commit is contained in:
wangjiahao 2024-07-30 14:50:41 +08:00
parent c5118acb7d
commit 37e296d81d

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]
}
}
})
}
}