From 72c465be86639d3d91b9efdbcd63867c7d0aa824 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Thu, 20 Jan 2022 13:13:16 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=20bpm=20=E9=AB=98=E4=BA=AE?= =?UTF-8?q?=E6=B5=81=E7=A8=8B=E5=9B=BE=E7=9A=84=E5=89=8D=E7=AB=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../task/vo/activity/BpmActivityRespVO.java | 3 ++ .../package/designer/ProcessViewer.vue | 45 +++++++++++++------ .../src/views/bpm/processInstance/detail.vue | 3 +- 3 files changed, 36 insertions(+), 15 deletions(-) diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/controller/task/vo/activity/BpmActivityRespVO.java b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/controller/task/vo/activity/BpmActivityRespVO.java index 4da7519a4..23e1b8168 100644 --- a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/controller/task/vo/activity/BpmActivityRespVO.java +++ b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/controller/task/vo/activity/BpmActivityRespVO.java @@ -20,6 +20,9 @@ public class BpmActivityRespVO { @ApiModelProperty(value = "流程活动的结束时间", required = true) private Date endTime; + @ApiModelProperty(value = "关联的流程任务的编号", example = "2048", notes = "关联的流程任务,只有 UserTask 等类型才有") + private String taskId; + /** * 关联的流程任务,只有 UserTask 类型才有 */ diff --git a/yudao-admin-ui/src/components/bpmnProcessDesigner/package/designer/ProcessViewer.vue b/yudao-admin-ui/src/components/bpmnProcessDesigner/package/designer/ProcessViewer.vue index a43a1b34c..ce0681432 100644 --- a/yudao-admin-ui/src/components/bpmnProcessDesigner/package/designer/ProcessViewer.vue +++ b/yudao-admin-ui/src/components/bpmnProcessDesigner/package/designer/ProcessViewer.vue @@ -37,6 +37,8 @@ export default { return { xml: '', activityList: [], + processInstance: undefined, + taskList: [], }; }, mounted() { @@ -61,6 +63,14 @@ export default { activityData: function (newActivityData) { this.activityList = newActivityData; this.createNewDiagram(this.xml); + }, + processInstanceData: function (newProcessInstanceData) { + this.processInstance = newProcessInstanceData; + this.createNewDiagram(this.xml); + }, + taskData: function (newTaskListData) { + this.taskList = newTaskListData; + this.createNewDiagram(this.xml); } }, methods: { @@ -94,6 +104,11 @@ export default { /* 高亮流程图 */ // TODO 芋艿:如果多个 endActivity 的话,目前的逻辑可能有一定的问题。https://www.jdon.com/workflow/multi-events.html async highlightDiagram() { + // let activityList = this.activityList.filter(task => { + // if (task.type !== 'sequenceFlow') { // 去除连线元素 + // return true; + // } + // }); let activityList = this.activityList; if (activityList.length === 0) { return; @@ -109,20 +124,15 @@ export default { if (!activity) { return; } - // TODO 芋艿: - if (activity.task) { - const result = activity.task.result; - if (result === 1) { - canvas.addMarker(n.id, 'highlight-todo'); - } else if (result === 2) { - canvas.addMarker(n.id, 'highlight'); - } else if (result === 3) { - canvas.addMarker(n.id, 'highlight-reject'); - } else if (result === 4) { - canvas.addMarker(n.id, 'highlight-cancel'); - } + // 处理用户任务的高亮 + const task = this.taskList.find(m => m.id === activity.taskId); // 找到活动对应的 taskId + if (task) { + canvas.addMarker(n.id, this.getTaskHighlightCss(task)); } + + debugger n.outgoing?.forEach(nn => { + debugger let targetActivity = activityList.find(m => m.key === nn.targetRef.id) if (targetActivity) { debugger @@ -190,8 +200,15 @@ export default { return activity.endTime ? 'highlight' : 'highlight-todo'; }, getTaskHighlightCss(task) { - if (!task) { - return ''; + const result = task.result; + if (result === 1) { + return 'highlight-todo'; + } else if (result === 2) { + return 'highlight'; + } else if (result === 3) { + return 'highlight-reject'; + } else if (result === 4) { + return 'highlight-cancel'; } return ''; }, diff --git a/yudao-admin-ui/src/views/bpm/processInstance/detail.vue b/yudao-admin-ui/src/views/bpm/processInstance/detail.vue index 9aa6fb90e..587b004c6 100644 --- a/yudao-admin-ui/src/views/bpm/processInstance/detail.vue +++ b/yudao-admin-ui/src/views/bpm/processInstance/detail.vue @@ -74,7 +74,8 @@
流程图
- +