import{E as D,a as K}from"./el-form-item-BvJauXBe.js";import{d as T,u as L,h as P,b as M,o as R,c as Z,q as s,m as l,p as n,t as G,e as o,w as x,v as H,a0 as J,z as C,aF as Q,aZ as S,y as V,A as W,r,n as X}from"./index-XuO881sr.js";import{E as Y}from"./el-row-eghH2z0a.js";import{E as ee}from"./el-col-DKCbe2AW.js";import{a as te,E as oe}from"./el-table-column-5BM1zXQ-.js";import{_ as le}from"./index-CcdWvSxw.js";import"./el-checkbox-Cxc7yQYm.js";/* empty css               */import{c as ae,d as ne}from"./index-74tJTFsC.js";import"./cloneDeep-CQdyn166.js";import"./_baseClone-CIlxLVYA.js";import"./_baseIteratee-CskuuWpP.js";import"./el-select-BHeVexdj.js";import"./strings-giQSq8zG.js";import"./index-B7j6XCDK.js";import"./omit-nuy_stBf.js";const se={class:"p-2"},re={class:"panel"},ie={class:"panel"},ue={style:{"text-align":"center","margin-left":"-120px","margin-top":"30px"}},me=T({name:"AuthRole"}),Se=T({...me,setup(de){const b=L(),{proxy:f}=P(),_=r(!0),g=r(0),u=r(1),m=r(10),y=r([]),c=r([]),i=r({nickName:void 0,userName:"",userId:void 0}),v=r(),h=t=>{k(t)&&(t.flag=!t.flag,v.value?.toggleRowSelection(t,t.flag))},B=t=>{y.value=t.map(e=>e.roleId)},F=t=>String(t.roleId),k=t=>t.status==="0",w=()=>{const t={fullPath:"",hash:"",matched:[],meta:void 0,name:void 0,params:void 0,query:void 0,redirectedFrom:void 0,path:"/system/user"};f?.$tab.closeOpenPage(t)},$=async()=>{const t=i.value.userId,e=y.value.join(",");await ae({userId:t,roleIds:e}),f?.$modal.msgSuccess("授权成功"),w()},j=async()=>{const t=b.params&&b.params.userId;if(t){_.value=!0;const e=await ne(t);Object.assign(i.value,e.data.user),Object.assign(c.value,e.data.roles),g.value=c.value.length,await X(()=>{c.value.forEach(p=>{p?.flag&&v.value?.toggleRowSelection(p,!0)})}),_.value=!1}};return M(()=>{j()}),(t,e)=>{const p=G,E=D,I=ee,A=Y,U=K,d=te,O=oe,q=le,N=W,z=H;return R(),Z("div",se,[s("div",re,[e[6]||(e[6]=s("h4",{class:"panel-title"},"基本信息",-1)),l(U,{model:o(i),inline:!0},{default:n(()=>[l(A,{gutter:10},{default:n(()=>[l(I,{span:2.5},{default:n(()=>[l(E,{label:"用户昵称",prop:"nickName"},{default:n(()=>[l(p,{modelValue:o(i).nickName,"onUpdate:modelValue":e[0]||(e[0]=a=>o(i).nickName=a),disabled:""},null,8,["modelValue"])]),_:1})]),_:1}),l(I,{span:2.5},{default:n(()=>[l(E,{label:"登录账号",prop:"userName"},{default:n(()=>[l(p,{modelValue:o(i).userName,"onUpdate:modelValue":e[1]||(e[1]=a=>o(i).userName=a),disabled:""},null,8,["modelValue"])]),_:1})]),_:1})]),_:1})]),_:1},8,["model"])]),s("div",ie,[e[10]||(e[10]=s("h4",{class:"panel-title"},"角色信息",-1)),s("div",null,[x((R(),J(O,{ref_key:"tableRef",ref:v,border:"","row-key":F,data:o(c).slice((o(u)-1)*o(m),o(u)*o(m)),onRowClick:h,onSelectionChange:B},{default:n(()=>[l(d,{label:"序号",width:"55",type:"index",align:"center"},{default:n(a=>[s("span",null,C((o(u)-1)*o(m)+a.$index+1),1)]),_:1}),l(d,{type:"selection","reserve-selection":!0,selectable:k,width:"55"}),l(d,{label:"角色编号",align:"center",prop:"roleId"}),l(d,{label:"角色名称",align:"center",prop:"roleName"}),l(d,{label:"权限字符",align:"center",prop:"roleKey"}),l(d,{label:"创建时间",align:"center",prop:"createTime",width:"180"},{default:n(a=>[s("span",null,C(o(f).parseTime(a.row.createTime)),1)]),_:1})]),_:1},8,["data"])),[[z,o(_)]]),x(l(q,{page:o(u),"onUpdate:page":e[2]||(e[2]=a=>S(u)?u.value=a:null),limit:o(m),"onUpdate:limit":e[3]||(e[3]=a=>S(m)?m.value=a:null),total:o(g)},null,8,["page","limit","total"]),[[Q,o(g)>0]]),s("div",ue,[l(N,{type:"primary",onClick:e[4]||(e[4]=a=>$())},{default:n(()=>[...e[7]||(e[7]=[V("提交",-1)])]),_:1}),l(N,{onClick:e[5]||(e[5]=a=>w())},{default:n(()=>[...e[8]||(e[8]=[V("返回",-1)])]),_:1})]),e[9]||(e[9]=s("div",null,null,-1))])])])}}});export{Se as default};
