import{d as D,y as S,e as B,Q as M,r,b as L,k as Q,a as s,o as c,A as y,B as t,f as l,c as W,F as Z,R as q,ac as K,a8 as P,V as z,I as C,L as E,S as G,U as H,W as J,Z as N,__tla as O}from"./index-92ad187a.js";import{g as T,a as X,__tla as Y}from"./index-3ab54f96.js";import{g as $,__tla as aa}from"./index-205e1f6c.js";import{u as ea,__tla as la}from"./useMessage-d9788660.js";import{_ as sa}from"./_plugin-vue_export-helper-1b428a4d.js";let b,ta=Promise.all([(()=>{try{return O}catch{}})(),(()=>{try{return Y}catch{}})(),(()=>{try{return aa}catch{}})(),(()=>{try{return la}catch{}})()]).then(async()=>{b=sa(D({name:"SystemUserAssignRoleForm",__name:"MerchantUserAssignRoleForm",props:{isDetail:{type:Boolean,default:!1},obj:{default:void 0}},emits:["success"],setup(i,{expose:I,emit:ua}){const h=S(),V=B(()=>h.getMobile),{t:k}=M(),w=ea(),g=r(!1),o=r(!1),a=r({id:-1,nickname:"",username:"",roleIds:[]}),n=r(),f=r([]),U=i;L(()=>{(async e=>{g.value=!0,F(),a.value.id=e.id,a.value.username=e.username,a.value.nickname=e.nickname,o.value=!0;try{a.value.roleIds=await T(e.id)}finally{o.value=!1}f.value=await $({categoryId:2})})(U.obj)}),I({submitForm:async()=>{const e=r(!1);if(n&&await n.value.validate()){o.value=!0;try{await X({userId:a.value.id,roleIds:a.value.roleIds}),w.success(k("common.updateSuccess")),e.value=!0}finally{o.value=!1}return e.value}}});const F=()=>{var e;a.value={id:-1,nickname:"",username:"",roleIds:[]},(e=n.value)==null||e.resetFields()};return(e,d)=>{const p=P,m=z,_=C,v=E,x=G,R=H,j=J,A=N;return Q((c(),y(j,{ref_key:"formRef",ref:n,model:s(a),"label-width":"120px",class:K({view:i.isDetail,"mobile-card":s(V)}),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(R,{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),W(Z,null,q(s(f),u=>(c(),y(x,{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"])),[[A,s(o)]])}}}),[["__scopeId","data-v-81c9a65e"]])});export{ta as __tla,b as default};
