mirror of
https://gitee.com/huangge1199_admin/vue-pro.git
synced 2024-11-22 23:31:52 +08:00
解决 bpm 用户任务的 outgoing 为空的情况~
This commit is contained in:
parent
72c465be86
commit
21376c80a8
@ -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",
|
||||||
|
@ -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:SequenceFlow】节点们。原因是:bpmn-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;
|
||||||
|
Loading…
Reference in New Issue
Block a user