@@ -119,10 +119,10 @@ export default {
119
119
// console.log(this.bpmnModeler.getDefinitions().rootElements[0].flowElements);
120
120
this .bpmnModeler .getDefinitions ().rootElements [0 ].flowElements ? .forEach (n => {
121
121
let activity = activityList .find (m => m .key === n .id ) // 找到对应的活动
122
+ if (! activity) {
123
+ return ;
124
+ }
122
125
if (n .$type === ' bpmn:UserTask' ) { // 用户任务
123
- if (! activity) {
124
- return ;
125
- }
126
126
// 处理用户任务的高亮
127
127
const task = this .taskList .find (m => m .id === activity .taskId ); // 找到活动对应的 taskId
128
128
if (! task) {
@@ -158,9 +158,6 @@ export default {
158
158
}
159
159
});
160
160
} else if (n .$type === ' bpmn:ExclusiveGateway' ) { // 排它网关
161
- if (! activity) {
162
- return
163
- }
164
161
// 设置【bpmn:ExclusiveGateway】排它网关的高亮
165
162
canvas .addMarker (n .id , this .getActivityHighlightCss (activity));
166
163
// 查找需要高亮的连线
@@ -185,9 +182,6 @@ export default {
185
182
canvas .addMarker (matchNN .id , this .getActivityHighlightCss (matchActivity));
186
183
}
187
184
} else if (n .$type === ' bpmn:ParallelGateway' ) { // 并行网关
188
- if (! activity) {
189
- return
190
- }
191
185
// 设置【bpmn:ParallelGateway】并行网关的高亮
192
186
canvas .addMarker (n .id , this .getActivityHighlightCss (activity));
193
187
n .outgoing ? .forEach (nn => {
@@ -213,6 +207,17 @@ export default {
213
207
return ;
214
208
}
215
209
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
+ }
216
221
}
217
222
})
218
223
},
@@ -268,6 +273,10 @@ export default {
268
273
! this .elementOverlayIds && (this .elementOverlayIds = {});
269
274
! this .overlays && (this .overlays = this .bpmnModeler .get (" overlays" ));
270
275
// 展示信息
276
+ const activity = this .activityList .find (m => m .key === element .id );
277
+ if (! activity) {
278
+ return ;
279
+ }
271
280
if (! this .elementOverlayIds [element .id ] && element .type !== " bpmn:Process" ) {
272
281
let html = ` <div class="element-overlays">
273
282
<p>Elemet id: ${ element .id } </p>
@@ -279,10 +288,6 @@ export default {
279
288
<p>创建时间:${ this .parseTime (this .processInstance .createTime )} ` ;
280
289
} else if (element .type === ' bpmn:UserTask' ) {
281
290
// debugger
282
- const activity = this .activityList .find (m => m .key === element .id );
283
- if (! activity) {
284
- return ;
285
- }
286
291
let task = this .taskList .find (m => m .id === activity .taskId ); // 找到活动对应的 taskId
287
292
if (! task) {
288
293
return ;
@@ -297,6 +302,14 @@ export default {
297
302
if (task .reason ) {
298
303
html += ` <p>审批建议:${ task .reason } </p>`
299
304
}
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)
300
313
} else if (element .type === ' bpmn:EndEvent' && this .processInstance ) {
301
314
html = ` <p>结果:${ this .getDictDataLabel (this .DICT_TYPE .BPM_PROCESS_INSTANCE_RESULT , this .processInstance .result )} </p>` ;
302
315
if (this .processInstance .endTime ) {
@@ -471,4 +484,4 @@ export default {
471
484
color: #fafafa;
472
485
width: 200px ;
473
486
}
474
- < / style>
487
+ < / style>
0 commit comments