UserAssignRoleForm-946ca5ba.js 2.7 KB

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