import{a as E,J as K,r as i,M as F,d as s,N as J,o as h,g as L,i as c,k as t,f as a,l as o,z as C,e as M,t as S,O as P,B as V,n as $,L as q}from"./index-C3I6HYnn.js";import{a as G,u as H}from"./user-y7S8bZYV.js";const Q={class:"app-container"},W={style:{"text-align":"center","margin-left":"-120px","margin-top":"30px"}},X=q({name:"AuthRole"}),te=Object.assign(X,{setup(Y){const v=E(),{proxy:f}=K(),g=i(!0),b=i(0),u=i(1),d=i(10),k=i([]),_=i([]),r=i({nickName:void 0,userName:void 0,userId:void 0});function B(l){w(l)&&f.$refs.roleRef.toggleRowSelection(l)}function T(l){k.value=l.map(e=>e.roleId)}function U(l){return l.roleId}function w(l){return l.status==="0"}function N(){const l={path:"/system/user"};f.$tab.closeOpenPage(l)}function j(){const l=r.value.userId,e=k.value.join(",");H({userId:l,roleIds:e}).then(()=>{f.$modal.msgSuccess("授权成功"),N()})}return(()=>{const l=v.params&&v.params.userId;l&&(g.value=!0,G(l).then(e=>{r.value=e.user,_.value=e.roles,b.value=_.value.length,F(()=>{_.value.forEach(m=>{m.flag&&f.$refs.roleRef.toggleRowSelection(m)})}),g.value=!1}))})(),(l,e)=>{const m=s("el-input"),I=s("el-form-item"),R=s("el-col"),A=s("el-row"),x=s("el-form"),p=s("el-table-column"),D=s("el-table"),O=s("pagination"),y=s("el-button"),z=J("loading");return h(),L("div",Q,[e[8]||(e[8]=c("h4",{class:"form-header h4"},"基本信息",-1)),t(x,{model:o(r),"label-width":"80px"},{default:a(()=>[t(A,null,{default:a(()=>[t(R,{span:8,offset:2},{default:a(()=>[t(I,{label:"用户昵称",prop:"nickName"},{default:a(()=>[t(m,{modelValue:o(r).nickName,"onUpdate:modelValue":e[0]||(e[0]=n=>o(r).nickName=n),disabled:""},null,8,["modelValue"])]),_:1})]),_:1}),t(R,{span:8,offset:2},{default:a(()=>[t(I,{label:"登录账号",prop:"userName"},{default:a(()=>[t(m,{modelValue:o(r).userName,"onUpdate:modelValue":e[1]||(e[1]=n=>o(r).userName=n),disabled:""},null,8,["modelValue"])]),_:1})]),_:1})]),_:1})]),_:1},8,["model"]),e[9]||(e[9]=c("h4",{class:"form-header h4"},"角色信息",-1)),C((h(),M(D,{"row-key":U,onRowClick:B,ref:"roleRef",onSelectionChange:T,data:o(_).slice((o(u)-1)*o(d),o(u)*o(d))},{default:a(()=>[t(p,{label:"序号",width:"55",type:"index",align:"center"},{default:a(n=>[c("span",null,S((o(u)-1)*o(d)+n.$index+1),1)]),_:1}),t(p,{type:"selection","reserve-selection":!0,selectable:w,width:"55"}),t(p,{label:"角色编号",align:"center",prop:"roleId"}),t(p,{label:"角色名称",align:"center",prop:"roleName"}),t(p,{label:"权限字符",align:"center",prop:"roleKey"}),t(p,{label:"创建时间",align:"center",prop:"createTime",width:"180"},{default:a(n=>[c("span",null,S(l.parseTime(n.row.createTime)),1)]),_:1})]),_:1},8,["data"])),[[z,o(g)]]),C(t(O,{total:o(b),page:o(u),"onUpdate:page":e[2]||(e[2]=n=>V(u)?u.value=n:null),limit:o(d),"onUpdate:limit":e[3]||(e[3]=n=>V(d)?d.value=n:null)},null,8,["total","page","limit"]),[[P,o(b)>0]]),t(x,{"label-width":"100px"},{default:a(()=>[c("div",W,[t(y,{type:"primary",onClick:e[4]||(e[4]=n=>j())},{default:a(()=>[...e[6]||(e[6]=[$("提交",-1)])]),_:1}),t(y,{onClick:e[5]||(e[5]=n=>N())},{default:a(()=>[...e[7]||(e[7]=[$("返回",-1)])]),_:1})])]),_:1})])}}});export{te as default};
