Skip to content

Commit a34d85b

Browse files
YunaiVgitee-org
authored andcommitted
!260 增加servicetask的完成和todo高亮,增加servicetask节点的hover显示内容
Merge pull request !260 from FinalFinancialFreedom/N/A
2 parents 083a717 + e7cb96b commit a34d85b

File tree

1 file changed

+27
-14
lines changed

1 file changed

+27
-14
lines changed

src/components/bpmnProcessDesigner/package/designer/ProcessViewer.vue

Lines changed: 27 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -119,10 +119,10 @@ export default {
119119
// console.log(this.bpmnModeler.getDefinitions().rootElements[0].flowElements);
120120
this.bpmnModeler.getDefinitions().rootElements[0].flowElements?.forEach(n => {
121121
let activity = activityList.find(m => m.key === n.id) // 找到对应的活动
122+
if (!activity) {
123+
return;
124+
}
122125
if (n.$type === 'bpmn:UserTask') { // 用户任务
123-
if (!activity) {
124-
return;
125-
}
126126
// 处理用户任务的高亮
127127
const task = this.taskList.find(m => m.id === activity.taskId); // 找到活动对应的 taskId
128128
if (!task) {
@@ -158,9 +158,6 @@ export default {
158158
}
159159
});
160160
} else if (n.$type === 'bpmn:ExclusiveGateway') { // 排它网关
161-
if (!activity) {
162-
return
163-
}
164161
// 设置【bpmn:ExclusiveGateway】排它网关的高亮
165162
canvas.addMarker(n.id, this.getActivityHighlightCss(activity));
166163
// 查找需要高亮的连线
@@ -185,9 +182,6 @@ export default {
185182
canvas.addMarker(matchNN.id, this.getActivityHighlightCss(matchActivity));
186183
}
187184
} else if (n.$type === 'bpmn:ParallelGateway') { // 并行网关
188-
if (!activity) {
189-
return
190-
}
191185
// 设置【bpmn:ParallelGateway】并行网关的高亮
192186
canvas.addMarker(n.id, this.getActivityHighlightCss(activity));
193187
n.outgoing?.forEach(nn => {
@@ -213,6 +207,17 @@ export default {
213207
return;
214208
}
215209
canvas.addMarker(n.id, this.getResultCss(this.processInstance.result));
210+
} else if (n.$type === 'bpmn:ServiceTask'){ //服务任务
211+
if(activity.startTime>0 && activity.endTime===0){//进入执行,标识进行色
212+
canvas.addMarker(n.id, this.getResultCss(1));
213+
}
214+
if(activity.endTime>0){// 执行完成,节点标识完成色, 所有outgoing标识完成色。
215+
canvas.addMarker(n.id, this.getResultCss(2));
216+
const outgoing = this.getActivityOutgoing(activity)
217+
outgoing?.forEach(out=>{
218+
canvas.addMarker(out.id,this.getResultCss(2))
219+
})
220+
}
216221
}
217222
})
218223
},
@@ -268,6 +273,10 @@ export default {
268273
!this.elementOverlayIds && (this.elementOverlayIds = {});
269274
!this.overlays && (this.overlays = this.bpmnModeler.get("overlays"));
270275
// 展示信息
276+
const activity = this.activityList.find(m => m.key === element.id);
277+
if (!activity) {
278+
return;
279+
}
271280
if (!this.elementOverlayIds[element.id] && element.type !== "bpmn:Process") {
272281
let html = `<div class="element-overlays">
273282
<p>Elemet id: ${element.id}</p>
@@ -279,10 +288,6 @@ export default {
279288
<p>创建时间:${this.parseTime(this.processInstance.createTime)}`;
280289
} else if (element.type === 'bpmn:UserTask') {
281290
// debugger
282-
const activity = this.activityList.find(m => m.key === element.id);
283-
if (!activity) {
284-
return;
285-
}
286291
let task = this.taskList.find(m => m.id === activity.taskId); // 找到活动对应的 taskId
287292
if (!task) {
288293
return;
@@ -297,6 +302,14 @@ export default {
297302
if (task.reason) {
298303
html += `<p>审批建议:${task.reason}</p>`
299304
}
305+
} else if (element.type === 'bpmn:ServiceTask' && this.processInstance) {
306+
if(activity.startTime>0){
307+
html = `<p>创建时间:${this.parseTime(activity.startTime)}</p>`;
308+
}
309+
if(activity.endTime>0){
310+
html += `<p>结束时间:${this.parseTime(activity.endTime)}</p>`
311+
}
312+
console.log(html)
300313
} else if (element.type === 'bpmn:EndEvent' && this.processInstance) {
301314
html = `<p>结果:${this.getDictDataLabel(this.DICT_TYPE.BPM_PROCESS_INSTANCE_RESULT, this.processInstance.result)}</p>`;
302315
if (this.processInstance.endTime) {
@@ -471,4 +484,4 @@ export default {
471484
color: #fafafa;
472485
width: 200px;
473486
}
474-
</style>
487+
</style>

0 commit comments

Comments
 (0)