import{d as $,u as M,r as d,A as N,b as Q,P as W,a as e,o,g as v,B as r,k as t,c as _,i as b,a3 as Y,N as Z,F as y,O as q,h as j,Q as K,R as z,S as D,T as G,a7 as H,W as I,am as J,V as X,Z as ee,$ as ae}from"./index-BP6bNRoi.js";import{E as le}from"./el-card-bU92WWV4.js";import{c as re}from"./index-B8sHfnMD.js";import{u as te}from"./tagsView-DQpvPGX0.js";import{a as se}from"./index-C5h6z2YM.js";import{g as ue}from"./index-vFgEqmZu.js";const de=$({name:"BpmOALeaveCreate",__name:"create",setup(oe){const V=K(),{delView:x}=te(),{push:O,currentRoute:B}=M(),c=d(!1),s=d({type:void 0,reason:void 0,startTime:void 0,endTime:void 0}),E=N({type:[{required:!0,message:"\u8BF7\u5047\u7C7B\u578B\u4E0D\u80FD\u4E3A\u7A7A",trigger:"blur"}],reason:[{required:!0,message:"\u8BF7\u5047\u539F\u56E0\u4E0D\u80FD\u4E3A\u7A7A",trigger:"change"}],startTime:[{required:!0,message:"\u8BF7\u5047\u5F00\u59CB\u65F6\u95F4\u4E0D\u80FD\u4E3A\u7A7A",trigger:"change"}],endTime:[{required:!0,message:"\u8BF7\u5047\u7ED3\u675F\u65F6\u95F4\u4E0D\u80FD\u4E3A\u7A7A",trigger:"change"}]}),g=d(),i=d([]),p=d({}),h=d(),T=d({}),k=d([]),P=async()=>{var m,l;if(g&&await g.value.validate()){((m=i.value)==null?void 0:m.length)>0&&await h.value.validate(),c.value=!0;try{const u={...s.value};((l=i.value)==null?void 0:l.length)>0&&(u.startUserSelectAssignees=p.value),await re(u),V.success("\u53D1\u8D77\u6210\u529F"),x(e(B)),await O({name:"BpmOALeave"})}finally{c.value=!1}}};return Q(async()=>{var l;const m=await se(void 0,"oa_leave");if(m){if(i.value=m.startUserSelectTasks,((l=i.value)==null?void 0:l.length)>0){for(const u of i.value)p.value[u.id]=[],T.value[u.id]=[{required:!0,message:"\u8BF7\u9009\u62E9\u5BA1\u6279\u4EBA",trigger:"blur"}];k.value=await ue()}}else V.error("OA \u8BF7\u5047\u7684\u6D41\u7A0B\u6A21\u578B\u672A\u914D\u7F6E\uFF0C\u8BF7\u68C0\u67E5\uFF01")}),(m,l)=>{const u=ae,U=z,n=D,w=G,R=H,A=I,S=le,L=J,C=X,F=ee;return W((o(),v(A,{ref_key:"formRef",ref:g,model:e(s),rules:e(E),"label-width":"80px"},{default:r(()=>[t(n,{label:"\u8BF7\u5047\u7C7B\u578B",prop:"type"},{default:r(()=>[t(U,{modelValue:e(s).type,"onUpdate:modelValue":l[0]||(l[0]=a=>e(s).type=a),clearable:"",placeholder:"\u8BF7\u9009\u62E9\u8BF7\u5047\u7C7B\u578B"},{default:r(()=>[(o(!0),_(y,null,b(e(Y)(e(Z).BPM_OA_LEAVE_TYPE),a=>(o(),v(u,{key:a.value,label:a.label,value:a.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1}),t(n,{label:"\u5F00\u59CB\u65F6\u95F4",prop:"startTime"},{default:r(()=>[t(w,{modelValue:e(s).startTime,"onUpdate:modelValue":l[1]||(l[1]=a=>e(s).startTime=a),clearable:"",placeholder:"\u8BF7\u9009\u62E9\u5F00\u59CB\u65F6\u95F4",type:"datetime","value-format":"x"},null,8,["modelValue"])]),_:1}),t(n,{label:"\u7ED3\u675F\u65F6\u95F4",prop:"endTime"},{default:r(()=>[t(w,{modelValue:e(s).endTime,"onUpdate:modelValue":l[2]||(l[2]=a=>e(s).endTime=a),clearable:"",placeholder:"\u8BF7\u9009\u62E9\u7ED3\u675F\u65F6\u95F4",type:"datetime","value-format":"x"},null,8,["modelValue"])]),_:1}),t(n,{label:"\u539F\u56E0",prop:"reason"},{default:r(()=>[t(R,{modelValue:e(s).reason,"onUpdate:modelValue":l[3]||(l[3]=a=>e(s).reason=a),placeholder:"\u8BF7\u8F93\u8BF7\u5047\u539F\u56E0",type:"textarea"},null,8,["modelValue"])]),_:1}),e(i).length>0?(o(),v(L,{key:0},{default:r(()=>[t(S,{class:"mb-10px"},{header:r(()=>[q("\u6307\u5B9A\u5BA1\u6279\u4EBA")]),default:r(()=>[t(A,{model:e(p),rules:e(T),ref_key:"startUserSelectAssigneesFormRef",ref:h},{default:r(()=>[(o(!0),_(y,null,b(e(i),a=>(o(),v(n,{key:a.id,label:`\u4EFB\u52A1\u3010${a.name}\u3011`,prop:a.id},{default:r(()=>[t(U,{modelValue:e(p)[a.id],"onUpdate:modelValue":f=>e(p)[a.id]=f,multiple:"",placeholder:"\u8BF7\u9009\u62E9\u5BA1\u6279\u4EBA"},{default:r(()=>[(o(!0),_(y,null,b(e(k),f=>(o(),v(u,{key:f.id,label:f.nickname,value:f.id},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue"])]),_:2},1032,["label","prop"]))),128))]),_:1},8,["model","rules"])]),_:1})]),_:1})):j("",!0),t(n,null,{default:r(()=>[t(C,{disabled:e(c),type:"primary",onClick:P},{default:r(()=>[q("\u786E \u5B9A")]),_:1},8,["disabled"])]),_:1})]),_:1},8,["model","rules"])),[[F,e(c)]])}}});export{de as default};