chunk-3b69bc00.27a29322.js 20 KB

1
  1. (window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-3b69bc00"],{3528:function(e,t,n){"use strict";n.d(t,"k",(function(){return a})),n.d(t,"j",(function(){return o})),n.d(t,"a",(function(){return l})),n.d(t,"m",(function(){return s})),n.d(t,"g",(function(){return i})),n.d(t,"f",(function(){return c})),n.d(t,"h",(function(){return u})),n.d(t,"b",(function(){return d})),n.d(t,"l",(function(){return m})),n.d(t,"c",(function(){return p})),n.d(t,"d",(function(){return h})),n.d(t,"e",(function(){return f})),n.d(t,"i",(function(){return y}));var r=n("b775");function a(e){return Object(r["a"])({url:"/system/role/list",method:"get",params:e})}function o(e){return Object(r["a"])({url:"/system/role/"+e,method:"get"})}function l(e){return Object(r["a"])({url:"/system/role",method:"post",data:e})}function s(e){return Object(r["a"])({url:"/system/role",method:"put",data:e})}function i(e){return Object(r["a"])({url:"/system/role/dataScope",method:"put",data:e})}function c(e,t){var n={roleId:e,status:t};return Object(r["a"])({url:"/system/role/changeStatus",method:"put",data:n})}function u(e){return Object(r["a"])({url:"/system/role/"+e,method:"delete"})}function d(e){return Object(r["a"])({url:"/system/role/authUser/allocatedList",method:"get",params:e})}function m(e){return Object(r["a"])({url:"/system/role/authUser/unallocatedList",method:"get",params:e})}function p(e){return Object(r["a"])({url:"/system/role/authUser/cancel",method:"put",data:e})}function h(e){return Object(r["a"])({url:"/system/role/authUser/cancelAll",method:"put",params:e})}function f(e){return Object(r["a"])({url:"/system/role/authUser/selectAll",method:"put",params:e})}function y(e){return Object(r["a"])({url:"/system/role/deptTree/"+e,method:"get"})}},"70eb":function(e,t,n){"use strict";n.r(t);var r=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",{staticClass:"app-container"},[n("el-form",{directives:[{name:"show",rawName:"v-show",value:e.showSearch,expression:"showSearch"}],ref:"queryForm",attrs:{model:e.queryParams,size:"small",inline:!0}},[n("el-form-item",{attrs:{label:"角色名称",prop:"roleName"}},[n("el-input",{staticStyle:{width:"240px"},attrs:{placeholder:"请输入角色名称",clearable:""},nativeOn:{keyup:function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"enter",13,t.key,"Enter")?null:e.handleQuery(t)}},model:{value:e.queryParams.roleName,callback:function(t){e.$set(e.queryParams,"roleName",t)},expression:"queryParams.roleName"}})],1),n("el-form-item",{attrs:{label:"权限字符",prop:"roleKey"}},[n("el-input",{staticStyle:{width:"240px"},attrs:{placeholder:"请输入权限字符",clearable:""},nativeOn:{keyup:function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"enter",13,t.key,"Enter")?null:e.handleQuery(t)}},model:{value:e.queryParams.roleKey,callback:function(t){e.$set(e.queryParams,"roleKey",t)},expression:"queryParams.roleKey"}})],1),n("el-form-item",{attrs:{label:"状态",prop:"status"}},[n("el-select",{staticStyle:{width:"240px"},attrs:{placeholder:"角色状态",clearable:""},model:{value:e.queryParams.status,callback:function(t){e.$set(e.queryParams,"status",t)},expression:"queryParams.status"}},e._l(e.dict.type.sys_normal_disable,(function(e){return n("el-option",{key:e.value,attrs:{label:e.label,value:e.value}})})),1)],1),n("el-form-item",{attrs:{label:"创建时间"}},[n("el-date-picker",{staticStyle:{width:"240px"},attrs:{"value-format":"yyyy-MM-dd",type:"daterange","range-separator":"-","start-placeholder":"开始日期","end-placeholder":"结束日期"},model:{value:e.dateRange,callback:function(t){e.dateRange=t},expression:"dateRange"}})],1),n("el-form-item",[n("el-button",{attrs:{type:"primary",icon:"el-icon-search",size:"mini"},on:{click:e.handleQuery}},[e._v("搜索")]),n("el-button",{attrs:{icon:"el-icon-refresh",size:"mini"},on:{click:e.resetQuery}},[e._v("重置")])],1)],1),n("el-row",{staticClass:"mb8",attrs:{gutter:10}},[n("el-col",{attrs:{span:1.5}},[n("el-button",{directives:[{name:"hasPermi",rawName:"v-hasPermi",value:["system:role:add"],expression:"['system:role:add']"}],attrs:{type:"primary",plain:"",icon:"el-icon-plus",size:"mini"},on:{click:e.handleAdd}},[e._v("新增")])],1),n("el-col",{attrs:{span:1.5}},[n("el-button",{directives:[{name:"hasPermi",rawName:"v-hasPermi",value:["system:role:edit"],expression:"['system:role:edit']"}],attrs:{type:"success",plain:"",icon:"el-icon-edit",size:"mini",disabled:e.single},on:{click:e.handleUpdate}},[e._v("修改")])],1),n("el-col",{attrs:{span:1.5}},[n("el-button",{directives:[{name:"hasPermi",rawName:"v-hasPermi",value:["system:role:remove"],expression:"['system:role:remove']"}],attrs:{type:"danger",plain:"",icon:"el-icon-delete",size:"mini",disabled:e.multiple},on:{click:e.handleDelete}},[e._v("删除")])],1),n("el-col",{attrs:{span:1.5}},[n("el-button",{directives:[{name:"hasPermi",rawName:"v-hasPermi",value:["system:role:export"],expression:"['system:role:export']"}],attrs:{type:"warning",plain:"",icon:"el-icon-download",size:"mini"},on:{click:e.handleExport}},[e._v("导出")])],1),n("right-toolbar",{attrs:{showSearch:e.showSearch},on:{"update:showSearch":function(t){e.showSearch=t},"update:show-search":function(t){e.showSearch=t},queryTable:e.getList}})],1),n("el-table",{directives:[{name:"loading",rawName:"v-loading",value:e.loading,expression:"loading"}],attrs:{data:e.roleList},on:{"selection-change":e.handleSelectionChange}},[n("el-table-column",{attrs:{type:"selection",width:"55",align:"center"}}),n("el-table-column",{attrs:{fixed:"",label:"序号","min-width":"10%",align:"center"},scopedSlots:e._u([{key:"default",fn:function(t){return[n("span",[e._v(e._s((e.queryParams.pageNum-1)*e.queryParams.pageSize+(t.$index+1))+" ")])]}}])}),e._e(),n("el-table-column",{attrs:{label:"角色名称",prop:"roleName","show-overflow-tooltip":!0,width:"150"}}),n("el-table-column",{attrs:{label:"权限字符",prop:"roleKey","show-overflow-tooltip":!0,width:"150"}}),n("el-table-column",{attrs:{label:"显示顺序",prop:"roleSort",width:"100"}}),n("el-table-column",{attrs:{label:"状态",align:"center",width:"100"},scopedSlots:e._u([{key:"default",fn:function(t){return[n("el-switch",{attrs:{"active-value":"0","inactive-value":"1"},on:{change:function(n){return e.handleStatusChange(t.row)}},model:{value:t.row.status,callback:function(n){e.$set(t.row,"status",n)},expression:"scope.row.status"}})]}}])}),n("el-table-column",{attrs:{label:"创建时间",align:"center",prop:"createTime",width:"180"},scopedSlots:e._u([{key:"default",fn:function(t){return[n("span",[e._v(e._s(e.parseTime(t.row.createTime)))])]}}])}),n("el-table-column",{attrs:{label:"操作",align:"center","class-name":"small-padding fixed-width"},scopedSlots:e._u([{key:"default",fn:function(t){return 0==t.row.adminRole?[n("el-button",{directives:[{name:"hasPermi",rawName:"v-hasPermi",value:["system:role:edit"],expression:"['system:role:edit']"}],attrs:{size:"mini",type:"text",icon:"el-icon-edit"},on:{click:function(n){return e.handleUpdate(t.row)}}},[e._v("修改")]),n("el-button",{directives:[{name:"hasPermi",rawName:"v-hasPermi",value:["system:role:remove"],expression:"['system:role:remove']"}],attrs:{size:"mini",type:"text",icon:"el-icon-delete"},on:{click:function(n){return e.handleDelete(t.row)}}},[e._v("删除")]),n("el-dropdown",{directives:[{name:"hasPermi",rawName:"v-hasPermi",value:["system:role:edit"],expression:"['system:role:edit']"}],attrs:{size:"mini"},on:{command:function(n){return e.handleCommand(n,t.row)}}},[n("el-button",{attrs:{size:"mini",type:"text",icon:"el-icon-d-arrow-right"}},[e._v("更多")]),n("el-dropdown-menu",{attrs:{slot:"dropdown"},slot:"dropdown"},[n("el-dropdown-item",{directives:[{name:"hasPermi",rawName:"v-hasPermi",value:["system:role:edit"],expression:"['system:role:edit']"}],attrs:{command:"handleDataScope",icon:"el-icon-circle-check"}},[e._v("数据权限")]),n("el-dropdown-item",{directives:[{name:"hasPermi",rawName:"v-hasPermi",value:["system:role:edit"],expression:"['system:role:edit']"}],attrs:{command:"handleAuthUser",icon:"el-icon-user"}},[e._v("分配用户")])],1)],1)]:void 0}}],null,!0)})],1),n("pagination",{directives:[{name:"show",rawName:"v-show",value:e.total>0,expression:"total>0"}],attrs:{total:e.total,page:e.queryParams.pageNum,limit:e.queryParams.pageSize},on:{"update:page":function(t){return e.$set(e.queryParams,"pageNum",t)},"update:limit":function(t){return e.$set(e.queryParams,"pageSize",t)},pagination:e.getList}}),n("el-dialog",{attrs:{title:e.title,visible:e.open,width:"500px","append-to-body":""},on:{"update:visible":function(t){e.open=t}}},[n("el-form",{ref:"form",attrs:{model:e.form,rules:e.rules,"label-width":"100px"}},[n("el-form-item",{attrs:{label:"角色名称",prop:"roleName"}},[n("el-input",{attrs:{placeholder:"请输入角色名称"},model:{value:e.form.roleName,callback:function(t){e.$set(e.form,"roleName",t)},expression:"form.roleName"}})],1),n("el-form-item",{attrs:{prop:"roleKey"}},[n("span",{attrs:{slot:"label"},slot:"label"},[n("el-tooltip",{attrs:{content:"Cloud版本为自定义权限控制器 此处默认admin",placement:"top"}},[n("i",{staticClass:"el-icon-question"})]),e._v(" 权限字符 ")],1),n("el-input",{attrs:{placeholder:"请输入权限字符"},model:{value:e.form.roleKey,callback:function(t){e.$set(e.form,"roleKey",t)},expression:"form.roleKey"}})],1),n("el-form-item",{attrs:{label:"角色顺序",prop:"roleSort"}},[n("el-input-number",{attrs:{"controls-position":"right",min:0},model:{value:e.form.roleSort,callback:function(t){e.$set(e.form,"roleSort",t)},expression:"form.roleSort"}})],1),n("el-form-item",{attrs:{label:"状态"}},[n("el-radio-group",{model:{value:e.form.status,callback:function(t){e.$set(e.form,"status",t)},expression:"form.status"}},e._l(e.dict.type.sys_normal_disable,(function(t){return n("el-radio",{key:t.value,attrs:{label:t.value}},[e._v(e._s(t.label))])})),1)],1),n("el-form-item",{attrs:{label:"菜单权限"}},[n("el-checkbox",{on:{change:function(t){return e.handleCheckedTreeExpand(t,"menu")}},model:{value:e.menuExpand,callback:function(t){e.menuExpand=t},expression:"menuExpand"}},[e._v("展开/折叠")]),n("el-checkbox",{on:{change:function(t){return e.handleCheckedTreeNodeAll(t,"menu")}},model:{value:e.menuNodeAll,callback:function(t){e.menuNodeAll=t},expression:"menuNodeAll"}},[e._v("全选/全不选")]),n("el-checkbox",{on:{change:function(t){return e.handleCheckedTreeConnect(t,"menu")}},model:{value:e.form.menuCheckStrictly,callback:function(t){e.$set(e.form,"menuCheckStrictly",t)},expression:"form.menuCheckStrictly"}},[e._v("父子联动")]),n("el-tree",{ref:"menu",staticClass:"tree-border",attrs:{data:e.menuOptions,"show-checkbox":"","node-key":"id","check-strictly":!e.form.menuCheckStrictly,"empty-text":"加载中,请稍候",props:e.defaultProps}})],1),n("el-form-item",{attrs:{label:"备注"}},[n("el-input",{attrs:{type:"textarea",placeholder:"请输入内容"},model:{value:e.form.remark,callback:function(t){e.$set(e.form,"remark",t)},expression:"form.remark"}})],1)],1),n("div",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[n("el-button",{attrs:{type:"primary"},on:{click:e.submitForm}},[e._v("确 定")]),n("el-button",{on:{click:e.cancel}},[e._v("取 消")])],1)],1),n("el-dialog",{attrs:{title:e.title,visible:e.openDataScope,width:"500px","append-to-body":""},on:{"update:visible":function(t){e.openDataScope=t}}},[n("el-form",{attrs:{model:e.form,"label-width":"80px"}},[n("el-form-item",{attrs:{label:"角色名称"}},[n("el-input",{attrs:{disabled:!0},model:{value:e.form.roleName,callback:function(t){e.$set(e.form,"roleName",t)},expression:"form.roleName"}})],1),n("el-form-item",{attrs:{label:"权限字符"}},[n("el-input",{attrs:{disabled:!0},model:{value:e.form.roleKey,callback:function(t){e.$set(e.form,"roleKey",t)},expression:"form.roleKey"}})],1),n("el-form-item",{attrs:{label:"权限范围"}},[n("el-select",{on:{change:e.dataScopeSelectChange},model:{value:e.form.dataScope,callback:function(t){e.$set(e.form,"dataScope",t)},expression:"form.dataScope"}},e._l(e.dataScopeOptions,(function(e){return n("el-option",{key:e.value,attrs:{label:e.label,value:e.value}})})),1)],1),n("el-form-item",{directives:[{name:"show",rawName:"v-show",value:2==e.form.dataScope,expression:"form.dataScope == 2"}],attrs:{label:"数据权限"}},[n("el-checkbox",{on:{change:function(t){return e.handleCheckedTreeExpand(t,"dept")}},model:{value:e.deptExpand,callback:function(t){e.deptExpand=t},expression:"deptExpand"}},[e._v("展开/折叠")]),n("el-checkbox",{on:{change:function(t){return e.handleCheckedTreeNodeAll(t,"dept")}},model:{value:e.deptNodeAll,callback:function(t){e.deptNodeAll=t},expression:"deptNodeAll"}},[e._v("全选/全不选")]),n("el-checkbox",{on:{change:function(t){return e.handleCheckedTreeConnect(t,"dept")}},model:{value:e.form.deptCheckStrictly,callback:function(t){e.$set(e.form,"deptCheckStrictly",t)},expression:"form.deptCheckStrictly"}},[e._v("父子联动")]),n("el-tree",{ref:"dept",staticClass:"tree-border",attrs:{data:e.deptOptions,"show-checkbox":"","default-expand-all":"","node-key":"id","check-strictly":!e.form.deptCheckStrictly,"empty-text":"加载中,请稍候",props:e.defaultProps}})],1)],1),n("div",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[n("el-button",{attrs:{type:"primary"},on:{click:e.submitDataScope}},[e._v("确 定")]),n("el-button",{on:{click:e.cancelDataScope}},[e._v("取 消")])],1)],1)],1)},a=[],o=n("5530"),l=(n("d81d"),n("d3b7"),n("159b"),n("3528")),s=n("a6dc"),i=n("2da1"),c={name:"Role",dicts:["sys_normal_disable"],data:function(){return{loading:!0,ids:[],single:!0,multiple:!0,showSearch:!0,total:0,roleList:[],title:"",open:!1,openDataScope:!1,menuExpand:!1,menuNodeAll:!1,deptExpand:!0,deptNodeAll:!1,dateRange:[],dataScopeOptions:[{value:"1",label:"全部数据权限"},{value:"2",label:"自定数据权限"},{value:"3",label:"本部门数据权限"},{value:"4",label:"本部门及以下数据权限"},{value:"5",label:"仅本人数据权限"}],menuOptions:[],deptOptions:[],queryParams:{pageNum:1,pageSize:10,roleName:void 0,roleKey:void 0,status:void 0},form:{},defaultProps:{children:"children",label:"label"},rules:{roleName:[{required:!0,message:"角色名称不能为空",trigger:"blur"}],roleKey:[{required:!0,message:"权限字符不能为空",trigger:"blur"}],roleSort:[{required:!0,message:"角色顺序不能为空",trigger:"blur"}]}}},created:function(){this.getList()},methods:{getList:function(){var e=this;this.loading=!0,Object(l["k"])(this.addDateRange(this.queryParams,this.dateRange)).then((function(t){e.roleList=t.data,e.total=t.total,e.loading=!1}))},getMenuTreeselect:function(){var e=this;Object(s["g"])().then((function(t){e.menuOptions=t.data}))},getMenuAllCheckedKeys:function(){var e=this.$refs.menu.getCheckedKeys(),t=this.$refs.menu.getHalfCheckedKeys();return e.unshift.apply(e,t),e},getDeptAllCheckedKeys:function(){var e=this.$refs.dept.getCheckedKeys(),t=this.$refs.dept.getHalfCheckedKeys();return e.unshift.apply(e,t),e},getRoleMenuTreeselect:function(e){var t=this;return Object(s["f"])(e).then((function(e){return t.menuOptions=e.menus,e}))},getDeptTree:function(e){var t=this;return Object(l["i"])(e).then((function(e){return t.deptOptions=e.depts,e}))},handleStatusChange:function(e){var t=this,n="0"===e.status?"启用":"停用";this.$modal.confirm('确认要"'+n+'""'+e.roleName+'"角色吗?').then((function(){return Object(l["f"])(e.roleId,e.status)})).then((function(){t.$modal.msgSuccess(n+"成功")})).catch((function(){e.status="0"===e.status?"1":"0"}))},cancel:function(){this.open=!1,this.reset()},cancelDataScope:function(){this.openDataScope=!1,this.reset()},reset:function(){void 0!=this.$refs.menu&&this.$refs.menu.setCheckedKeys([]),this.menuExpand=!1,this.menuNodeAll=!1,this.deptExpand=!0,this.deptNodeAll=!1,this.form={roleId:void 0,roleName:void 0,roleKey:void 0,roleSort:0,status:"0",menuIds:[],deptIds:[],menuCheckStrictly:!0,deptCheckStrictly:!0,remark:void 0},this.resetForm("form")},handleQuery:function(){this.queryParams.pageNum=1,this.getList()},resetQuery:function(){this.dateRange=[],this.resetForm("queryForm"),this.handleQuery()},handleSelectionChange:function(e){this.ids=e.map((function(e){return e.roleId})),this.single=1!=e.length,this.multiple=!e.length},handleCommand:function(e,t){switch(e){case"handleDataScope":this.handleDataScope(t);break;case"handleAuthUser":this.handleAuthUser(t);break;default:break}},handleCheckedTreeExpand:function(e,t){if("menu"==t)for(var n=this.menuOptions,r=0;r<n.length;r++)this.$refs.menu.store.nodesMap[n[r].id].expanded=e;else if("dept"==t)for(var a=this.deptOptions,o=0;o<a.length;o++)this.$refs.dept.store.nodesMap[a[o].id].expanded=e},handleCheckedTreeNodeAll:function(e,t){"menu"==t?this.$refs.menu.setCheckedNodes(e?this.menuOptions:[]):"dept"==t&&this.$refs.dept.setCheckedNodes(e?this.deptOptions:[])},handleCheckedTreeConnect:function(e,t){"menu"==t?this.form.menuCheckStrictly=!!e:"dept"==t&&(this.form.deptCheckStrictly=!!e)},handleAdd:function(){this.reset(),this.getMenuTreeselect(),this.open=!0,this.title="添加角色"},handleUpdate:function(e){var t=this;this.reset();var n=e.roleId||this.ids,r=this.getRoleMenuTreeselect(n);Object(l["j"])(n).then((function(e){t.form=e.data,t.open=!0,t.$nextTick((function(){r.then((function(e){var n=e.checkedKeys;n.forEach((function(e){t.$nextTick((function(){t.$refs.menu.setChecked(e,!0,!1)}))}))}))})),t.title="修改角色"}))},dataScopeSelectChange:function(e){"2"!==e&&this.$refs.dept.setCheckedKeys([])},handleDataScope:function(e){var t=this;this.reset();var n=this.getDeptTree(e.roleId);Object(l["j"])(e.roleId).then((function(e){t.form=e.data,t.openDataScope=!0,t.$nextTick((function(){n.then((function(e){t.$refs.dept.setCheckedKeys(e.checkedKeys)}))})),t.title="分配数据权限"}))},handleAuthUser:function(e){var t=e.roleId;this.$router.push("/system/role-auth/user/"+t)},submitForm:function(){var e=this;this.$refs["form"].validate((function(t){t&&(void 0!=e.form.roleId?(e.form.menuIds=e.getMenuAllCheckedKeys(),Object(l["m"])(e.form).then((function(t){e.$modal.msgSuccess("修改成功"),e.open=!1,e.getList()}))):(e.form.menuIds=e.getMenuAllCheckedKeys(),Object(l["a"])(e.form).then((function(t){e.$modal.msgSuccess("新增成功"),e.open=!1,e.getList()}))))}))},submitDataScope:function(){var e=this;void 0!=this.form.roleId&&(this.form.deptIds=this.getDeptAllCheckedKeys(),Object(l["g"])(this.form).then((function(t){e.$modal.msgSuccess("修改成功"),e.openDataScope=!1,e.getList()})))},handleDelete:function(e){var t=this,n=e.roleId||this.ids;this.$modal.confirm("是否确认删除当前角色数据项?").then((function(){return Object(l["h"])(n)})).then((function(){t.getList(),t.$modal.msgSuccess("删除成功")})).catch((function(){}))},handleExport:function(){this.download("system/role/export",Object(o["a"])({},this.queryParams),"角色管理_".concat(Object(i["f"])((new Date).getTime(),"{y}-{m}-{d}"),".xlsx"))}}},u=c,d=n("2877"),m=Object(d["a"])(u,r,a,!1,null,null,null);t["default"]=m.exports},a6dc:function(e,t,n){"use strict";n.d(t,"d",(function(){return a})),n.d(t,"e",(function(){return o})),n.d(t,"c",(function(){return l})),n.d(t,"g",(function(){return s})),n.d(t,"f",(function(){return i})),n.d(t,"a",(function(){return c})),n.d(t,"h",(function(){return u})),n.d(t,"b",(function(){return d}));var r=n("b775");function a(e){return Object(r["a"])({url:"/system/menu/list",method:"get",params:e})}function o(){return Object(r["a"])({url:"/system/menu/list-all-simple",method:"get"})}function l(e){return Object(r["a"])({url:"/system/menu/"+e,method:"get"})}function s(){return Object(r["a"])({url:"/system/menu/treeselect",method:"get"})}function i(e){return Object(r["a"])({url:"/system/menu/roleMenuTreeselect/"+e,method:"get"})}function c(e){return Object(r["a"])({url:"/system/menu",method:"post",data:e})}function u(e){return Object(r["a"])({url:"/system/menu",method:"put",data:e})}function d(e){return Object(r["a"])({url:"/system/menu/"+e,method:"delete"})}}}]);