import{d as E,aU as L,aV as M,e as y,y as Q,r,b as W,k as Z,a as s,o as _,A as b,B as t,f as l,c as q,R as z,F as G,ac as H,Q as K,a8 as P,V as J,I as N,L as O,S as T,U as X,W as Y,Z as $,__tla as aa}from"./index-92ad187a.js";import{g as ea,a as la,__tla as sa}from"./index-3ab54f96.js";import{g as ta,__tla as ua}from"./index-205e1f6c.js";import{u as da,__tla as ra}from"./useMessage-d9788660.js";import{_ as oa}from"./_plugin-vue_export-helper-1b428a4d.js";let h,na=Promise.all([(()=>{try{return aa}catch{}})(),(()=>{try{return sa}catch{}})(),(()=>{try{return ua}catch{}})(),(()=>{try{return ra}catch{}})()]).then(async()=>{h=oa(E({name:"SystemUserAssignRoleForm",__name:"UserAssignRoleForm",props:{isDetail:{type:Boolean,default:!1},obj:{default:void 0}},emits:["success"],setup(i,{expose:I,emit:ia}){const{wsCache:V}=L(),k=V.get(M.USER),g=y(()=>k.user.id===1),w=Q(),U=y(()=>w.getMobile),{t:F}=K(),x=da(),R=r(!1),o=r(!1),a=r({id:-1,nickname:"",username:"",roleIds:[]}),n=r(),f=r([]),A=i;W(()=>{(async e=>{R.value=!0,S(),a.value.id=e.id,a.value.username=e.username,a.value.nickname=e.nickname,o.value=!0;try{a.value.roleIds=await ea(e.id)}finally{o.value=!1}let u=await ta({categoryId:1});g.value||u.shift(),f.value=u})(A.obj)}),I({submitForm:async()=>{const e=r(!1);if(n&&await n.value.validate()){o.value=!0;try{await la({userId:a.value.id,roleIds:a.value.roleIds}),x.success(F("common.updateSuccess")),e.value=!0}finally{o.value=!1}return e.value}}});const S=()=>{var e;a.value={id:-1,nickname:"",username:"",roleIds:[]},(e=n.value)==null||e.resetFields()};return(e,u)=>{const p=P,m=J,c=N,v=O,j=T,D=X,B=Y,C=$;return Z((_(),b(B,{ref_key:"formRef",ref:n,model:s(a),"label-width":"120px",class:H({view:i.isDetail,"mobile-card":s(U)}),disabled:i.isDetail,style:{padding:"10px"}},{default:t(()=>[l(v,null,{default:t(()=>[l(c,{span:12},{default:t(()=>[l(m,{label:"\u7528\u6237\u540D\u79F0"},{default:t(()=>[l(p,{modelValue:s(a).username,"onUpdate:modelValue":u[0]||(u[0]=d=>s(a).username=d),disabled:!0},null,8,["modelValue"])]),_:1})]),_:1}),l(c,{span:12},{default:t(()=>[l(m,{label:"\u7528\u6237\u6635\u79F0"},{default:t(()=>[l(p,{modelValue:s(a).nickname,"onUpdate:modelValue":u[1]||(u[1]=d=>s(a).nickname=d),disabled:!0},null,8,["modelValue"])]),_:1})]),_:1})]),_:1}),l(v,null,{default:t(()=>[l(c,{span:24},{default:t(()=>[l(m,{label:"\u89D2\u8272"},{default:t(()=>[l(D,{style:{width:"150px"},modelValue:s(a).roleIds,"onUpdate:modelValue":u[2]||(u[2]=d=>s(a).roleIds=d),multiple:"",placeholder:"\u8BF7\u9009\u62E9\u89D2\u8272"},{default:t(()=>[(_(!0),q(G,null,z(s(f),d=>(_(),b(j,{key:d.id,label:d.name,value:d.id},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1})]),_:1})]),_:1})]),_:1},8,["model","class","disabled"])),[[C,s(o)]])}}}),[["__scopeId","data-v-8c53b7d6"]])});export{na as __tla,h as default};
