解决 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/eslint-config-prettier": "^5.0.0",
"axios": "^0.21.1",
"bpmn-js": "^8.8.3",
"bpmn-js": "8.9.0",
"bpmn-js-properties-panel": "^0.37.2",
"camunda-bpmn-moddle": "^4.4.1",
"compression-webpack-plugin": "^6.1.1",

View File

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