import{e as se,bN as re,d as A,bz as oe,f as ie,ad as N,cg as ue,o as i,g as p,B as a,j as ne,n as me,a as e,aB as pe,aP as de,_ as fe,q as ce,a0 as ve,u as ye,Q as ge,r as o,b as _e,aA as be,P as xe,k as r,I as Z,c as V,F as U,i as I,C as D,O as E,D as $,am as he,ap as ke,K as we,L as Ce,U as Se,V as Ve,$ as Ue,R as Ie,S as Pe,W as Be,Z as qe}from"./index-CHTXMeh8.js";import{_ as ze}from"./ContentWrap.vue_vue_type_script_setup_true_lang-BjvrLlUT.js";import{E as Ae}from"./el-card-Bdk9qx7q.js";import{E as De}from"./el-image-B_ZoGYtG.js";import{b as Ee,a as Fe}from"./index-BnVkKGRw.js";import{g as Re,a as Te}from"./index-GzuMZCCW.js";import{b as je}from"./formCreate-Cdf7i8Tu.js";import{_ as Ke}from"./ProcessInstanceBpmnViewer.vue_vue_type_style_index_0_lang-CfySswyA.js";import{C as Le}from"./index-Dppb265m.js";import{u as Ne}from"./tagsView-C8yDzF3Q.js";import{g as Ze}from"./index-DYclHsjD.js";import"./bpmn-embedded-BQWcRx7_.js";import"./Dialog.vue_vue_type_style_index_0_lang-DH0TiLYN.js";import"./XTextButton-DNeufsj_.js";import"./XButton-C1WkVWZR.js";import"./index-CQckL2qL.js";import"./el-tree-select-DhIHMmfG.js";import"./tree-BBZY150N.js";import"./index-VglbY8ty.js";import"./index-BFn6KXm4.js";import"./index-63VBDaUm.js";import"./index-eJzt9aew.js";import"./index.vue_vue_type_script_setup_true_lang-Cenk7Bi3.js";import"./index-DVe591HI.js";import"./constants-CuOBQ73z.js";import"./index-BbWSenFL.js";import"./el-drawer-DCGXHIlf.js";import"./DictTag.vue_vue_type_script_lang-DPOZRs0A.js";import"./color-DXkOL5Tu.js";import"./index-CO7BRHFB.js";import"./formatTime-DG99nHw2.js";const $e=se({type:{type:String,values:["primary","success","info","warning","danger",""],default:""},size:{type:String,values:re,default:""},truncated:{type:Boolean},lineClamp:{type:[String,Number]},tag:{type:String,default:"span"}}),Ge=A({name:"ElText"}),Je=ce(fe(A({...Ge,props:$e,setup(F){const b=F,C=oe(),m=ie("text"),x=N(()=>[m.b(),m.m(b.type),m.m(C.value),m.is("truncated",b.truncated),m.is("line-clamp",!ue(b.lineClamp))]);return(h,k)=>(i(),p(de(h.tag),{class:me(e(x)),style:pe({"-webkit-line-clamp":h.lineClamp})},{default:a(()=>[ne(h.$slots,"default")]),_:3},8,["class","style"]))}}),[["__file","text.vue"]])),Me={class:"flex"},Oe={class:"clearfix"},Qe={class:"el-icon-document"},We=A({name:"BpmProcessInstanceCreate",__name:"index",setup(F){const b=ve(),{push:C,currentRoute:m}=ye(),x=ge(),{delView:h}=Ne(),k=b.query.processInstanceId,P=o(!0),S=o([]),w=o(""),B=o([]),G=N(()=>B.value.filter(l=>l.category==w.value)),d=o(),f=o({rule:[],option:{},value:{}}),c=o(),R=o(null),v=o([]),y=o({}),T=o(),q=o({}),j=o([]),K=async(l,t)=>{var g;if(c.value=l,v.value=[],y.value={},q.value={},l.formType==10){je(f,l.formConf,l.formFields,t);const n=await Fe(l.id);if(n&&(R.value=n.bpmnXml,v.value=n.startUserSelectTasks,((g=v.value)==null?void 0:g.length)>0)){f.value.rule.push({type:"startUserSelect",props:{title:"\u6307\u5B9A\u5BA1\u6279\u4EBA"}});for(const _ of v.value)y.value[_.id]=[],q.value[_.id]=[{required:!0,message:"\u8BF7\u9009\u62E9\u5BA1\u6279\u4EBA",trigger:"blur"}];j.value=await Ze()}}else l.formCustomCreatePath&&await C({path:l.formCustomCreatePath})},J=async l=>{var t;if(d.value&&c.value){((t=v.value)==null?void 0:t.length)>0&&await T.value.validate(),d.value.btn.loading(!0);try{await Te({processDefinitionId:c.value.id,variables:l,startUserSelectAssignees:y.value}),x.success("\u53D1\u8D77\u6D41\u7A0B\u6210\u529F"),h(e(m)),await C({name:"BpmProcessInstanceMy"})}finally{d.value.btn.loading(!1)}}};return _e(()=>{(async()=>{P.value=!0;try{if(S.value=await Le.getCategorySimpleList(),S.value.length>0&&(w.value=S.value[0].code),B.value=await Ee({suspensionState:1}),(k==null?void 0:k.length)>0){const l=await Re(k);if(!l)return void x.error("\u91CD\u65B0\u53D1\u8D77\u6D41\u7A0B\u5931\u8D25\uFF0C\u539F\u56E0\uFF1A\u6D41\u7A0B\u5B9E\u4F8B\u4E0D\u5B58\u5728");const t=B.value.find(g=>{var n;return g.key==((n=l.processDefinition)==null?void 0:n.key)});if(!t)return void x.error("\u91CD\u65B0\u53D1\u8D77\u6D41\u7A0B\u5931\u8D25\uFF0C\u539F\u56E0\uFF1A\u6D41\u7A0B\u5B9A\u4E49\u4E0D\u5B58\u5728");await K(t,l.formVariables)}}finally{P.value=!1}})()}),(l,t)=>{const g=De,n=Je,_=Ae,z=he,M=ke,O=we,Q=Ce,L=ze,W=Se,X=Ve,H=Ue,Y=Ie,ee=Pe,ae=Be,le=be("form-create"),te=qe;return e(c)?(i(),p(L,{key:1},{default:a(()=>[r(_,{class:"box-card"},{default:a(()=>[D("div",Oe,[D("span",Qe,"\u7533\u8BF7\u4FE1\u606F\u3010"+$(e(c).name)+"\u3011",1),r(X,{style:{float:"right"},type:"primary",onClick:t[1]||(t[1]=s=>c.value=void 0)},{default:a(()=>[r(W,{icon:"ep:delete"}),E(" \u9009\u62E9\u5176\u5B83\u6D41\u7A0B ")]),_:1})]),r(z,{span:16,offset:6,style:{"margin-top":"20px"}},{default:a(()=>[r(le,{rule:e(f).rule,api:e(d),"onUpdate:api":t[2]||(t[2]=s=>Z(d)?d.value=s:null),modelValue:e(f).value,"onUpdate:modelValue":t[3]||(t[3]=s=>e(f).value=s),option:e(f).option,onSubmit:J},{"type-startUserSelect":a(()=>[r(z,{span:24},{default:a(()=>[r(_,{class:"mb-10px"},{header:a(()=>[E("\u6307\u5B9A\u5BA1\u6279\u4EBA")]),default:a(()=>[r(ae,{model:e(y),rules:e(q),ref_key:"startUserSelectAssigneesFormRef",ref:T},{default:a(()=>[(i(!0),V(U,null,I(e(v),s=>(i(),p(ee,{key:s.id,label:`\u4EFB\u52A1\u3010${s.name}\u3011`,prop:s.id},{default:a(()=>[r(Y,{modelValue:e(y)[s.id],"onUpdate:modelValue":u=>e(y)[s.id]=u,multiple:"",placeholder:"\u8BF7\u9009\u62E9\u5BA1\u6279\u4EBA"},{default:a(()=>[(i(!0),V(U,null,I(e(j),u=>(i(),p(H,{key:u.id,label:u.nickname,value:u.id},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue"])]),_:2},1032,["label","prop"]))),128))]),_:1},8,["model","rules"])]),_:1})]),_:1})]),_:1},8,["rule","api","modelValue","option"])]),_:1})]),_:1}),r(Ke,{"bpmn-xml":e(R)},null,8,["bpmn-xml"])]),_:1})):xe((i(),p(L,{key:0},{default:a(()=>[r(Q,{"tab-position":"left",modelValue:e(w),"onUpdate:modelValue":t[0]||(t[0]=s=>Z(w)?w.value=s:null)},{default:a(()=>[(i(!0),V(U,null,I(e(S),s=>(i(),p(O,{label:s.name,name:s.code,key:s.code},{default:a(()=>[r(M,{gutter:20},{default:a(()=>[(i(!0),V(U,null,I(e(G),u=>(i(),p(z,{lg:6,sm:12,xs:24,key:u.id},{default:a(()=>[r(_,{shadow:"hover",class:"mb-20px cursor-pointer",onClick:Xe=>K(u)},{default:a(()=>[D("div",Me,[r(g,{src:u.icon,class:"w-32px h-32px"},null,8,["src"]),r(n,{class:"!ml-10px",size:"large"},{default:a(()=>[E($(u.name),1)]),_:2},1024)])]),_:2},1032,["onClick"])]),_:2},1024))),128))]),_:1})]),_:2},1032,["label","name"]))),128))]),_:1},8,["modelValue"])]),_:1})),[[te,e(P)]])}}});export{We as default};