UserAssignRoleForm-21e8cb24.js 2.8 KB

1
  1. import{d as q,c8 as B,c9 as C,K as y,Y as K,r,l as M,x as Y,a as s,o as _,v as b,w as t,f as l,c as Z,q as G,F as H,Z as J,h as P,V as W,A as L,E as N,i as O,y as Q,z as T,D as X,I as $,_ as aa,__tla as ea}from"./index-e1bb590d.js";import{g as la,a as sa,__tla as ta}from"./index-6b1819f8.js";import{g as ua,__tla as da}from"./index-f2f71338.js";import{u as ra,__tla as ia}from"./useMessage-042ce74c.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(q({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}=B(),V=I.get(C.USER),g=y(()=>V.user.id===1),k=K(),x=y(()=>k.getMobile),{t:F}=P(),U=ra(),A=r(!1),i=r(!1),a=r({id:-1,nickname:"",username:"",roleIds:[]}),n=r(),f=r([]),D=o;M(()=>{(async e=>{A.value=!0,R(),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}),U.success(F("common.updateSuccess")),e.value=!0}finally{i.value=!1}return e.value}}});const R=()=>{var e;a.value={id:-1,nickname:"",username:"",roleIds:[]},(e=n.value)==null||e.resetFields()};return(e,u)=>{const v=W,m=L,c=N,p=O,j=Q,z=T,S=X,E=$;return Y((_(),b(S,{ref_key:"formRef",ref:n,model:s(a),"label-width":"120px",class:J({view:o.isDetail,"mobile-card":s(x)}),disabled:o.isDetail,style:{padding:"10px"}},{default:t(()=>[l(p,null,{default:t(()=>[l(c,{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(c,{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(c,{span:24},{default:t(()=>[l(m,{label:"\u89D2\u8272"},{default:t(()=>[l(z,{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(()=>[(_(!0),Z(H,null,G(s(f),d=>(_(),b(j,{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"])),[[E,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};