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