UserAssignRoleForm-c833e79e.js 2.8 KB

1
  1. import{d as P,aW as W,aX as B,e as y,y as E,r,b as H,k as K,a as s,o as c,C as b,A as t,f as l,c as M,R as X,F as Z,ad as q,P as $,a9 as G,V as J,H as L,K as N,S as O,U as Q,W as T,Z as Y,_ as aa,__tla as ea}from"./index-54aa57d8.js";import{g as la,a as sa,__tla as ta}from"./index-9e4bebda.js";import{g as ua,__tla as da}from"./index-81a68108.js";import{u as ra,__tla as ia}from"./useMessage-f56cafbb.js";let h,na=Promise.all([(()=>{try{return ea}catch{}})(),(()=>{try{return ta}catch{}})(),(()=>{try{return da}catch{}})(),(()=>{try{return ia}catch{}})()]).then(async()=>{h=aa(P({name:"SystemUserAssignRoleForm",__name:"UserAssignRoleForm",props:{isDetail:{type:Boolean,default:!1},obj:{default:void 0}},emits:["success"],setup(o,{expose:w,emit:oa}){const{wsCache:I}=W(),V=I.get(B.USER),g=y(()=>V.user.id===1),k=E(),U=y(()=>k.getMobile),{t:x}=$(),F=ra(),R=r(!1),i=r(!1),a=r({id:-1,nickname:"",username:"",roleIds:[]}),n=r(),f=r([]),D=o;H(()=>{(async e=>{R.value=!0,A(),a.value.id=e.id,a.value.username=e.username,a.value.nickname=e.nickname,i.value=!0;try{a.value.roleIds=await la(e.id)}finally{i.value=!1}let u=await ua({categoryId:1});g.value||u.shift(),f.value=u})(D.obj)}),w({submitForm:async()=>{const e=r(!1);if(n&&await n.value.validate()){i.value=!0;try{await sa({userId:a.value.id,roleIds:a.value.roleIds}),F.success(x("common.updateSuccess")),e.value=!0}finally{i.value=!1}return e.value}}});const A=()=>{var e;a.value={id:-1,nickname:"",username:"",roleIds:[]},(e=n.value)==null||e.resetFields()};return(e,u)=>{const v=G,m=J,_=L,p=N,S=O,j=Q,z=T,C=Y;return K((c(),b(z,{ref_key:"formRef",ref:n,model:s(a),"label-width":"120px",class:q({view:o.isDetail,"mobile-card":s(U)}),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":u[0]||(u[0]=d=>s(a).username=d),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":u[1]||(u[1]=d=>s(a).nickname=d),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(j,{style:{width:"150px"},modelValue:s(a).roleIds,"onUpdate:modelValue":u[2]||(u[2]=d=>s(a).roleIds=d),multiple:"",placeholder:"\u8BF7\u9009\u62E9\u89D2\u8272"},{default:t(()=>[(c(!0),M(Z,null,X(s(f),d=>(c(),b(S,{key:d.id,label:d.name,value:d.id},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1})]),_:1})]),_:1})]),_:1},8,["model","class","disabled"])),[[C,s(i)]])}}}),[["__scopeId","data-v-dc251bc8"],["__file","D:/zx/mall-newfeifan-zx-admin/src/views/system/user/UserAssignRoleForm.vue"]])});export{na as __tla,h as default};