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.4KB

  1. import F from"./childFlow.b0ba4b0d.js";import{p as V}from"./playCircle.1a554fd4.js";import z from"./approvalDialog.f4c2bd11.js";import L from"./conditionDialog.f5e548f3.js";import{b as G,s as H,c as K}from"./flowConfiguration.475296bc.js";import{d as Q,y as W,x as X,b as _,r as D,o as Z,al as y,c as N,e as ee,f as ne,h as l,i as p,g as d,t as te,u as g,j as C,F as se,L as T,q as oe}from"./index.1cbb0c88.js";import re from"./concurrentDialog.4b42f81f.js";import"./index.313f951c.js";import"./unitManage.21337c89.js";const ae={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"},pe=["src"],ce={class:"flex flex-col"},fe=Q({name:"configEdit"}),Te=Object.assign(fe,{setup(ue){const{proxy:I}=oe(),x=W(),O=X(),c=({key:n,type:e,item:s})=>{let t={};const o=e==="SUB"?"\u5BA1\u6279":e==="CONDITIONS"?"\u6761\u4EF6":e==="CONCURRENTS"?"\u5E76\u884C\u5206\u652F":"\u7A7A\u8282\u70B9";e==="SUB"||e==="EMPTY"?t={name:o,type:e,props:void 0,id:""}:e==="CONCURRENTS"?t={name:o,type:"CONCURRENTS",branchs:[{name:o,type:"CONCURRENT",props:{groups:[]},children:[{type:"AUTO_PASS"}]},{name:"\u5E76\u884C\u5206\u652F",type:"CONCURRENT",props:{groups:[]},children:[{type:"AUTO_PASS"}]}],id:""}:t={name:o,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?(b.value.splice(0,0,t),(e==="CONDITIONS"||e==="CONCURRENTS")&&c({key:n+1,type:"EMPTY",item:b.value})):s.children===void 0?(s.splice(n+1,0,t),(e==="CONDITIONS"||e==="CONCURRENTS")&&c({key:n+1,type:"EMPTY",item:s})):(s.children.splice(0,0,t),(e==="CONDITIONS"||e==="CONCURRENTS")&&c({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=_({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=_({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=_({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(),b=D([]),q=async()=>{const n=await G({formId:O.query.formId});J.value=n.data.processDefId,b.value=m([],n.data.process,!0)},m=(n,e,s)=>{if(e!=null&&e.branchs){const t=[];e.branchs.forEach(o=>{let a={};if(a={name:o.name,type:o.type,props:o.props,id:s?o.id:void 0,parentType:o.parentType||void 0},(o==null?void 0:o.children)&&JSON.stringify(o.children)!=="{}"){const i=[];o.children.branchs||i.push({name:o.children.name,type:o.children.type,props:o.children.props,id:s?o.children.id:void 0,parentType:o.children.parentType||void 0}),m(i,o.children,s),a.children=i}else a.children=[];t.push(a)}),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}),m(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,o)=>{const a=t.id||v(),i=t.type;return e&&o===n.length-1&&(t.parentId=e.id,t.parentType=e.type),t.branchs?(t.branchs.forEach(r=>{r.parentId=a,r.parentType=i,r.id=r.id||v(),r.children&&r.children.length?r.children=S(r.children,r):r.children&&!r.children.length&&delete r.children}),o?(s.parentId=a,s.parentType=i,{type:i,id:a,branchs:t.branchs,children:s}):(t.id=a,t.type=i,t)):o?(s.parentId=a,s.parentType=i,t.id=a,t.type=i,t.children=s,t):(t.id=a,t.type=i,t)},null)),Y=async()=>{let n={};const e=JSON.parse(JSON.stringify(b.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:O.query.formId,groupId:1};await H(s),await K(O.query.formId),I.$message.success("\u53D1\u5E03\u6210\u529F")};return Z(()=>{q()}),y("showApprovalDialog",U),y("showConditionDialog",P),y("showConcurrentDialog",$),y("addNode",c),y("removeNode",E),y("addCondition",R),(n,e)=>{const s=N("el-button"),t=N("Plus"),o=N("el-icon"),a=N("el-popover"),i=N("el-card");return ee(),ne(se,null,[l(i,{shadow:"never"},{header:p(()=>[d("div",ae,[d("span",null,te(g(O).query.bizFormName),1),d("div",null,[l(s,{onClick:e[0]||(e[0]=r=>g(x).go(-1))},{default:p(()=>e[4]||(e[4]=[C("\u8FD4\u56DE")])),_:1}),l(s,{type:"primary",onClick:Y},{default:p(()=>e[5]||(e[5]=[C("\u53D1\u5E03")])),_:1})])])]),default:p(()=>[d("div",ie,[d("div",le,[d("div",de,[e[6]||(e[6]=C(" \u5F00\u59CB ")),d("img",{src:g(V)},null,8,pe)]),l(a,{placement:"right",width:100,trigger:"hover"},{reference:p(()=>[l(o,{class:"add_icon mt-20 mb-20 cursor-pointer"},{default:p(()=>[l(t)]),_:1})]),default:p(()=>[d("div",ce,[d("p",null,[l(s,{class:"mb-8 w-full",onClick:e[1]||(e[1]=r=>c({key:-1,type:"SUB"}))},{default:p(()=>e[7]||(e[7]=[C(" \u5355\u4F4D ")])),_:1})]),d("p",null,[l(s,{class:"ml-1 w-full mb-8",onClick:e[2]||(e[2]=r=>c({key:-1,type:"CONDITIONS"}))},{default:p(()=>e[8]||(e[8]=[C(" \u6570\u636E\u7B5B\u9009 ")])),_:1})]),d("p",null,[l(s,{class:"ml-1 w-full",onClick:e[3]||(e[3]=r=>c({key:-1,type:"CONCURRENTS"}))},{default:p(()=>e[9]||(e[9]=[C(" \u5E76\u884C\u5206\u652F ")])),_:1})])])]),_:1}),l(F,{"node-data":b.value},null,8,["node-data"]),e[10]||(e[10]=d("div",{class:"end_box node_box text-white flex items-center justify-center"}," \u6D41\u7A0B\u7ED3\u675F ",-1))])])]),_:1}),l(z,{visible:f.visible,data:f.data,onClose:w,"onUpdate:data":A},null,8,["visible","data"]),l(L,{visible:u.visible,data:u.data,onClose:j,"onUpdate:data":k},null,8,["visible","data"]),l(re,{visible:h.visible,data:h.data,onClose:M,"onUpdate:data":B},null,8,["visible","data"])],64)}}});export{Te as default};