import{P as e,O as a,C as l,D as s,G as t,v as o,R as i,Q as r,y as n}from"./element-plus-DSMJnpwa.js";import"./index-mv7arXuk.js";import{_ as d}from"./index-CY3mI-ZB.js";/* empty css                    *//* empty css                        *//* empty css               *//* empty css                     *//* empty css               *//* empty css               */import{B as u,aB as m,g as p,m as c,H as v,L as g,P as f,M as b,O as j,u as h,V as y,I as _,Z as w,_ as k,k as x,Y as I,d as N,n as V}from"./vue-vendor-DZekML78.js";import{d as C,e as O}from"./index-C9waQ9oZ.js";import"./utils-cPVb2Haz.js";/* empty css                  */const R={class:"p-2"},P={class:"panel"},S={class:"panel"},U={style:{"text-align":"center","margin-left":"-120px","margin-top":"30px"}},$=u({name:"AuthRole"}),B=u({...$,setup(u){const $=m(),{proxy:B}=p(),T=N(!0),Q=N(0),q=N(1),A=N(10),D=N([]),E=N([]),F=N({nickName:void 0,userName:"",userId:void 0}),G=N(),H=e=>{L(e)&&(e.flag=!e.flag,G.value?.toggleRowSelection(e,e.flag))},J=e=>{D.value=e.map(e=>e.roleId)},K=e=>String(e.roleId),L=e=>"0"===e.status,M=()=>{B?.$tab.closeOpenPage({fullPath:"",hash:"",matched:[],meta:void 0,name:void 0,params:void 0,query:void 0,redirectedFrom:void 0,path:"/system/user"})};return c(()=>{(async()=>{const e=$.params&&$.params.userId;if(e){T.value=!0;const a=await O(e);Object.assign(F.value,a.data.user),Object.assign(E.value,a.data.roles),Q.value=E.value.length,await V(()=>{E.value.forEach(e=>{e?.flag&&G.value?.toggleRowSelection(e,!0)})}),T.value=!1}})()}),(u,m)=>{const p=s,c=l,N=a,V=e,O=t,$=i,Y=r,Z=d,z=n,W=o;return v(),g("div",R,[f("div",P,[m[6]||(m[6]=f("h4",{class:"panel-title"},"基本信息",-1)),b(O,{model:h(F),inline:!0},{default:j(()=>[b(V,{gutter:10},{default:j(()=>[b(N,{span:2.5},{default:j(()=>[b(c,{label:"用户昵称",prop:"nickName"},{default:j(()=>[b(p,{modelValue:h(F).nickName,"onUpdate:modelValue":m[0]||(m[0]=e=>h(F).nickName=e),disabled:""},null,8,["modelValue"])]),_:1})]),_:1}),b(N,{span:2.5},{default:j(()=>[b(c,{label:"登录账号",prop:"userName"},{default:j(()=>[b(p,{modelValue:h(F).userName,"onUpdate:modelValue":m[1]||(m[1]=e=>h(F).userName=e),disabled:""},null,8,["modelValue"])]),_:1})]),_:1})]),_:1})]),_:1},8,["model"])]),f("div",S,[m[10]||(m[10]=f("h4",{class:"panel-title"},"角色信息",-1)),f("div",null,[y((v(),_(Y,{ref_key:"tableRef",ref:G,border:"","row-key":K,data:h(E).slice((h(q)-1)*h(A),h(q)*h(A)),onRowClick:H,onSelectionChange:J},{default:j(()=>[b($,{label:"序号",width:"55",type:"index",align:"center"},{default:j(e=>[f("span",null,w((h(q)-1)*h(A)+e.$index+1),1)]),_:1}),b($,{type:"selection","reserve-selection":!0,selectable:L,width:"55"}),b($,{label:"角色编号",align:"center",prop:"roleId"}),b($,{label:"角色名称",align:"center",prop:"roleName"}),b($,{label:"权限字符",align:"center",prop:"roleKey"}),b($,{label:"创建时间",align:"center",prop:"createTime",width:"180"},{default:j(e=>[f("span",null,w(h(B).parseTime(e.row.createTime)),1)]),_:1})]),_:1},8,["data"])),[[W,h(T)]]),y(b(Z,{page:h(q),"onUpdate:page":m[2]||(m[2]=e=>x(q)?q.value=e:null),limit:h(A),"onUpdate:limit":m[3]||(m[3]=e=>x(A)?A.value=e:null),total:h(Q)},null,8,["page","limit","total"]),[[k,h(Q)>0]]),f("div",U,[b(z,{type:"primary",onClick:m[4]||(m[4]=e=>(async()=>{const e=F.value.userId,a=D.value.join(",");await C({userId:e,roleIds:a}),B?.$modal.msgSuccess("授权成功"),M()})())},{default:j(()=>[...m[7]||(m[7]=[I("提交",-1)])]),_:1}),b(z,{onClick:m[5]||(m[5]=e=>M())},{default:j(()=>[...m[8]||(m[8]=[I("返回",-1)])]),_:1})]),m[9]||(m[9]=f("div",null,null,-1))])])])}}});export{B as default};
