bpmn.js自定义id

bpmn.js自定义id

下面直接放代码

this.modeler.on("selection.changed", e => {
const element = e.newSelection[0];
this.element = element;
if (!element) return;
if(!isNaN(element.id.split('_')[1])){
}else{
this.updateProperties({ id: element.id.split('_')[0]+'_'+this.flowAbleId })
this.flowAbleId++
}
this.form = {
...element.businessObject,
...element.businessObject.$attrs
};
if (this.form.userType === "candidateUsers") {
this.form["candidateUsers"] =
this.form["candidateUsers"].split(",") || [];
}
});

updateProperties 方法如下

updateProperties(properties) {
const modeling = this.modeler.get("modeling");
modeling.updateProperties(this.element, properties);
}

还可以参考这里

一个折中的方法 自定义bpmn.js的id


爆款云服务器s6 2核4G 低至0.46/天,具体规则查看活动详情Blog Img