fixbug:【流程图】点开流程图查看报错

1. 对setColor 进行try catch
This commit is contained in:
lvjunzhao
2025-07-03 08:55:12 +08:00
parent 5cb5da27c8
commit 7aa7638dd8

View File

@ -125,21 +125,28 @@ function setColors(finishedIds: Array<string>, currentIds: Array<string>) {
const elementRegistry = data.bpmnViewer.get('elementRegistry');
if (finishedIds.length > 0) {
finishedIds.forEach((it) => {
try {
let Event = elementRegistry.get(it);
modeling.setColor(Event, {
stroke: 'green',
fill: 'white',
});
} catch (error) {
console.error(`Error setColor element with id ${it}:`, error);
}
});
}
if (currentIds.length > 0) {
currentIds.forEach((it) => {
try {
let Event = elementRegistry.get(it);
modeling.setColor(Event, {
stroke: '#409eff',
fill: 'white',
});
} catch (error) {
console.error(`Error setColor element with id ${it}:`, error);
}
});
}
}