Agriculture-front-end/dist/assets/index.f5e0885e.js

2 lines
14 KiB
JavaScript
Raw Normal View History

import{G as e,u as l,r as a,I as t,U as o,d as u,T as d,o as n,c as r,K as s,M as i,f as c,e as m,w as p,j as f,V as h,W as v,k as y,J as b,n as k,l as g,A as V,m as _,v as C,S as w}from"./index.e5c8b0d6.js";import{l as S,e as U,f as x,g as K,h as I,i as N,j as R,k as $}from"./role.f62b5a30.js";import{r as q,t as D}from"./menu.a3f2b703.js";const j={class:"app-container"},P={class:"dialog-footer"},T={class:"dialog-footer"},M=e({name:"Role"}),z=Object.assign(M,{setup(e){const M=l(),{proxy:z}=C(),{sys_normal_disable:Y}=z.useDict("sys_normal_disable"),E=a([]),A=a(!1),F=a(!0),H=a(!0),G=a([]),J=a(!0),O=a(!0),Q=a(0),W=a(""),B=a([]),L=a([]),X=a(!1),Z=a(!1),ee=a(!0),le=a(!1),ae=a([]),te=a(!1),oe=a(null),ue=a(null),de=a([{value:"1",label:"全部数据权限"},{value:"2",label:"自定数据权限"},{value:"3",label:"本部门数据权限"},{value:"4",label:"本部门及以下数据权限"},{value:"5",label:"仅本人数据权限"}]),ne=t({form:{},queryParams:{pageNum:1,pageSize:10,roleName:void 0,roleKey:void 0,status:void 0},rules:{roleName:[{required:!0,message:"角色名称不能为空",trigger:"blur"}],roleKey:[{required:!0,message:"权限字符不能为空",trigger:"blur"}],roleSort:[{required:!0,message:"角色顺序不能为空",trigger:"blur"}]}}),{queryParams:re,form:se,rules:ie}=o(ne);function ce(){F.value=!0,S(z.addDateRange(re.value,B.value)).then((e=>{E.value=e.rows,Q.value=e.total,F.value=!1}))}function me(){re.value.pageNum=1,ce()}function pe(){B.value=[],z.resetForm("queryRef"),me()}function fe(e){const l=e.roleId||G.value;z.$modal.confirm('是否确认删除角色编号为"'+l+'"的数据项?').then((function(){return U(l)})).then((()=>{ce(),z.$modal.msgSuccess("删除成功")})).catch((()=>{}))}function he(){z.download("system/role/export",{...re.value},`role_${(new Date).getTime()}.xlsx`)}function ve(e){G.value=e.map((e=>e.roleId)),J.value=1!=e.length,O.value=!e.length}function ye(){null!=oe.value&&oe.value.setCheckedKeys([]),X.value=!1,Z.value=!1,ee.value=!0,le.value=!1,se.value={roleId:void 0,roleName:void 0,roleKey:void 0,roleSort:0,status:"0",menuIds:[],deptIds:[],menuCheckStrictly:!0,deptCheckStrictly:!0,remark:void 0},z.resetForm("roleRef")}function be(){ye(),D().then((e=>{L.value=e.data})),A.value=!0,W.value="添加角色"}function ke(e){ye();const l=e.roleId||G.value,a=function(e){return q(e).then((e=>(L.value=e.menus,e)))}(l);K(l).then((e=>{se.value=e.data,se.value.roleSort=Number(se.value.roleSort),A.value=!0,w((()=>{a.then((e=>{e.checkedKeys.forEach((e=>{w((()=>{oe.value.setChecked(e,!0,!1)}))}))}))})),W.value="修改角色"}))}function ge(e,l){if("menu"==l){let l=L.value;for(let a=0;a<l.length;a++)oe.value.store.nodesMap[l[a].id].expanded=e}else if("dept"==l){let l=ae.value;for(let a=0;a<l.length;a++)ue.value.store.nodesMap[l[a].id].expanded=e}}function Ve(e,l){"menu"==l?oe.value.setCheckedNodes(e?L.value:[]):"dept"==l&&ue.value.setCheckedNodes(e?ae.value:[])}function _e(e,l){"menu"==l?se.value.menuCheckStrictly=!!e:"dept"==l&&(se.value.deptCheckStrictly=!!e)}function Ce(){let e=oe.value.getCheckedKeys(),l=oe.value.getHalfCheckedKeys();return e.unshift.apply(e,l),e}function we(){z.$refs.roleRef.validate((e=>{e&&(null!=se.value.roleId?(se.value.menuIds=Ce(),I(se.value).then((e=>{z.$modal.msgSuccess("修改成功"),A.value=!1,ce()}))):(se.value.menuIds=Ce(),N(se.value).then((e=>{z.$modal.msgSuccess("新增成功"),A.value=!1,ce()}))))}))}function Se(){A.value=!1,ye()}function Ue(e){"2"!==e&&ue.value.setCheckedKeys([])}function xe(e){ye();const l=(a=e.roleId,$(a).then((e=>(ae.value=e.depts,e))));var a;K(e.roleId).then((e=>{se.value=e.data,te.value=!0,w((()=>{l.then((e=>{w((()=>{ue.value&&ue.value.setCheckedKeys(e.checkedKeys)}))}))})),W.value="分配数据权限"}))}function Ke(){null!=se.value.roleId&&(se.value.deptIds=function(){let e=ue.value.getCheckedKeys(),l=ue.value.getHalfCheckedKeys();return e.unshift.apply(e,l),e}(),R(se.value).then((e=>{z.$modal.msgSuccess("修改成功"),te.value=!1,ce()})))}function Ie(){te.value=!1,ye()}return ce(),(e,l)=>{const a=u("el-input"),t=u("el-form-item"),o=u("el-