Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

2 строки
6.2KB

  1. import F from"./childFlow-9e252816.js";import{p as V}from"./playCircle-8f852ac1.js";import z from"./approvalDialog-070c666f.js";import G from"./conditionDialog-d143d094.js";import{b as H,s as K,c as L}from"./flowConfiguration-e3261cd3.js";import{y as Q,x as W,a as _,r as D,o as X,am as y,b as N,c as Z,d as ee,f as l,h as p,e as d,t as ne,u as T,i as C,F as te,k as se,C as g,s as oe}from"./index-dd5fae99.js";import re from"./concurrentDialog-4edbfb42.js";import"./index-4950cfb0.js";import"./unitManage-104cfe86.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=se({name:"configEdit"}),ge=Object.assign(fe,{setup(ue){const{proxy:I}=oe(),x=Q(),O=W(),c=({key:n,type:e,item:s})=>{let t={};const o=e==="SUB"?"审批":e==="CONDITIONS"?"条件":e==="CONCURRENTS"?"并行分支":"空节点";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:"并行分支",type:"CONCURRENT",props:{groups:[]},children:[{type:"AUTO_PASS"}]}],id:""}:t={name:o,type:"CONDITIONS",branchs:[{name:"所有数据可进入该分支",type:"CONDITION",props:{groups:[]},children:[{type:"AUTO_PASS"}]},{name:"所有数据可进入该分支",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"?"所有数据可进入该分支":"并行分支",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=>{g(()=>{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},k=n=>{u.visible=!1},j=n=>{g(()=>{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=>{g(()=>{Object.entries(n).forEach(e=>{h.data[e[0]]=e[1]})})},J=D(),b=D([]),q=async()=>{const n=await H({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&&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&&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:"发起人",type:"ROOT",id:"root"}),n=n.children=JSON.parse(JSON.stringify(S(e)));const s={process:n,formId:O.query.formId,groupId:1};await K(s),await L(O.query.formId),I.$message.success("发布成功")};return X(()=>{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 Z(),ee(te,null,[l(i,{shadow:"never"},{header:p(()=>[d("div",ae,[d("span",null,ne(T(O).query.bizFormName),1),d("div",null,[l(s,{onClick:e[0]||(e[0]=r=>T(x).go(-1))},{default:p(()=>e[4]||(e[4]=[C("返回")])),_:1}),l(s,{type:"primary",onClick:Y},{default:p(()=>e[5]||(e[5]=[C("发布")])),_:1})])])]),default:p(()=>[d("div",ie,[d("div",le,[d("div",de,[e[6]||(e[6]=C(" 开始 ")),d("img",{src:T(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(" 单位 ")])),_: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(" 数据筛选 ")])),_: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(" 并行分支 ")])),_: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"}," 流程结束 ",-1))])])]),_: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:k,"onUpdate:data":j},null,8,["visible","data"]),l(re,{visible:h.visible,data:h.data,onClose:M,"onUpdate:data":B},null,8,["visible","data"])],64)}}});export{ge as default};