解决 bpm 用户任务的 outgoing 为空的情况~

This commit is contained in:
YunaiV 2022-01-20 23:52:52 +08:00
parent 72c465be86
commit 21376c80a8
2 changed files with 25 additions and 4 deletions

View File

@ -85,7 +85,7 @@
"@vue/compiler-sfc": "^3.0.1", "@vue/compiler-sfc": "^3.0.1",
"@vue/eslint-config-prettier": "^5.0.0", "@vue/eslint-config-prettier": "^5.0.0",
"axios": "^0.21.1", "axios": "^0.21.1",
"bpmn-js": "^8.8.3", "bpmn-js": "8.9.0",
"bpmn-js-properties-panel": "^0.37.2", "bpmn-js-properties-panel": "^0.37.2",
"camunda-bpmn-moddle": "^4.4.1", "camunda-bpmn-moddle": "^4.4.1",
"compression-webpack-plugin": "^6.1.1", "compression-webpack-plugin": "^6.1.1",

View File

@ -109,7 +109,7 @@ export default {
// return true; // return true;
// } // }
// }); // });
let activityList = this.activityList; const activityList = this.activityList;
if (activityList.length === 0) { if (activityList.length === 0) {
return; return;
} }
@ -118,6 +118,8 @@ export default {
let canvas = this.bpmnModeler.get('canvas'); let canvas = this.bpmnModeler.get('canvas');
let todoActivity = activityList.find(m => !m.endTime) // let todoActivity = activityList.find(m => !m.endTime) //
let endActivity = activityList[activityList.length - 1] // let endActivity = activityList[activityList.length - 1] //
// debugger
console.log(this.bpmnModeler.getDefinitions().rootElements[0].flowElements);
this.bpmnModeler.getDefinitions().rootElements[0].flowElements?.forEach(n => { this.bpmnModeler.getDefinitions().rootElements[0].flowElements?.forEach(n => {
let activity = activityList.find(m => m.key === n.id) // let activity = activityList.find(m => m.key === n.id) //
if (n.$type === 'bpmn:UserTask') { // if (n.$type === 'bpmn:UserTask') { //
@ -130,8 +132,9 @@ export default {
canvas.addMarker(n.id, this.getTaskHighlightCss(task)); canvas.addMarker(n.id, this.getTaskHighlightCss(task));
} }
debugger // outgoing 线
n.outgoing?.forEach(nn => { const outgoing = this.getActivityOutgoing(activity);
outgoing?.forEach(nn => {
debugger debugger
let targetActivity = activityList.find(m => m.key === nn.targetRef.id) let targetActivity = activityList.find(m => m.key === nn.targetRef.id)
if (targetActivity) { if (targetActivity) {
@ -212,6 +215,24 @@ export default {
} }
return ''; return '';
}, },
getActivityOutgoing(activity) {
// outgoing使
if (activity.outgoing && activity.outgoing.length > 0) {
return activity.outgoing;
}
// bpmn:SequenceFlowbpmn-js UserTask outgoing
const flowElements = this.bpmnModeler.getDefinitions().rootElements[0].flowElements;
const outgoing = [];
flowElements.forEach(item => {
if (item.$type !== 'bpmn:SequenceFlow') {
return;
}
if (item.sourceRef.id === activity.key) {
outgoing.push(item);
}
});
return outgoing;
},
initModelListeners() { initModelListeners() {
const EventBus = this.bpmnModeler.get("eventBus"); const EventBus = this.bpmnModeler.get("eventBus");
const that = this; const that = this;