2023-09-21 17:37:29 +08:00
|
|
|
import{B as He,u as Ge,r as s,D as Je,P as We,d as r,O as ce,o as m,c as L,G as y,H as X,f as o,e as t,w as a,i as fe,Q as Z,R as ee,j as h,F as S,m as i,k as O,x as ve,l as z,s as Xe,N as Q}from"./index.57224d07.js";import{l as Ze,e as el,f as ll,g as ye,h as tl,i as ol,j as al,k as nl}from"./role.1c3b9e7f.js";import{r as ul,t as dl}from"./menu.f5e66723.js";const rl={class:"app-container"},sl={class:"dialog-footer"},il={class:"dialog-footer"},pl=He({name:"Role"}),yl=Object.assign(pl,{setup(ml){const he=Ge(),{proxy:v}=Xe(),{sys_normal_disable:le}=v.useDict("sys_normal_disable"),te=s([]),_=s(!1),Y=s(!0),T=s(!0),j=s([]),oe=s(!0),ae=s(!0),H=s(0),N=s(""),U=s([]),R=s([]),$=s(!1),q=s(!1),M=s(!0),A=s(!1),E=s([]),w=s(!1),g=s(null),k=s(null),_e=s([{value:"1",label:"\u5168\u90E8\u6570\u636E\u6743\u9650"},{value:"2",label:"\u81EA\u5B9A\u6570\u636E\u6743\u9650"},{value:"3",label:"\u672C\u90E8\u95E8\u6570\u636E\u6743\u9650"},{value:"4",label:"\u672C\u90E8\u95E8\u53CA\u4EE5\u4E0B\u6570\u636E\u6743\u9650"},{value:"5",label:"\u4EC5\u672C\u4EBA\u6570\u636E\u6743\u9650"}]),ge=Je({form:{},queryParams:{pageNum:1,pageSize:10,roleName:void 0,roleKey:void 0,status:void 0},rules:{roleName:[{required:!0,message:"\u89D2\u8272\u540D\u79F0\u4E0D\u80FD\u4E3A\u7A7A",trigger:"blur"}],roleKey:[{required:!0,message:"\u6743\u9650\u5B57\u7B26\u4E0D\u80FD\u4E3A\u7A7A",trigger:"blur"}],roleSort:[{required:!0,message:"\u89D2\u8272\u987A\u5E8F\u4E0D\u80FD\u4E3A\u7A7A",trigger:"blur"}]}}),{queryParams:c,form:u,rules:ke}=We(ge);function b(){Y.value=!0,Ze(v.addDateRange(c.value,U.value)).then(n=>{te.value=n.rows,H.value=n.total,Y.value=!1})}function P(){c.value.pageNum=1,b()}function be(){U.value=[],v.resetForm("queryRef"),P()}function ne(n){const e=n.roleId||j.value;v.$modal.confirm('\u662F\u5426\u786E\u8BA4\u5220\u9664\u89D2\u8272\u7F16\u53F7\u4E3A"'+e+'"\u7684\u6570\u636E\u9879?').then(function(){return el(e)}).then(()=>{b(),v.$modal.msgSuccess("\u5220\u9664\u6210\u529F")}).catch(()=>{})}function Ve(){v.download("system/role/export",{...c.value},`role_${new Date().getTime()}.xlsx`)}function Ce(n){j.value=n.map(e=>e.roleId),oe.value=n.length!=1,ae.value=!n.length}function Se(n){let e=n.status==="0"?"\u542F\u7528":"\u505C\u7528";v.$modal.confirm('\u786E\u8BA4\u8981"'+e+'""'+n.roleName+'"\u89D2\u8272\u5417?').then(function(){return ll(n.roleId,n.status)}).then(()=>{v.$modal.msgSuccess(e+"\u6210\u529F")}).catch(function(){n.status=n.status==="0"?"1":"0"})}function we(n){he.push("/system/role-auth/user/"+n.roleId)}function xe(){dl().then(n=>{R.value=n.data})}function Ke(){let n=k.value.getCheckedKeys(),e=k.value.getHalfCheckedKeys();return n.unshift.apply(n,e),n}function I(){g.value!=null&&g.value.setCheckedKeys([]),$.value=!1,q.value=!1,M.value=!0,A.value=!1,u.value={roleId:void 0,roleName:void 0,roleKey:void 0,roleSort:0,status:"0",menuIds:[],deptIds:[],menuCheckStrictly:!0,deptCheckStrictly:!0,remark:void 0},v.resetForm("roleRef")}function Ne(){I(),xe(),_.value=!0,N.value="\u6DFB\u52A0\u89D2\u8272"}function ue(n){I();const e=n.roleId||j.value,p=Ue(e);ye(e).then(d=>{u.value=d.data,u.value.roleSort=Number(u.value.roleSort),_.value=!0,Q(()=>{p.then(B=>{B.checkedKeys.forEach(J=>{Q(()=>{g.value.setChecked(J,!0,!1)})})})}),N.value="\u4FEE\u6539\u89D2\u8272"})}function Ue(n){return ul(n).then(e=>(R.value=e.menus,e))}function Re(n){return nl(n).then(e=>(E.value=e.depts,e))}function de(n,e){if(e=="menu"){let p=R.value;for(let d=0;d<p.length;d++)g.value.store.nodesMap[p[d].id].expanded=n}else if(e=="dept"){let p=E.value;for(let d=0;d<p.length;d++)k.value.store.nodesMap[p[d].id].expanded=n}}function re(n,e){e=="menu"?g.value.setCheckedNodes(n?R.value:[]):e=="dept"&&k.value.setCheckedNodes(n?E.value:[])}function se(n,e){e=="menu"?u.value.menuCheckStrictly=!!n:e=="dept"&&(u.value.deptCheckStrictly=!!n)}function ie(){let n=g.value.getCheckedKeys(),e=g.value.getHalfCheckedKeys();return n.unshift.apply(n,e),n}function Ie(){v.$refs.roleRef.validate(n=>{n&&(u.value.roleId!=null?(u.value.menuIds=ie(),tl(u.value).then(e=>{v.$modal.msgSuccess("\u4FEE\u6539\u6210\u529F"),_.value=!1
|