增加servicetask的完成和todo高亮,增加servicetask节点的hover显示内容

Signed-off-by: FinalFinancialFreedom <li.acerphoenix@gmail.com>
This commit is contained in:
FinalFinancialFreedom 2022-08-29 08:43:12 +00:00 committed by Gitee
parent 185ea9e861
commit 4c8b0ef430
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
1 changed files with 27 additions and 14 deletions

View File

@ -119,10 +119,10 @@ export default {
// console.log(this.bpmnModeler.getDefinitions().rootElements[0].flowElements); // 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 (!activity) {
return;
}
if (n.$type === 'bpmn:UserTask') { // if (n.$type === 'bpmn:UserTask') { //
if (!activity) {
return;
}
// //
const task = this.taskList.find(m => m.id === activity.taskId); // taskId const task = this.taskList.find(m => m.id === activity.taskId); // taskId
if (!task) { if (!task) {
@ -158,9 +158,6 @@ export default {
} }
}); });
} else if (n.$type === 'bpmn:ExclusiveGateway') { // } else if (n.$type === 'bpmn:ExclusiveGateway') { //
if (!activity) {
return
}
// bpmn:ExclusiveGateway // bpmn:ExclusiveGateway
canvas.addMarker(n.id, this.getActivityHighlightCss(activity)); canvas.addMarker(n.id, this.getActivityHighlightCss(activity));
// 线 // 线
@ -185,9 +182,6 @@ export default {
canvas.addMarker(matchNN.id, this.getActivityHighlightCss(matchActivity)); canvas.addMarker(matchNN.id, this.getActivityHighlightCss(matchActivity));
} }
} else if (n.$type === 'bpmn:ParallelGateway') { // } else if (n.$type === 'bpmn:ParallelGateway') { //
if (!activity) {
return
}
// bpmn:ParallelGateway // bpmn:ParallelGateway
canvas.addMarker(n.id, this.getActivityHighlightCss(activity)); canvas.addMarker(n.id, this.getActivityHighlightCss(activity));
n.outgoing?.forEach(nn => { n.outgoing?.forEach(nn => {
@ -213,6 +207,17 @@ export default {
return; return;
} }
canvas.addMarker(n.id, this.getResultCss(this.processInstance.result)); canvas.addMarker(n.id, this.getResultCss(this.processInstance.result));
} else if (n.$type === 'bpmn:ServiceTask'){ //
if(activity.startTime>0 && activity.endTime===0){//
canvas.addMarker(n.id, this.getResultCss(1));
}
if(activity.endTime>0){// , outgoing
canvas.addMarker(n.id, this.getResultCss(2));
const outgoing = this.getActivityOutgoing(activity)
outgoing?.forEach(out=>{
canvas.addMarker(out.id,this.getResultCss(2))
})
}
} }
}) })
}, },
@ -268,6 +273,10 @@ export default {
!this.elementOverlayIds && (this.elementOverlayIds = {}); !this.elementOverlayIds && (this.elementOverlayIds = {});
!this.overlays && (this.overlays = this.bpmnModeler.get("overlays")); !this.overlays && (this.overlays = this.bpmnModeler.get("overlays"));
// //
const activity = this.activityList.find(m => m.key === element.id);
if (!activity) {
return;
}
if (!this.elementOverlayIds[element.id] && element.type !== "bpmn:Process") { if (!this.elementOverlayIds[element.id] && element.type !== "bpmn:Process") {
let html = `<div class="element-overlays"> let html = `<div class="element-overlays">
<p>Elemet id: ${element.id}</p> <p>Elemet id: ${element.id}</p>
@ -279,10 +288,6 @@ export default {
<p>创建时间${this.parseTime(this.processInstance.createTime)}`; <p>创建时间${this.parseTime(this.processInstance.createTime)}`;
} else if (element.type === 'bpmn:UserTask') { } else if (element.type === 'bpmn:UserTask') {
// debugger // debugger
const activity = this.activityList.find(m => m.key === element.id);
if (!activity) {
return;
}
let task = this.taskList.find(m => m.id === activity.taskId); // taskId let task = this.taskList.find(m => m.id === activity.taskId); // taskId
if (!task) { if (!task) {
return; return;
@ -297,6 +302,14 @@ export default {
if (task.reason) { if (task.reason) {
html += `<p>审批建议:${task.reason}</p>` html += `<p>审批建议:${task.reason}</p>`
} }
} else if (element.type === 'bpmn:ServiceTask' && this.processInstance) {
if(activity.startTime>0){
html = `<p>创建时间:${this.parseTime(activity.startTime)}</p>`;
}
if(activity.endTime>0){
html += `<p>结束时间:${this.parseTime(activity.endTime)}</p>`
}
console.log(html)
} else if (element.type === 'bpmn:EndEvent' && this.processInstance) { } else if (element.type === 'bpmn:EndEvent' && this.processInstance) {
html = `<p>结果:${this.getDictDataLabel(this.DICT_TYPE.BPM_PROCESS_INSTANCE_RESULT, this.processInstance.result)}</p>`; html = `<p>结果:${this.getDictDataLabel(this.DICT_TYPE.BPM_PROCESS_INSTANCE_RESULT, this.processInstance.result)}</p>`;
if (this.processInstance.endTime) { if (this.processInstance.endTime) {
@ -471,4 +484,4 @@ export default {
color: #fafafa; color: #fafafa;
width: 200px; width: 200px;
} }
</style> </style>