import{d as O,h as d,Y as $,r,o as i,f,w as a,b as t,c as C,e as F,F as L,a2 as P,l as B,aJ as j,aK as H,E as J}from"./index.e3896b23.js";import{u as M}from"./orgs.0a892ff5.js";import{b as S}from"./post.de075824.js";import{u as T}from"./role.44f4fe5e.js";const Y=B("\u53D6\u6D88"),z=B("\u786E\u5B9A"),h=O({__name:"add-or-update",emits:["refreshDataList"],setup(G,{expose:c,emit:y}){const n=d(!1),g=d([]),V=d([]),b=d([]),p=d(),u=$({id:"",username:"",realName:"",orgId:"",orgName:"",password:"",gender:0,email:"",mobile:"",roleIdList:[],postIdList:[],status:1}),U=o=>{n.value=!0,u.id="",p.value&&p.value.resetFields(),o&&N(o),k(),I(),w()},I=()=>S().then(o=>{g.value=o.data}),w=()=>T().then(o=>{V.value=o.data}),k=()=>M().then(o=>{b.value=o.data}),N=o=>{j(o).then(l=>{Object.assign(u,l.data)})},x=d({username:[{required:!0,message:"\u5FC5\u586B\u9879\u4E0D\u80FD\u4E3A\u7A7A",trigger:"blur"}],realName:[{required:!0,message:"\u5FC5\u586B\u9879\u4E0D\u80FD\u4E3A\u7A7A",trigger:"blur"}],mobile:[{required:!0,message:"\u5FC5\u586B\u9879\u4E0D\u80FD\u4E3A\u7A7A",trigger:"blur"}],orgId:[{required:!0,message:"\u5FC5\u586B\u9879\u4E0D\u80FD\u4E3A\u7A7A",trigger:"blur"}]}),_=()=>{p.value.validate(o=>{if(!o)return!1;H(u).then(()=>{J.success({message:"\u64CD\u4F5C\u6210\u529F",duration:500,onClose:()=>{n.value=!1,y("refreshDataList")}})})})};return c({init:U}),(o,l)=>{const m=r("el-input"),s=r("el-form-item"),R=r("el-tree-select"),v=r("fast-radio-group"),A=r("el-option"),D=r("el-select"),q=r("el-form"),E=r("el-button"),K=r("el-dialog");return i(),f(K,{modelValue:n.value,"onUpdate:modelValue":l[13]||(l[13]=e=>n.value=e),title:u.id?"\u4FEE\u6539":"\u65B0\u589E","close-on-click-modal":!1,draggable:""},{footer:a(()=>[t(E,{onClick:l[11]||(l[11]=e=>n.value=!1)},{default:a(()=>[Y]),_:1}),t(E,{type:"primary",onClick:l[12]||(l[12]=e=>_())},{default:a(()=>[z]),_:1})]),default:a(()=>[t(q,{ref_key:"dataFormRef",ref:p,model:u,rules:x.value,"label-width":"120px",onKeyup:l[10]||(l[10]=P(e=>_(),["enter"]))},{default:a(()=>[t(s,{prop:"username",label:"\u7528\u6237\u540D"},{default:a(()=>[t(m,{modelValue:u.username,"onUpdate:modelValue":l[0]||(l[0]=e=>u.username=e),placeholder:"\u7528\u6237\u540D"},null,8,["modelValue"])]),_:1}),t(s,{prop:"realName",label:"\u59D3\u540D"},{default:a(()=>[t(m,{modelValue:u.realName,"onUpdate:modelValue":l[1]||(l[1]=e=>u.realName=e),placeholder:"\u59D3\u540D"},null,8,["modelValue"])]),_:1}),t(s,{prop:"orgId",label:"\u6240\u5C5E\u673A\u6784"},{default:a(()=>[t(R,{modelValue:u.orgId,"onUpdate:modelValue":l[2]||(l[2]=e=>u.orgId=e),data:b.value,"check-strictly":"","value-key":"id",props:{label:"name",children:"children"},style:{width:"100%"}},null,8,["modelValue","data"])]),_:1}),t(s,{prop:"gender",label:"\u6027\u522B"},{default:a(()=>[t(v,{modelValue:u.gender,"onUpdate:modelValue":l[3]||(l[3]=e=>u.gender=e),"dict-type":"user_gender"},null,8,["modelValue"])]),_:1}),t(s,{prop:"mobile",label:"\u624B\u673A\u53F7"},{default:a(()=>[t(m,{modelValue:u.mobile,"onUpdate:modelValue":l[4]||(l[4]=e=>u.mobile=e),placeholder:"\u624B\u673A\u53F7"},null,8,["modelValue"])]),_:1}),t(s,{prop:"email",label:"\u90AE\u7BB1"},{default:a(()=>[t(m,{modelValue:u.email,"onUpdate:modelValue":l[5]||(l[5]=e=>u.email=e),placeholder:"\u90AE\u7BB1"},null,8,["modelValue"])]),_:1}),t(s,{prop:"password",label:"\u5BC6\u7801"},{default:a(()=>[t(m,{modelValue:u.password,"onUpdate:modelValue":l[6]||(l[6]=e=>u.password=e),type:"password",placeholder:"\u5BC6\u7801"},null,8,["modelValue"])]),_:1}),t(s,{prop:"roleIdList",label:"\u6240\u5C5E\u89D2\u8272"},{default:a(()=>[t(D,{modelValue:u.roleIdList,"onUpdate:modelValue":l[7]||(l[7]=e=>u.roleIdList=e),multiple:"",placeholder:"\u6240\u5C5E\u89D2\u8272",style:{width:"100%"}},{default:a(()=>[(i(!0),C(L,null,F(V.value,e=>(i(),f(A,{key:e.id,label:e.name,value:e.id},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1}),t(s,{prop:"postIdList",label:"\u6240\u5C5E\u5C97\u4F4D"},{default:a(()=>[t(D,{modelValue:u.postIdList,"onUpdate:modelValue":l[8]||(l[8]=e=>u.postIdList=e),multiple:"",placeholder:"\u6240\u5C5E\u5C97\u4F4D",style:{width:"100%"}},{default:a(()=>[(i(!0),C(L,null,F(g.value,e=>(i(),f(A,{key:e.id,label:e.postName,value:e.id},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1}),t(s,{prop:"status",label:"\u72B6\u6001"},{default:a(()=>[t(v,{modelValue:u.status,"onUpdate:modelValue":l[9]||(l[9]=e=>u.status=e),"dict-type":"user_status"},null,8,["modelValue"])]),_:1})]),_:1},8,["model","rules"])]),_:1},8,["modelValue","title"])}}});export{h as _};
