import{d as j,Z as z,K as M,h as S,r,l as q,x as B,a as s,o as c,v as y,w as t,f as l,c as E,F as K,q as W,$ as P,W as Q,A as Z,E as $,i as C,y as G,z as H,D as J,I as L,_ as N,__tla as O}from"./index-04f8d540.js";import{g as T,a as X,__tla as Y}from"./index-2a19b66b.js";import{g as aa,__tla as ea}from"./index-d9bdf74a.js";import{u as la,__tla as sa}from"./useMessage-9c37e840.js";let b,ta=Promise.all([(()=>{try{return O}catch{}})(),(()=>{try{return Y}catch{}})(),(()=>{try{return ea}catch{}})(),(()=>{try{return sa}catch{}})()]).then(async()=>{b=N(j({name:"SystemUserAssignRoleForm",__name:"MerchantUserAssignRoleForm",props:{isDetail:{type:Boolean,default:!1},obj:{default:void 0}},emits:["success"],setup(i,{expose:h,emit:ua}){const I=z(),w=M(()=>I.getMobile),{t:k}=S(),V=la(),g=r(!1),n=r(!1),a=r({id:-1,nickname:"",username:"",roleIds:[]}),o=r(),f=r([]),x=i;q(()=>{(async e=>{g.value=!0,F(),a.value.id=e.id,a.value.username=e.username,a.value.nickname=e.nickname,n.value=!0;try{a.value.roleIds=await T(e.id)}finally{n.value=!1}f.value=await aa({categoryId:2})})(x.obj)}),h({submitForm:async()=>{const e=r(!1);if(o&&await o.value.validate()){n.value=!0;try{await X({userId:a.value.id,roleIds:a.value.roleIds}),V.success(k("common.updateSuccess")),e.value=!0}finally{n.value=!1}return e.value}}});const F=()=>{var e;a.value={id:-1,nickname:"",username:"",roleIds:[]},(e=o.value)==null||e.resetFields()};return(e,d)=>{const v=Q,m=Z,_=$,p=C,U=G,D=H,A=J,R=L;return B((c(),y(A,{ref_key:"formRef",ref:o,model:s(a),"label-width":"120px",class:P({view:i.isDetail,"mobile-card":s(w)}),disabled:i.isDetail,style:{padding:"10px"}},{default:t(()=>[l(p,null,{default:t(()=>[l(_,{span:12},{default:t(()=>[l(m,{label:"\u7528\u6237\u540D\u79F0"},{default:t(()=>[l(v,{modelValue:s(a).username,"onUpdate:modelValue":d[0]||(d[0]=u=>s(a).username=u),disabled:!0},null,8,["modelValue"])]),_:1})]),_:1}),l(_,{span:12},{default:t(()=>[l(m,{label:"\u7528\u6237\u6635\u79F0"},{default:t(()=>[l(v,{modelValue:s(a).nickname,"onUpdate:modelValue":d[1]||(d[1]=u=>s(a).nickname=u),disabled:!0},null,8,["modelValue"])]),_:1})]),_:1})]),_:1}),l(p,null,{default:t(()=>[l(_,{span:24},{default:t(()=>[l(m,{label:"\u89D2\u8272"},{default:t(()=>[l(D,{style:{width:"150px"},modelValue:s(a).roleIds,"onUpdate:modelValue":d[2]||(d[2]=u=>s(a).roleIds=u),multiple:"",placeholder:"\u8BF7\u9009\u62E9\u89D2\u8272"},{default:t(()=>[(c(!0),E(K,null,W(s(f),u=>(c(),y(U,{key:u.id,label:u.name,value:u.id},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1})]),_:1})]),_:1})]),_:1},8,["model","class","disabled"])),[[R,s(n)]])}}}),[["__scopeId","data-v-a1305592"],["__file","D:/zx/mall-newfeifan-zx-business/src/views/system/sale/merchant/components/MerchantUserAssignRoleForm.vue"]])});export{ta as __tla,b as default};
