mirror of
https://gitee.com/myxzgzs/boyue-kfcode-hasfj.git
synced 2025-06-21 17:09:37 +08:00
2 lines
4.2 KiB
JavaScript
2 lines
4.2 KiB
JavaScript
![]() |
import{g as b,_ as y,c as V,e as l,w as p,j as f,f as g,F as M,H as z,o as x}from"./index-CrAWI0wi.js";import{V as w,Z as E,M as C}from"./vue-treeselect-DSnm48_Q.js";var u={exports:{}},_;function R(){return _||(_=1,typeof Object.create=="function"?u.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:u.exports=function(e,t){if(t){e.super_=t;var s=function(){};s.prototype=t.prototype,e.prototype=new s,e.prototype.constructor=e}}),u.exports}var T=R();const $=b(T);function k(o){w.call(this,o)}$(k,w);k.prototype._modules=[].concat(w.prototype._modules,[E,C]);const j={name:"BpmnViewer",props:{flowData:{type:Object,default:()=>{},required:!1},procInsId:{type:String,default:""}},data(){return{bpmnViewer:null,flowDetail:{},loading:!0}},watch:{flowData:{handler(o){Object.keys(o).length>0&&(this.bpmnViewer&&this.bpmnViewer.destroy(),this.bpmnViewer=new k({container:this.$refs.flowCanvas,height:"calc(100vh - 200px)"}),this.loadFlowCanvas(o))}}},created(){},methods:{async loadFlowCanvas(o){try{await this.bpmnViewer.importXML(o.xmlData),await this.fitViewport(),o.nodeData!==void 0&&o.nodeData.length>0&&this.procInsId&&await this.fillColor(o.nodeData)}catch(e){console.error(e.message,e.warnings)}},fitViewport(){this.zoom=this.bpmnViewer.get("canvas").zoom("fit-viewport","auto"),this.loading=!1},zoomViewport(o=!0){this.zoom=this.bpmnViewer.get("canvas").zoom(),this.zoom+=o?.1:-.1,this.zoom>=.2&&this.bpmnViewer.get("canvas").zoom(this.zoom)},fillColor(o){const e=this.bpmnViewer.get("canvas");this.bpmnViewer.getDefinitions().rootElements[0].flowElements.forEach(t=>{var h,c,m;const s=o.find(i=>i.key===t.id),n=o.find(i=>!i.completed),d=o[o.length-1];if(t.$type==="bpmn:UserTask")s&&(e.addMarker(t.id,s.completed?"highlight":"highlight-todo"),(h=t.outgoing)==null||h.forEach(i=>{const r=o.find(a=>a.key===i.targetRef.id);r&&(n&&s.key===n.key&&!n.completed?(e.addMarker(i.id,n.completed?"highlight":"highlight-todo"),e.addMarker(i.targetRef.id,n.completed?"highlight":"highlight-todo")):(e.addMarker(i.id,r.completed?"highlight":"highlight-todo"),e.addMarker(i.targetRef.id,r.completed?"highlight":"highlight-todo")))}));else if(t.$type==="bpmn:ExclusiveGateway")s&&(e.addMarker(t.id,s.completed?"highlight":"highlight-todo"),(c=t.outgoing)==null||c.forEach(i=>{const r=o.find(a=>a.key===i.targetRef.id);r&&(e.addMarker(i.id,r.completed?"highlight":"highlight-todo"),e.addMarker(i.targetRef.id,r.completed?"highlight":"highlight-todo"))}));else if(t.$type==="bpmn:ParallelGateway")s&&(e.addMarker(t.id,s.completed?"highlight":"highlight-todo"),(m=t.outgoing)==null||m.forEach(i=>{const r=o.find(a=>a.key===i.targetRef.id);r&&(e.addMarker(i.id,r.completed?"highlight":"highlight-todo"),e.addMarker(i.targetRef.id,r.completed?"highlight":"highlight-todo"))}));else if(t.$type==="bpmn:StartEvent")t.outgoing.forEach(i=>{if(o.find(a=>a.key===i.targetRef.id)){e.addMarker(i.id,"highlight"),e.addMarker(t.id,"highlight");return}});else if(t.$type==="bpmn:EndEvent"&&d.key===t.id&&d.completed){e.addMarker(t.id,"highlight");return}})}}},B={class:"containers"},I={class:"canvas",ref:"flowCanvas"};function F(o,e,t,s,n,d){const h=f("el-button"),c=f("el-tooltip"),m=f("el-button-group"),i=f("el-main"),r=f("el-container"),a=z("loading");return x(),V("div",B,[l(r,{style:{"align-items":"stretch"}},{default:p(()=>[l(i,{class:"flow-viewer"},{default:p(()=>[e[2]||(e[2]=g("div",{class:"process-status"},[g("span",{class:"intro"},"状态:"),g("div",{class:"finish"},"已办理"),g("div",{class:"processing"},"处理中"),g("div",{class:"todo"},"未进行")],-1)),M(g("div",I,null,512),[[a,n.loading]]),l(m,{class:"button-group"},{default:p(()=>[l(c,{effect:"dark",content:"适中",placement:"bottom"},{default:p(()=>[l(h,{size:"small",icon:"rank",onClick:d.fitViewport},null,8,["onClick"])]),_:1}),l(c,{effect:"dark",content:"放大",placement:"bottom"},{default:p(()=>[l(h,{size:"small",icon:"zoom-in",onClick:e[0]||(e[0]=v=>d.zoomViewport(!0))})]),_:1}),l(c,{effect:"dark",content:"缩小",placement:"botto
|