2023-05-09 18:19:28 +08:00
|
|
|
import{_ as He,O as Ge,a as We,r as s,B as Je,W as Xe,d as r,V as ce,o as m,c as z,Q as y,R as X,f as a,e as t,w as o,j as fe,G as Z,H as ee,k as _,P as S,m as i,g as w,l as F,x as ve,s as Ze,U as Q}from"./index.75ecb6e9.js";import{l as el,e as ll,f as tl,g as ye,h as al,i as ol,j as nl,k as ul}from"./role.7eb48a7d.js";import{r as dl,t as rl}from"./menu.a9f8ae9d.js";const sl={class:"app-container"},il={class:"dialog-footer"},pl={class:"dialog-footer"},ml=Ge({name:"Role"}),cl=Object.assign(ml,{setup(fl){const _e=We(),{proxy:v}=Ze(),{sys_normal_disable:le}=v.useDict("sys_normal_disable"),te=s([]),h=s(!1),Y=s(!0),$=s(!0),j=s([]),ae=s(!0),oe=s(!0),H=s(0),N=s(""),R=s([]),I=s([]),q=s(!1),A=s(!1),M=s(!0),E=s(!1),P=s([]),x=s(!1),g=s(null),k=s(null),he=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}=Xe(ge);function b(){Y.value=!0,el(v.addDateRange(c.value,R.value)).then(n=>{te.value=n.rows,H.value=n.total,Y.value=!1})}function B(){c.value.pageNum=1,b()}function be(){R.value=[],v.resetForm("queryRef"),B()}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 ll(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),ae.value=n.length!=1,oe.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 tl(n.roleId,n.status)}).then(()=>{v.$modal.msgSuccess(e+"\u6210\u529F")}).catch(function(){n.status=n.status==="0"?"1":"0"})}function we(n){_e.push("/system/role-auth/user/"+n.roleId)}function xe(){rl().then(n=>{I.value=n.data})}function Ke(){let n=k.value.getCheckedKeys(),e=k.value.getHalfCheckedKeys();return n.unshift.apply(n,e),n}function D(){g.value!=null&&g.value.setCheckedKeys([]),q.value=!1,A.value=!1,M.value=!0,E.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 Ue(){D(),xe(),h.value=!0,N.value="\u6DFB\u52A0\u89D2\u8272"}function ue(n){D();const e=n.roleId||j.value,p=Ne(e);ye(e).then(d=>{u.value=d.data,u.value.roleSort=Number(u.value.roleSort),h.value=!0,Q(()=>{p.then(L=>{L.checkedKeys.forEach(W=>{Q(()=>{g.value.setChecked(W,!0,!1)})})})}),N.value="\u4FEE\u6539\u89D2\u8272"})}function Ne(n){return dl(n).then(e=>(I.value=e.menus,e))}function Re(n){return ul(n).then(e=>(P.value=e.depts,e))}function de(n,e){if(e=="menu"){let p=I.value;for(let d=0;d<p.length;d++)g.value.store.nodesMap[p[d].id].expanded=n}else if(e=="dept"){let p=P.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?I.value:[]):e=="dept"&&k.value.setCheckedNodes(n?P.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(),al(u.value).then(e=>{v.$modal.msgSuccess("\u4FEE\u6539\u6210\u529F"),h.
|