DeptForm-57587661.js 5.6 KB

1
  1. import{d as $,h as j,r as o,e as G,o as i,q as f,w as a,f as e,m as x,v as J,a as r,c as q,F as E,n as S,N as K,z as Q,E as W,U as X,i as Y,bb as Z,x as ee,y as ae,C as le,B as te,H as re,__tla as se}from"./index-2eab2d23.js";import{_ as ue,__tla as oe}from"./Dialog-c2716df6.js";import{E as de,__tla as ne}from"./el-tree-select-4ae7c290.js";import{a as me,D as ie,__tla as pe}from"./dict-1ad71b6f.js";import{d as _e,h as ce}from"./tree-fd3a041e.js";import{a as fe,c as ve,u as he,g as ge,__tla as ye}from"./index-06f833f4.js";import{g as Ve,__tla as be}from"./index-e191a423.js";import{C}from"./constants-40f13f5e.js";import{u as Ue,__tla as Ie}from"./useMessage-171aa63e.js";import{_ as we}from"./_plugin-vue_export-helper-1b428a4d.js";let F,ke=Promise.all([(()=>{try{return se}catch{}})(),(()=>{try{return oe}catch{}})(),(()=>{try{return ne}catch{}})(),(()=>{try{return pe}catch{}})(),(()=>{try{return ye}catch{}})(),(()=>{try{return be}catch{}})(),(()=>{try{return Ie}catch{}})()]).then(async()=>{F=we($({name:"SystemDeptForm",__name:"DeptForm",emits:["success"],setup(xe,{expose:N,emit:A}){const{t:v}=j(),y=Ue(),m=o(!1),V=o(""),p=o(!1),b=o(""),s=o({id:void 0,title:"",parentId:void 0,name:void 0,sort:void 0,leaderUserId:void 0,phone:void 0,email:void 0,status:C.ENABLE}),B=G({parentId:[{required:!0,message:"\u4E0A\u7EA7\u90E8\u95E8\u4E0D\u80FD\u4E3A\u7A7A",trigger:"blur"}],name:[{required:!0,message:"\u90E8\u95E8\u540D\u79F0\u4E0D\u80FD\u4E3A\u7A7A",trigger:"blur"}],sort:[{required:!0,message:"\u663E\u793A\u6392\u5E8F\u4E0D\u80FD\u4E3A\u7A7A",trigger:"blur"}],email:[{type:"email",message:"\u8BF7\u8F93\u5165\u6B63\u786E\u7684\u90AE\u7BB1\u5730\u5740",trigger:["blur","change"]}],phone:[{pattern:/^1[3|4|5|6|7|8|9][0-9]\d{8}$/,message:"\u8BF7\u8F93\u5165\u6B63\u786E\u7684\u624B\u673A\u53F7\u7801",trigger:"blur"}],status:[{required:!0,message:"\u72B6\u6001\u4E0D\u80FD\u4E3A\u7A7A",trigger:"blur"}]}),_=o(),h=o(),U=o([]);N({open:async(u,l)=>{if(m.value=!0,V.value=v("action."+u),b.value=u,M(),l){p.value=!0;try{s.value=await fe(l)}finally{p.value=!1}}U.value=await Ve(),await T()}});const D=A,L=async()=>{if(_&&await _.value.validate()){p.value=!0;try{const u=s.value;b.value==="create"?(await ve(u),y.success(v("common.createSuccess"))):(await he(u),y.success(v("common.updateSuccess"))),m.value=!1,D("success")}finally{p.value=!1}}},M=()=>{var u;s.value={id:void 0,title:"",parentId:void 0,name:void 0,sort:void 0,leaderUserId:void 0,phone:void 0,email:void 0,status:C.ENABLE},(u=_.value)==null||u.resetFields()},T=async()=>{h.value=[];const u=await ge();let l={id:0,name:"\u9876\u7EA7\u90E8\u95E8",children:[]};l.children=ce(u),h.value.push(l)};return(u,l)=>{const O=de,d=Q,n=W,g=X,c=Y,z=Z,I=ee,w=ae,H=le,k=te,P=ue,R=re;return i(),f(P,{modelValue:r(m),"onUpdate:modelValue":l[8]||(l[8]=t=>K(m)?m.value=t:null),title:r(V)},{footer:a(()=>[e(k,{type:"primary",onClick:L},{default:a(()=>[x("\u786E \u5B9A")]),_:1}),e(k,{onClick:l[7]||(l[7]=t=>m.value=!1)},{default:a(()=>[x("\u53D6 \u6D88")]),_:1})]),default:a(()=>[J((i(),f(H,{ref_key:"formRef",ref:_,model:r(s),rules:r(B),"label-width":"80px"},{default:a(()=>[e(c,{gutter:30},{default:a(()=>[e(n,{span:"12"},{default:a(()=>[e(d,{label:"\u4E0A\u7EA7\u90E8\u95E8",prop:"parentId"},{default:a(()=>[e(O,{modelValue:r(s).parentId,"onUpdate:modelValue":l[0]||(l[0]=t=>r(s).parentId=t),data:r(h),props:r(_e),"check-strictly":"","default-expand-all":"",placeholder:"\u8BF7\u9009\u62E9\u4E0A\u7EA7\u90E8\u95E8","value-key":"deptId"},null,8,["modelValue","data","props"])]),_:1})]),_:1}),e(n,{span:"12"},{default:a(()=>[e(d,{label:"\u90E8\u95E8\u540D\u79F0",prop:"name"},{default:a(()=>[e(g,{modelValue:r(s).name,"onUpdate:modelValue":l[1]||(l[1]=t=>r(s).name=t),placeholder:"\u8BF7\u8F93\u5165\u90E8\u95E8\u540D\u79F0"},null,8,["modelValue"])]),_:1})]),_:1})]),_:1}),e(c,{gutter:30},{default:a(()=>[e(n,{span:"12"},{default:a(()=>[e(d,{label:"\u663E\u793A\u6392\u5E8F",prop:"sort"},{default:a(()=>[e(z,{modelValue:r(s).sort,"onUpdate:modelValue":l[2]||(l[2]=t=>r(s).sort=t),min:0,"controls-position":"right"},null,8,["modelValue"])]),_:1})]),_:1}),e(n,{span:"12"},{default:a(()=>[e(d,{label:"\u8D1F\u8D23\u4EBA",prop:"leaderUserId"},{default:a(()=>[e(w,{modelValue:r(s).leaderUserId,"onUpdate:modelValue":l[3]||(l[3]=t=>r(s).leaderUserId=t),clearable:"",placeholder:"\u8BF7\u8F93\u5165\u8D1F\u8D23\u4EBA"},{default:a(()=>[(i(!0),q(E,null,S(r(U),t=>(i(),f(I,{key:t.id,label:t.nickname,value:t.id},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1})]),_:1})]),_:1}),e(c,{gutter:30},{default:a(()=>[e(n,{span:"12"},{default:a(()=>[e(d,{label:"\u8054\u7CFB\u7535\u8BDD",prop:"phone"},{default:a(()=>[e(g,{modelValue:r(s).phone,"onUpdate:modelValue":l[4]||(l[4]=t=>r(s).phone=t),maxlength:"11",placeholder:"\u8BF7\u8F93\u5165\u8054\u7CFB\u7535\u8BDD"},null,8,["modelValue"])]),_:1})]),_:1}),e(n,{span:"12"},{default:a(()=>[e(d,{label:"\u90AE\u7BB1",prop:"email"},{default:a(()=>[e(g,{modelValue:r(s).email,"onUpdate:modelValue":l[5]||(l[5]=t=>r(s).email=t),maxlength:"50",placeholder:"\u8BF7\u8F93\u5165\u90AE\u7BB1"},null,8,["modelValue"])]),_:1})]),_:1})]),_:1}),e(c,{gutter:30},{default:a(()=>[e(n,{span:"12"},{default:a(()=>[e(d,{label:"\u72B6\u6001",prop:"status"},{default:a(()=>[e(w,{modelValue:r(s).status,"onUpdate:modelValue":l[6]||(l[6]=t=>r(s).status=t),clearable:"",placeholder:"\u8BF7\u9009\u62E9\u72B6\u6001"},{default:a(()=>[(i(!0),q(E,null,S(r(me)(r(ie).COMMON_STATUS),t=>(i(),f(I,{key:t.value,label:t.label,value:t.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1})]),_:1})]),_:1})]),_:1},8,["model","rules"])),[[R,r(p)]])]),_:1},8,["modelValue","title"])}}}),[["__scopeId","data-v-63276e71"]])});export{ke as __tla,F as default};