import{u as N}from"./useInstance.233fbdde.js";import{d as h,b as S,r as _,p as j,ac as I,ad as L,c as n,e as F,k as g,i as t,h as a,u,f as R,j as T,m as i,t as $,F as q,a2 as z,ae as G,E as v,af as H}from"./index.0308b213.js";import{M as J}from"./index.dfdc0704.js";const K=i("\u5F00\u542F"),O=i("\u7981\u7528"),P=i("\u63D0\u4EA4"),Q=i("\u53D6\u6D88"),Z=h({props:{modelValue:{type:Boolean},id:null},emits:["update:modelValue","onClose"],setup(B,{emit:D}){const r=B,e=S({id:0,username:"",password:"",role_id:"",realname:"",mobile:"",nickname:"",avatar:"",status:1}),f=_([]),V=_(!1);let c=_(!1);j(()=>r.modelValue,s=>{V.value=s,r.id&&Number(r.id)>0?(c.value=!0,e.id=r.id,I({id:r.id}).then(l=>{f.value=l.data.role_list,e.username=l.data.operator.username,e.role_id=l.data.operator.roleid,e.realname=l.data.operator.realname,e.mobile=l.data.operator.mobile,e.nickname=l.data.operator.nickname,e.avatar=l.data.operator.avatar,e.status=l.data.operator.status})):(c.value=!1,L().then(l=>{f.value=l.data}))});const U=()=>{e.id>0?G(e).then(s=>{v({message:s.msg,type:"success"}),p()}):H(e).then(s=>{v({message:s.msg,type:"success"}),p()})},p=()=>{D("update:modelValue",!1),D("onClose"),A.$resetForm(k.value,e)},k=_(),{global:A}=N();return(s,l)=>{const m=n("el-input"),d=n("el-form-item"),y=n("el-option"),E=n("el-select"),b=n("el-radio"),w=n("el-radio-group"),C=n("el-button"),x=n("el-dialog");return F(),g(x,{modelValue:V.value,"onUpdate:modelValue":l[8]||(l[8]=o=>V.value=o),title:u(c)?"\u6DFB\u52A0\u64CD\u4F5C\u5458":"\u7F16\u8F91\u64CD\u4F5C\u5458",width:"50%","destroy-on-close":"",onClose:p},{default:t(()=>[a(u(z),{model:u(e),"label-width":"120px"},{default:t(()=>[a(d,{label:"\u64CD\u4F5C\u5458\u7528\u6237\u540D"},{default:t(()=>[a(m,{modelValue:u(e).username,"onUpdate:modelValue":l[0]||(l[0]=o=>u(e).username=o),placeholder:"\u8BF7\u8F93\u5165\u64CD\u4F5C\u5458\u7528\u6237\u540D"},null,8,["modelValue"])]),_:1}),a(d,{label:"\u64CD\u4F5C\u5458\u5BC6\u7801"},{default:t(()=>[a(m,{modelValue:u(e).password,"onUpdate:modelValue":l[1]||(l[1]=o=>u(e).password=o),placeholder:"\u8BF7\u8F93\u5165\u64CD\u4F5C\u5458\u5BC6\u7801"},null,8,["modelValue"])]),_:1}),a(d,{label:"\u89D2\u8272"},{default:t(()=>[a(E,{modelValue:u(e).role_id,"onUpdate:modelValue":l[2]||(l[2]=o=>u(e).role_id=o),placeholder:"\u8BF7\u9009\u62E9\u89D2\u8272"},{default:t(()=>[(F(!0),R(q,null,T(f.value,(o,M)=>(F(),g(y,{key:M,value:o.id,label:o.rolename},{default:t(()=>[i($(o.rolename),1)]),_:2},1032,["value","label"]))),128))]),_:1},8,["modelValue"])]),_:1}),a(d,{label:"\u59D3\u540D"},{default:t(()=>[a(m,{modelValue:u(e).realname,"onUpdate:modelValue":l[3]||(l[3]=o=>u(e).realname=o),placeholder:"\u8BF7\u8F93\u5165\u59D3\u540D"},null,8,["modelValue"])]),_:1}),a(d,{label:"\u7535\u8BDD"},{default:t(()=>[a(m,{modelValue:u(e).mobile,"onUpdate:modelValue":l[4]||(l[4]=o=>u(e).mobile=o),placeholder:"\u8BF7\u8F93\u5165\u7535\u8BDD"},null,8,["modelValue"])]),_:1}),a(d,{label:"\u6635\u79F0"},{default:t(()=>[a(m,{modelValue:u(e).nickname,"onUpdate:modelValue":l[5]||(l[5]=o=>u(e).nickname=o),placeholder:"\u8BF7\u8F93\u5165\u6635\u79F0"},null,8,["modelValue"])]),_:1}),a(d,{label:"\u5934\u50CF"},{default:t(()=>[a(J,{modelValue:u(e).avatar,"onUpdate:modelValue":l[6]||(l[6]=o=>u(e).avatar=o),limit:1},null,8,["modelValue"])]),_:1}),a(d,{label:"\u72B6\u6001"},{default:t(()=>[a(w,{modelValue:u(e).status,"onUpdate:modelValue":l[7]||(l[7]=o=>u(e).status=o)},{default:t(()=>[a(b,{label:1},{default:t(()=>[K]),_:1}),a(b,{label:0},{default:t(()=>[O]),_:1})]),_:1},8,["modelValue"])]),_:1}),a(d,null,{default:t(()=>[a(C,{type:"primary",onClick:U},{default:t(()=>[P]),_:1}),a(C,{onClick:p},{default:t(()=>[Q]),_:1})]),_:1})]),_:1},8,["model"])]),_:1},8,["modelValue","title"])}}});export{Z as _};
