1 |
- import{d as B,aV as E,aW as H,e as y,y as K,r,b as M,k as Q,a as s,o as _,C as b,A as t,f as l,c as W,Q as Y,F as q,ac as z,P as G,a8 as J,U as L,H as N,K as O,R as T,S as X,V as Z,Y as $,__tla as aa}from"./index-4a4d6d33.js";import{g as ea,a as la,__tla as sa}from"./index-9f72e7c3.js";import{g as ta,__tla as ua}from"./index-e5e11c42.js";import{u as da,__tla as ra}from"./useMessage-d30366d9.js";import{_ as oa}from"./_plugin-vue_export-helper-1b428a4d.js";let h,na=Promise.all([(()=>{try{return aa}catch{}})(),(()=>{try{return sa}catch{}})(),(()=>{try{return ua}catch{}})(),(()=>{try{return ra}catch{}})()]).then(async()=>{h=oa(B({name:"SystemUserAssignRoleForm",__name:"UserAssignRoleForm",props:{isDetail:{type:Boolean,default:!1},obj:{default:void 0}},emits:["success"],setup(i,{expose:V,emit:ia}){const{wsCache:I}=E(),k=I.get(H.USER),g=y(()=>k.user.id===1),w=K(),U=y(()=>w.getMobile),{t:F}=G(),x=da(),R=r(!1),o=r(!1),a=r({id:-1,nickname:"",username:"",roleIds:[]}),n=r(),f=r([]),S=i;M(()=>{(async e=>{R.value=!0,A(),a.value.id=e.id,a.value.username=e.username,a.value.nickname=e.nickname,o.value=!0;try{a.value.roleIds=await ea(e.id)}finally{o.value=!1}let u=await ta({categoryId:1});g.value||u.shift(),f.value=u})(S.obj)}),V({submitForm:async()=>{const e=r(!1);if(n&&await n.value.validate()){o.value=!0;try{await la({userId:a.value.id,roleIds:a.value.roleIds}),x.success(F("common.updateSuccess")),e.value=!0}finally{o.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 p=J,m=L,c=N,v=O,D=T,j=X,C=Z,P=$;return Q((_(),b(C,{ref_key:"formRef",ref:n,model:s(a),"label-width":"120px",class:z({view:i.isDetail,"mobile-card":s(U)}),disabled:i.isDetail,style:{padding:"10px"}},{default:t(()=>[l(v,null,{default:t(()=>[l(c,{span:12},{default:t(()=>[l(m,{label:"\u7528\u6237\u540D\u79F0"},{default:t(()=>[l(p,{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(p,{modelValue:s(a).nickname,"onUpdate:modelValue":u[1]||(u[1]=d=>s(a).nickname=d),disabled:!0},null,8,["modelValue"])]),_:1})]),_:1})]),_:1}),l(v,null,{default:t(()=>[l(c,{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(()=>[(_(!0),W(q,null,Y(s(f),d=>(_(),b(D,{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"])),[[P,s(o)]])}}}),[["__scopeId","data-v-8c53b7d6"]])});export{na as __tla,h as default};
|