1 |
- import{d as j,y as A,e as D,H as S,r as o,b as B,l as H,a as s,o as f,A as _,B as d,f as l,c as J,F as P,P as Q,aa as C,a6 as K,S as X,J as q,M as z,Q as E,R as G,U as L,X as N}from"./index-b9299550.js";import{g as O,a as T}from"./index-595d8929.js";import{g as W}from"./index-ea3dc792.js";import{u as Y}from"./useMessage-903d430d.js";import{_ as Z}from"./_plugin-vue_export-helper-1b428a4d.js";const $=Z(j({name:"SystemUserAssignRoleForm",__name:"MerchantUserAssignRoleForm",props:{isDetail:{type:Boolean,default:!1},obj:{default:void 0}},emits:["success"],setup(r,{expose:y,emit:aa}){const I=A(),V=D(()=>I.getMobile),{t:k}=S(),w=Y(),g=o(!1),i=o(!1),a=o({id:-1,nickname:"",username:"",roleIds:[]}),n=o(),p=o([]),U=r;B(()=>{(async e=>{g.value=!0,F(),a.value.id=e.id,a.value.username=e.username,a.value.nickname=e.nickname,i.value=!0;try{a.value.roleIds=await O(e.id)}finally{i.value=!1}p.value=await W({categoryId:2})})(U.obj)}),y({submitForm:async()=>{const e=o(!1);if(n&&await n.value.validate()){i.value=!0;try{await T({userId:a.value.id,roleIds:a.value.roleIds}),w.success(k("common.updateSuccess")),e.value=!0}finally{i.value=!1}return e.value}}});const F=()=>{var e;a.value={id:-1,nickname:"",username:"",roleIds:[]},(e=n.value)==null||e.resetFields()};return(e,t)=>{const v=K,m=X,c=q,b=z,h=E,x=G,M=L,R=N;return H((f(),_(M,{ref_key:"formRef",ref:n,model:s(a),"label-width":"120px",class:C({view:r.isDetail,"mobile-card":s(V)}),disabled:r.isDetail,style:{padding:"10px"}},{default:d(()=>[l(b,null,{default:d(()=>[l(c,{span:12},{default:d(()=>[l(m,{label:"\u7528\u6237\u540D\u79F0"},{default:d(()=>[l(v,{modelValue:s(a).username,"onUpdate:modelValue":t[0]||(t[0]=u=>s(a).username=u),disabled:!0},null,8,["modelValue"])]),_:1})]),_:1}),l(c,{span:12},{default:d(()=>[l(m,{label:"\u7528\u6237\u6635\u79F0"},{default:d(()=>[l(v,{modelValue:s(a).nickname,"onUpdate:modelValue":t[1]||(t[1]=u=>s(a).nickname=u),disabled:!0},null,8,["modelValue"])]),_:1})]),_:1})]),_:1}),l(b,null,{default:d(()=>[l(c,{span:24},{default:d(()=>[l(m,{label:"\u89D2\u8272"},{default:d(()=>[l(x,{style:{width:"150px"},modelValue:s(a).roleIds,"onUpdate:modelValue":t[2]||(t[2]=u=>s(a).roleIds=u),multiple:"",placeholder:"\u8BF7\u9009\u62E9\u89D2\u8272"},{default:d(()=>[(f(!0),J(P,null,Q(s(p),u=>(f(),_(h,{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(i)]])}}}),[["__scopeId","data-v-2a31d391"]]);export{$ as default};
|