import{d as R,$ as z,L as M,i as B,r,m as S,y as E,a as s,o as c,x as y,w as t,g as l,c as G,F as J,v as L,a0 as P,X as T,B as X,E as $,j as q,z as C,A as H,G as K,J as N,_ as O,__tla as Q}from"./index-7d5b26d3.js";import{g as W,a as Y,__tla as Z}from"./index-aaba0c59.js";import{g as aa,__tla as ea}from"./index-aac743c0.js";import{u as la,__tla as sa}from"./useMessage-c81eaa5b.js";let b,ta=Promise.all([(()=>{try{return Q}catch{}})(),(()=>{try{return Z}catch{}})(),(()=>{try{return ea}catch{}})(),(()=>{try{return sa}catch{}})()]).then(async()=>{b=O(R({name:"SystemUserAssignRoleForm",__name:"MerchantUserAssignRoleForm",props:{isDetail:{type:Boolean,default:!1},obj:{default:void 0}},emits:["success"],setup(i,{expose:h,emit:ua}){const w=z(),I=M(()=>w.getMobile),{t:g}=B(),k=la(),V=r(!1),n=r(!1),a=r({id:-1,nickname:"",username:"",roleIds:[]}),o=r(),f=r([]),x=i;S(()=>{(async e=>{V.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 W(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 Y({userId:a.value.id,roleIds:a.value.roleIds}),k.success(g("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 p=T,m=X,_=$,v=q,U=C,A=H,j=K,D=N;return E((c(),y(j,{ref_key:"formRef",ref:o,model:s(a),"label-width":"120px",class:P({view:i.isDetail,"mobile-card":s(I)}),disabled:i.isDetail,style:{padding:"10px"}},{default:t(()=>[l(v,null,{default:t(()=>[l(_,{span:12},{default:t(()=>[l(m,{label:"\u7528\u6237\u540D\u79F0"},{default:t(()=>[l(p,{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(p,{modelValue:s(a).nickname,"onUpdate:modelValue":d[1]||(d[1]=u=>s(a).nickname=u),disabled:!0},null,8,["modelValue"])]),_:1})]),_:1})]),_:1}),l(v,null,{default:t(()=>[l(_,{span:24},{default:t(()=>[l(m,{label:"\u89D2\u8272"},{default:t(()=>[l(A,{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),G(J,null,L(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"])),[[D,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};
