You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

2 lines
6.3KB

  1. import F from"./childFlow.039c8bd2.js";import{p as V}from"./playCircle.1a554fd4.js";import z from"./approvalDialog.10b18924.js";import G from"./conditionDialog.1c8ec0ab.js";import{b as H,s as K,c as L}from"./flowConfiguration.e9887e9f.js";import{d as Q,A as W,z as X,b as m,r as D,o as Z,al as _,c as b,e as ee,f as ne,h as l,i as c,g as d,t as te,u as g,j as y,F as se,N as T,x as ae}from"./index.121be81f.js";import oe from"./concurrentDialog.0fed0115.js";import"./index.1f774a5b.js";import"./unitManage.f69733da.js";const re={class:"flex justify-between items-center"},ie={class:"overflow-x-auto flex"},le={class:"node flex flex-1 flex-col items-center justify-center"},de={class:"start_box node_box text-white flex items-center justify-center"},ce=["src"],pe={class:"flex flex-col"},fe=d("div",{class:"end_box node_box text-white flex items-center justify-center"}," \u6D41\u7A0B\u7ED3\u675F ",-1),ue=Q({name:"configEdit"}),ve=Object.assign(ue,{setup(he){const{proxy:I}=ae(),x=W(),N=X(),p=({key:n,type:e,item:s})=>{let t={};const a=e==="SUB"?"\u5BA1\u6279":e==="CONDITIONS"?"\u6761\u4EF6":e==="CONCURRENTS"?"\u5E76\u884C\u5206\u652F":"\u7A7A\u8282\u70B9";e==="SUB"||e==="EMPTY"?t={name:a,type:e,props:void 0,id:""}:e==="CONCURRENTS"?t={name:a,type:"CONCURRENTS",branchs:[{name:a,type:"CONCURRENT",props:{groups:[]},children:[{type:"AUTO_PASS"}]},{name:"\u5E76\u884C\u5206\u652F",type:"CONCURRENT",props:{groups:[]},children:[{type:"AUTO_PASS"}]}],id:""}:t={name:a,type:"CONDITIONS",branchs:[{name:"\u6240\u6709\u6570\u636E\u53EF\u8FDB\u5165\u8BE5\u5206\u652F",type:"CONDITION",props:{groups:[]},children:[{type:"AUTO_PASS"}]},{name:"\u6240\u6709\u6570\u636E\u53EF\u8FDB\u5165\u8BE5\u5206\u652F",type:"CONDITION",props:{groups:[]},children:[{type:"AUTO_PASS"}]}],id:""},n===-1?(C.value.splice(0,0,t),(e==="CONDITIONS"||e==="CONCURRENTS")&&p({key:n+1,type:"EMPTY",item:C.value})):s.children===void 0?(s.splice(n+1,0,t),(e==="CONDITIONS"||e==="CONCURRENTS")&&p({key:n+1,type:"EMPTY",item:s})):(s.children.splice(0,0,t),(e==="CONDITIONS"||e==="CONCURRENTS")&&p({key:n,type:"EMPTY",item:s.children}))},R=(n,e)=>{const s={name:e==="CONDITIONS"?"\u6240\u6709\u6570\u636E\u53EF\u8FDB\u5165\u8BE5\u5206\u652F":"\u5E76\u884C\u5206\u652F",type:e==="CONDITIONS"?"CONDITION":"CONCURRENT",props:{groups:[]},children:[{type:"AUTO_PASS"}]};n.push(s)},E=async(n,e,s,t)=>{e.branchs?e.branchs.length===2?t.splice(s,2):e.branchs.splice(n,1):e.children===void 0?e.splice(n,1):e.children.splice(0,1)},f=m({visible:!1,data:{name:void 0}}),U=({key:n,item:e})=>{f.visible=!0,f.data=e[n]},w=n=>{f.visible=!1},A=n=>{T(()=>{Object.entries(n).forEach(e=>{f.data[e[0]]=e[1]})})},u=m({visible:!1,data:void 0}),P=({item:n})=>{u.visible=!0,u.data=n},j=n=>{u.visible=!1},k=n=>{T(()=>{Object.entries(n).forEach(e=>{u.data[e[0]]=e[1]})})},h=m({visible:!1,data:void 0}),$=({item:n})=>{h.visible=!0,h.data=n},M=n=>{h.visible=!1},B=n=>{T(()=>{Object.entries(n).forEach(e=>{h.data[e[0]]=e[1]})})},J=D(),C=D([]),q=async()=>{const n=await H({formId:N.query.formId});J.value=n.data.processDefId,C.value=O([],n.data.process,!0)},O=(n,e,s)=>{if(e!=null&&e.branchs){const t=[];e.branchs.forEach(a=>{let r={};if(r={name:a.name,type:a.type,props:a.props,id:s?a.id:void 0,parentType:a.parentType||void 0},(a==null?void 0:a.children)&&JSON.stringify(a.children)!=="{}"){const i=[];a.children.branchs||i.push({name:a.children.name,type:a.children.type,props:a.children.props,id:s?a.children.id:void 0,parentType:a.children.parentType||void 0}),O(i,a.children,s),r.children=i}else r.children=[];t.push(r)}),n.push({type:e.type,props:{},branchs:t})}return(e==null?void 0:e.children)&&JSON.stringify(e.children)!=="{}"&&(e.children.branchs||n.push({name:e.children.name,type:e.children.type,props:e.children.props,id:s?e.children.id:void 0,parentType:e.children.parentType||void 0}),O(n,e.children,s)),n},v=()=>{const n=[],e="0123456789abcdef";for(let t=0;t<36;t++)n[t]=e.substr(Math.floor(Math.random()*16),1);return n[14]="4",n[19]=e.substr(n[19]&3|8,1),n[8]=n[13]=n[18]=n[23]="-","node_"+n.join("")},S=(n,e)=>(n=n.reverse(),n.reduce((s,t,a)=>{const r=t.id||v(),i=t.type;return e&&a===n.length-1&&(t.parentId=e.id,t.parentType=e.type),t.branchs?(t.branchs.forEach(o=>{o.parentId=r,o.parentType=i,o.id=o.id||v(),o.children&&o.children.length?o.children=S(o.children,o):o.children&&!o.children.length&&delete o.children}),a?(s.parentId=r,s.parentType=i,{type:i,id:r,branchs:t.branchs,children:s}):(t.id=r,t.type=i,t)):a?(s.parentId=r,s.parentType=i,t.id=r,t.type=i,t.children=s,t):(t.id=r,t.type=i,t)},null)),Y=async()=>{let n={};const e=JSON.parse(JSON.stringify(C.value));e.splice(0,0,{name:"\u53D1\u8D77\u4EBA",type:"ROOT",id:"root"}),n=n.children=JSON.parse(JSON.stringify(S(e)));const s={process:n,formId:N.query.formId,groupId:1};await K(s),await L(N.query.formId),I.$message.success("\u53D1\u5E03\u6210\u529F")};return Z(()=>{q()}),_("showApprovalDialog",U),_("showConditionDialog",P),_("showConcurrentDialog",$),_("addNode",p),_("removeNode",E),_("addCondition",R),(n,e)=>{const s=b("el-button"),t=b("Plus"),a=b("el-icon"),r=b("el-popover"),i=b("el-card");return ee(),ne(se,null,[l(i,{shadow:"never"},{header:c(()=>[d("div",re,[d("span",null,te(g(N).query.bizFormName),1),d("div",null,[l(s,{onClick:e[0]||(e[0]=o=>g(x).go(-1))},{default:c(()=>[y("\u8FD4\u56DE")]),_:1}),l(s,{type:"primary",onClick:Y},{default:c(()=>[y("\u53D1\u5E03")]),_:1})])])]),default:c(()=>[d("div",ie,[d("div",le,[d("div",de,[y(" \u5F00\u59CB "),d("img",{src:g(V)},null,8,ce)]),l(r,{placement:"right",width:100,trigger:"hover"},{reference:c(()=>[l(a,{class:"add_icon mt-20 mb-20 cursor-pointer"},{default:c(()=>[l(t)]),_:1})]),default:c(()=>[d("div",pe,[d("p",null,[l(s,{class:"mb-8 w-full",onClick:e[1]||(e[1]=o=>p({key:-1,type:"SUB"}))},{default:c(()=>[y(" \u5355\u4F4D ")]),_:1})]),d("p",null,[l(s,{class:"ml-1 w-full mb-8",onClick:e[2]||(e[2]=o=>p({key:-1,type:"CONDITIONS"}))},{default:c(()=>[y(" \u6570\u636E\u7B5B\u9009 ")]),_:1})]),d("p",null,[l(s,{class:"ml-1 w-full",onClick:e[3]||(e[3]=o=>p({key:-1,type:"CONCURRENTS"}))},{default:c(()=>[y(" \u5E76\u884C\u5206\u652F ")]),_:1})])])]),_:1}),l(F,{"node-data":C.value},null,8,["node-data"]),fe])])]),_:1}),l(z,{visible:f.visible,data:f.data,onClose:w,"onUpdate:data":A},null,8,["visible","data"]),l(G,{visible:u.visible,data:u.data,onClose:j,"onUpdate:data":k},null,8,["visible","data"]),l(oe,{visible:h.visible,data:h.data,onClose:M,"onUpdate:data":B},null,8,["visible","data"])],64)}}});export{ve as default};