import R from"./childFlow.a6a5951a.js";import{p as T}from"./playCircle.1a554fd4.js";import P from"./approvalDialog.90aea3a5.js";import{g as V,h as q}from"./flowConfiguration.9d2341ae.js";import{_ as L,d as B,A as M,z as F,b as z,r as v,o as U,al as y,c as u,e as G,f as H,h as d,i,g as r,t as K,u as O,j as p,F as Q,N as W,q as X,s as Y,x as Z}from"./index.5bb861d3.js";import{p as ee}from"./flowPathConfiguration.dc823040.js";import"./index.cf50f71e.js";import"./unitManage.09ab32c4.js";const te=h=>(X("data-v-76f7f8eb"),h=h(),Y(),h),se={class:"flex justify-between items-center"},ne={class:"overflow-x-auto flex"},oe={class:"node flex flex-1 flex-col items-center justify-center"},ae={class:"start_box node_box text-white flex items-center justify-center"},le=["src"],re={class:"flex flex-col"},de=te(()=>r("div",{class:"end_box node_box text-white flex items-center justify-center"}," \u6D41\u7A0B\u7ED3\u675F ",-1)),ie=B({name:"configEdit"}),ce=Object.assign(ie,{setup(h){const{proxy:S}=Z(),I=M(),b=F(),f=({key:t,type:e,item:s})=>{let n={};n={name:e==="APPROVAL"?"\u5BA1\u6279":e==="CONSTRCTION"?"\u5EFA\u8BBE\u7533\u62A5\u5BA1\u6279":e==="CC"?"\u6284\u9001":e==="SEAL"?"\u76D6\u7AE0":"",type:e,props:void 0,id:""},t===-1?_.value.splice(0,0,n):s.splice(t+1,0,n)},k=async(t,e,s,n)=>{e.splice(t,1)},c=z({visible:!1,data:{name:void 0}}),A=({key:t,item:e})=>{c.visible=!0,c.data=e[t],c.orgCode=b.query.orgCode||""},j=t=>{c.visible=!1},$=t=>{W(()=>{Object.entries(t).forEach(e=>{c.data[e[0]]=e[1]})})},x=v(),C=v(),_=v([]),D=v({}),E=async()=>{const t=await ee({processDefId:b.query.processDefId});x.value=t.data.processDefId,C.value=t.data.processDefName,D.value=t.data;const e={children:JSON.parse(t.data.process)};_.value=g([],e,!0)},g=(t,e,s)=>{if(e.branchs){const n=[];e.branchs.forEach(o=>{let l={};if(l={name:o.name,type:o.type,props:o.props,id:s?o.id:void 0},o.children&&JSON.stringify(o.children)!=="{}"){const a=[];o.children.branchs||a.push({name:o.children.name,type:o.children.type,props:o.children.props,id:s?o.children.id:void 0}),g(a,o.children,s),l.children=a}else l.children=[];n.push(l)}),t.push({type:"CONDITIONS",props:{},branchs:n})}return e.children&&JSON.stringify(e.children)!=="{}"&&(e.children.branchs||t.push({name:e.children.name,type:e.children.type,props:e.children.props,id:s?e.children.id:void 0}),g(t,e.children,s)),t},N=()=>{const t=[],e="0123456789abcdef";for(let n=0;n<36;n++)t[n]=e.substr(Math.floor(Math.random()*16),1);return t[14]="4",t[19]=e.substr(t[19]&3|8,1),t[8]=t[13]=t[18]=t[23]="-",t.join("")},w=(t,e)=>(t=t.reverse(),t.reduce((s,n,o)=>{const l=n.id||N();return e&&o===t.length-1&&(n.parent=e.id),n.branchs?(n.branchs.forEach(a=>{a.parentId=l||null,a.id=a.id||N(),a.children&&a.children.length?a.children=w(a.children,a):a.children&&!a.children.length&&delete a.children}),o?(s.parentId=l||null,{type:"route",id:l,children:s}):(n.id=l,n)):o?(s.parentId=l||null,n.id=l,n.children=s,n):(n.id=l,n)},null)),J=async()=>{let t={};const e=JSON.parse(JSON.stringify(_.value));t=t.children=JSON.parse(JSON.stringify(w(e)));const s={...D.value,process:t};delete s.created,delete s.sort,delete s.updated,delete s.version,await V(s),await q(s),S.$message.success("\u53D1\u5E03\u6210\u529F")};return U(()=>{E(),x.value=b.query.processDefId}),y("showApprovalDialog",A),y("addNode",f),y("removeNode",k),(t,e)=>{const s=u("el-button"),n=u("Plus"),o=u("el-icon"),l=u("el-popover"),a=u("el-card");return G(),H(Q,null,[d(a,{shadow:"never"},{header:i(()=>[r("div",se,[r("span",null,K(C.value),1),r("div",null,[d(s,{onClick:e[0]||(e[0]=m=>O(I).go(-1))},{default:i(()=>[p("\u8FD4\u56DE")]),_:1}),d(s,{type:"primary",onClick:J},{default:i(()=>[p("\u53D1\u5E03")]),_:1})])])]),default:i(()=>[r("div",ne,[r("div",oe,[r("div",ae,[p(" \u5F00\u59CB "),r("img",{src:O(T)},null,8,le)]),d(l,{placement:"right",width:100,trigger:"hover"},{reference:i(()=>[d(o,{class:"add_icon mt-20 mb-20 cursor-pointer"},{default:i(()=>[d(n)]),_:1})]),default:i(()=>[r("div",re,[r("p",null,[d(s,{class:"mb-8 w-full",onClick:e[1]||(e[1]=m=>f({key:-1,type:"APPROVAL"}))},{default:i(()=>[p(" \u5BA1\u6279\u4EBA ")]),_:1})]),r("p",null,[d(s,{class:"ml-1 mb-8 w-full",onClick:e[2]||(e[2]=m=>f({key:-1,type:"SEAL"}))},{default:i(()=>[p(" \u76D6\u7AE0\u4EBA ")]),_:1})]),r("p",null,[d(s,{class:"ml-1 mb-8 w-full",onClick:e[3]||(e[3]=m=>f({key:-1,type:"CC"}))},{default:i(()=>[p(" \u6284\u9001\u4EBA ")]),_:1})]),r("p",null,[d(s,{class:"mb-8 w-full",onClick:e[4]||(e[4]=m=>f({key:-1,type:"CONSTRCTION"}))},{default:i(()=>[p(" \u5EFA\u8BBE\u5BA1\u6279\u4EBA ")]),_:1})])])]),_:1}),d(R,{"node-data":_.value},null,8,["node-data"]),de])])]),_:1}),d(P,{visible:c.visible,data:c.data,"org-code":c.orgCode,onClose:j,"onUpdate:data":$},null,8,["visible","data","org-code"])],64)}}}),ge=L(ce,[["__scopeId","data-v-76f7f8eb"]]);export{ge as default};
