(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-e1f3c9fe"],{3528:function(e,t,s){"use strict";s.d(t,"l",(function(){return n})),s.d(t,"k",(function(){return r})),s.d(t,"a",(function(){return o})),s.d(t,"m",(function(){return i})),s.d(t,"f",(function(){return l})),s.d(t,"c",(function(){return c})),s.d(t,"g",(function(){return u})),s.d(t,"i",(function(){return d})),s.d(t,"e",(function(){return h})),s.d(t,"d",(function(){return m})),s.d(t,"j",(function(){return f})),s.d(t,"b",(function(){return p})),s.d(t,"h",(function(){return b}));var a=s("b775");function n(e){return Object(a["b"])({url:"/system/role/list",method:"get",params:e})}function r(e){return Object(a["b"])({url:"/system/role/"+e,method:"get"})}function o(e){return Object(a["b"])({url:"/system/role",method:"post",data:e})}function i(e){return Object(a["b"])({url:"/system/role/edit",method:"post",data:e})}function l(e){return Object(a["b"])({url:"/system/role/dataScope/edit",method:"post",data:e})}function c(e,t){var s={id:e,status:t};return Object(a["b"])({url:"/system/role/changeStatus/edit",method:"post",data:s})}function u(e){return Object(a["b"])({url:"/system/role/"+e,method:"post"})}function d(e){return Object(a["b"])({url:"/system/role/export",method:"get",params:e})}function h(e){return Object(a["b"])({url:"/system/role/checkRoleNameUnique",method:"get",params:e})}function m(e){return Object(a["b"])({url:"/system/role/checkRoleKeyUnique",method:"get",params:e})}function f(){return Object(a["b"])({url:"/system/role/findMaxSort",method:"get"})}function p(e){return Object(a["b"])({url:"/system/role/batchSave",method:"post",data:e})}function b(e,t){return Object(a["b"])({url:"/system/role/deleteRoleUser/"+e+"/"+t,method:"post"})}},"43aa":function(e,t,s){"use strict";s("cd8a")},c58c:function(e,t,s){"use strict";s.r(t);s("99af"),s("4e82");var a=function(){var e=this,t=e._self._c;return t("div",[t("a-row",{attrs:{type:"flex",gutter:10}},[t("a-col",{attrs:{span:12}},[t("a-card",{staticStyle:{"min-height":"calc(100vh - 125px)"},attrs:{bordered:!1}},[t("advance-table",{attrs:{columns:e.columns,"data-source":e.list,title:"角色管理",loading:e.loading,rowKey:"id",size:"middle",tableKey:"system-role-SysRoleIndex-table",customRow:e.onClickRow,"format-conditions":!0,"row-selection":{selectedRowKeys:e.selectedRowKeys,onChange:e.onSelectChange},pagination:{current:e.queryParam.pageNum,pageSize:e.queryParam.pageSize,total:e.total,showSizeChanger:!0,showLessItems:!0,showQuickJumper:!0,showTotal:function(e,t){return"第 ".concat(t[0],"-").concat(t[1]," 条，总计 ").concat(e," 条")},onChange:e.changeSize,onShowSizeChange:e.onShowSizeChange}},on:{refresh:e.getList},scopedSlots:e._u([{key:"status",fn:function(s){s.text;var a=s.record;return t("span",{},[t("a-tooltip",{attrs:{placement:"top"}},[t("template",{slot:"title"},[t("span",[e._v("点击修改状态")])]),t("a-popconfirm",{attrs:{"ok-text":"是","cancel-text":"否"},on:{confirm:function(t){return e.confirmHandleStatus(a)}}},[t("span",{attrs:{slot:"title"},slot:"title"},[e._v("确认"),t("b",[e._v(e._s("1"===a.status?"启用":"停用"))]),e._v("【"+e._s(a.roleName)+"】的角色吗?")]),t("a-badge",{attrs:{status:"0"===a.status?"processing":"error",text:e.statusFormat(a)}})],1)],2)],1)}},{key:"roleNameSolt",fn:function(s){var a=s.text,n=s.record;return t("span",{},[n.editable?e._e():t("a-tag",{attrs:{color:"blue"}},[e._v(" "+e._s(a)+" ")]),n.editable?t("a-input",{attrs:{placeholder:"请输入"},model:{value:n.roleName,callback:function(t){e.$set(n,"roleName",t)},expression:"record.roleName"}}):e._e()],1)}},{key:"roleKey",fn:function(s){var a=s.text,n=s.record;return t("span",{},[n.editable&&"admin"!==n.roleKey?e._e():t("a-tag",{attrs:{color:"blue"}},[e._v(" "+e._s(a)+" ")]),n.editable&&"admin"!==n.roleKey?t("a-input",{attrs:{placeholder:"请输入"},model:{value:n.roleKey,callback:function(t){e.$set(n,"roleKey",t)},expression:"record.roleKey"}}):e._e()],1)}},{key:"sort",fn:function(s){var a=s.text,n=s.record;return t("span",{},[n.editable?e._e():t("span",[e._v(" "+e._s(a)+" ")]),n.editable?t("a-input-number",{staticStyle:{width:"100%"},attrs:{placeholder:"请输入",min:0},model:{value:n.sort,callback:function(t){e.$set(n,"sort",t)},expression:"record.sort"}}):e._e()],1)}},{key:"operation",fn:function(s){s.text;var a=s.record;return t("span",{},[a.editable?t("div",[t("a",{on:{click:function(t){return t.stopPropagation(),e.cancelEditCell(a)}}},[e._v(" 取消 ")]),t("a-divider",{attrs:{type:"vertical"}}),t("a",{on:{click:function(t){return e.handleDelete(a)}}},[e._v("删除")])],1):t("div",[t("a",{directives:[{name:"hasPermi",rawName:"v-hasPermi",value:["system:role:edit"],expression:"['system:role:edit']"}],on:{click:function(t){return t.stopPropagation(),e.updateRow(a)}}},[e._v(" 修改 ")]),t("a-divider",{directives:[{name:"hasPermi",rawName:"v-hasPermi",value:["system:role:remove"],expression:"['system:role:remove']"}],attrs:{type:"vertical"}}),t("a",{directives:[{name:"hasPermi",rawName:"v-hasPermi",value:["system:role:remove"],expression:"['system:role:remove']"}],on:{click:function(t){return t.stopPropagation(),e.handleDelete(a)}}},[e._v(" 删除 ")])],1)])}}])},[t("div",{staticClass:"table-operations",attrs:{slot:"button"},slot:"button"},[t("a-input-search",{staticStyle:{width:"150px"},attrs:{placeholder:"请输入编码或名称"},on:{search:e.handleQuery},model:{value:e.queryParam.codeOrName,callback:function(t){e.$set(e.queryParam,"codeOrName",t)},expression:"queryParam.codeOrName"}}),t("a-button",{directives:[{name:"hasPermi",rawName:"v-hasPermi",value:["system:role:add"],expression:"['system:role:add']"}],attrs:{type:"primary",size:"small"},on:{click:function(t){return e.addRow()}}},[t("a-icon",{attrs:{type:"plus"}}),e._v("新增 ")],1),t("a-button",{directives:[{name:"hasPermi",rawName:"v-hasPermi",value:["system:role:add"],expression:"['system:role:add']"}],attrs:{type:"",size:"small"},on:{click:function(t){return e.batchSaveRole()}}},[t("a-icon",{attrs:{type:"save"}}),e._v("保存 ")],1),e.multiple?e._e():t("a-button",{directives:[{name:"hasPermi",rawName:"v-hasPermi",value:["system:role:remove"],expression:"['system:role:remove']"}],attrs:{type:"danger"},on:{click:e.handleDelete}},[t("a-icon",{attrs:{type:"delete"}}),e._v("删除 ")],1),t("a-button",{directives:[{name:"hasPermi",rawName:"v-hasPermi",value:["system:role:export"],expression:"['system:role:export']"}],attrs:{type:""},on:{click:e.handleExport}},[t("a-icon",{attrs:{type:"download"}}),e._v("导出 ")],1)],1)])],1)],1),t("a-col",{attrs:{span:12}},[t("a-card",{staticStyle:{"min-height":"calc(100vh - 125px)"},attrs:{bordered:!1}},[t("select-user",{directives:[{name:"show",rawName:"v-show",value:!1,expression:"false"}],ref:"selectUserRef",attrs:{selectModel:"multi"},model:{value:e.selectedUser,callback:function(t){e.selectedUser=t},expression:"selectedUser"}}),t("advance-table",{attrs:{columns:e.roleUserColumns,"data-source":e.subList,title:"角色用户",loading:e.subLoading,rowKey:"id",size:"middle",tableKey:"system-roleuser-SysRoleIndex-table","format-conditions":!0,"row-selection":{selectedRowKeys:e.selectedSubRowKeys,onChange:e.onSelectSubChange},pagination:{current:e.querySubParam.pageNum,pageSize:e.querySubParam.pageSize,total:e.subTotal,showSizeChanger:!0,showLessItems:!0,showQuickJumper:!0,showTotal:function(e,t){return"第 ".concat(t[0],"-").concat(t[1]," 条，总计 ").concat(e," 条")},onChange:e.changeSubSize,onShowSizeChange:e.onShowSizeSubChange}},on:{refresh:e.getRoleUserList},scopedSlots:e._u([{key:"status",fn:function(s){var a=s.record;return t("span",{},[t("a-badge",{attrs:{status:"processing",text:e.statusFormat(a)}})],1)}},{key:"roleKey",fn:function(s){var a=s.text;return t("span",{},[t("a-tag",{attrs:{color:"blue"}},[e._v(" "+e._s(a)+" ")])],1)}},{key:"operation",fn:function(s){s.text;var a=s.record;return t("span",{},[t("a",{directives:[{name:"hasPermi",rawName:"v-hasPermi",value:["system:role:remove"],expression:"['system:role:remove']"}],on:{click:function(t){return t.stopPropagation(),e.handleDeleteSub(a)}}},[e._v(" 删除 ")])])}}])},[t("div",{staticClass:"table-operations",attrs:{slot:"button"},slot:"button"},[t("a-input-search",{staticStyle:{width:"150px"},attrs:{placeholder:"请输入编码或名称"},on:{search:e.handleQueryRoleUser},model:{value:e.querySubParam.userNameOrName,callback:function(t){e.$set(e.querySubParam,"userNameOrName",t)},expression:"querySubParam.userNameOrName"}}),e.currentSelectRoleId.indexOf("newRow-")<0?t("a-button",{directives:[{name:"hasPermi",rawName:"v-hasPermi",value:["system:role:add"],expression:"['system:role:add']"}],attrs:{type:"primary",size:"small"},on:{click:function(t){return e.handleAddUser()}}},[t("a-icon",{attrs:{type:"plus"}}),e._v("添加用户 ")],1):e._e(),e.subMultiple?e._e():t("a-button",{directives:[{name:"hasPermi",rawName:"v-hasPermi",value:["system:role:remove"],expression:"['system:role:remove']"}],attrs:{type:"danger"},on:{click:e.handleDeleteSub}},[t("a-icon",{attrs:{type:"delete"}}),e._v("删除 ")],1)],1)])],1)],1)],1)],1)},n=[],r=s("2909"),o=(s("4de4"),s("7db0"),s("caad"),s("d81d"),s("d3b7"),s("2532"),s("159b"),s("3528")),i=s("c0c7"),l=s("5d9e"),c=s("0078"),u=s("ca00"),d={name:"Role",components:{AdvanceTable:l["a"],SelectUser:c["a"]},data:function(){return{list:[],cacheData:[],deleteData:[],subList:[],selectedRowKeys:[],selectedSubRowKeys:[],selectedRows:[],selectedSubRows:[],selectedUser:"",advanced:!1,single:!0,multiple:!0,subMultiple:!0,currentSelectRoleId:"",selectItem:{},ids:[],roleKeys:[],subIds:[],loading:!1,subLoading:!1,total:0,subTotal:0,statusOptions:[],dateRange:[],labelCol:{span:6},wrapperCol:{span:18},queryParam:{pageNum:1,pageSize:10,roleName:void 0,roleKey:void 0,status:void 0},querySubParam:{pageNum:1,pageSize:10},addModalRefName:"addModal",columns:[{title:"角色名称",dataIndex:"roleName",ellipsis:!0,scopedSlots:{customRender:"roleNameSolt"}},{title:"角色编码",dataIndex:"roleKey",width:"150px",ellipsis:!0,scopedSlots:{customRender:"roleKey"}},{title:"排序号",dataIndex:"sort",align:"center",scopedSlots:{customRender:"sort"}},{title:"状态",dataIndex:"status",scopedSlots:{customRender:"status"},align:"center"},{title:"操作",dataIndex:"operation",width:"100px",scopedSlots:{customRender:"operation"}}],roleUserColumns:[{title:"用户名称",dataIndex:"name",ellipsis:!0},{title:"登录名",dataIndex:"userName",ellipsis:!0},{title:"状态",dataIndex:"status",scopedSlots:{customRender:"status"},align:"center"},{title:"操作",dataIndex:"operation",width:"100px",scopedSlots:{customRender:"operation"}}]}},filters:{},created:function(){var e=this;this.getList(),this.getDicts("sys_normal_disable").then((function(t){e.statusOptions=t.data}))},computed:{},watch:{selectedUser:function(e){var t=this,s={userId:e.ids,roleId:this.currentSelectRoleId};Object(i["o"])(s).then((function(e){t.$message.success("添加成功",3),t.getRoleUserList()}))},selectItem:function(e){this.renderRowStyle(e),this.getRoleUserList(e.id)}},methods:{statusFormat:function(e){return this.selectDictLabel(this.statusOptions,e.status)},getList:function(){var e=this;this.showAddModal=!1,this.showEditModal=!1,this.showDataScopeModal=!1,this.loading=!0,Object(o["l"])(this.addDateRange(this.queryParam,this.dateRange)).then((function(t){e.list=t.data.list,e.list.map((function(e){e.operation=e.remark})),e.total=t.data.total,e.loading=!1,e.list.length>0&&e.$nextTick((function(){return e.selectItem=e.list[0]}))}))},getRoleUserList:function(e){var t=this;"string"===typeof e?null===e||""===e||void 0===e?e=this.currentSelectRoleId:this.currentSelectRoleId=e:e=this.currentSelectRoleId,e.indexOf("newRow-")<0?(this.subLoading=!0,this.querySubParam.roleId=e,Object(i["g"])(this.addDateRange(this.querySubParam,this.dateRange)).then((function(e){t.subList=e.data.list,t.subList.map((function(e){e.operation=e.remark})),t.subTotal=e.data.total,t.subLoading=!1}))):(this.subList=[],this.subTotal=0),this.subIds=[],this.selectedSubRowKeys=[],this.subMultiple=!0},onClickRow:function(e,t){var s=this;return{on:{click:function(t){void 0!==t.target&&"td"===t.target.localName&&s.validaData()&&(s.selectItem=e)}}}},handleQuery:function(){this.queryParam.pageNum=1,this.getList()},handleQueryRoleUser:function(){this.querySubParam.pageNum=1,this.getRoleUserList()},addRow:function(){var e=this,t=this.validaData();if(t){var s=Object(u["a"])(),a={id:"newRow-"+s,handleType:"add",roleName:"",roleKey:"",status:"0",operation:"",editable:!0};this.closeEditCell(this.list),this.list.unshift(a),this.$nextTick((function(){return e.selectItem=a}))}},updateRow:function(e){var t=this,s=Object(r["a"])(this.list);this.closeEditCell(s),e.handleType="edit",e.editable=!0,this.list=s,this.$nextTick((function(){return t.selectItem=e}))},cancelEditCell:function(e){if(this.validaData()){var t=Object(r["a"])(this.list);e.editable=!1,this.list=t}},handleDelete:function(e){var t=this,s=e.id||this.ids,a=e.roleKey||this.roleKeys;a.includes("admin")?this.$message.info("超级管理员角色不允许删除！"):this.$confirm({title:"确认删除所选中数据?",content:"当前选中编号为"+a+"的角色",onOk:function(){return Object(o["g"])(s).then((function(){t.onSelectChange([],[]),t.getList(),t.$message.success("删除成功",3)}))},onCancel:function(){}})},realDeleteRow:function(e,t){if("admin"===e.roleKey)this.$message.info("管理员不允许删除！");else{var s=Object(r["a"])(this.list),a=e.id;e.handleType="delete",a.indexOf("newRow-")<0&&this.deleteData.push(e);var n=s.filter((function(t){return e.id!==t.id}));n&&(this.list=n),"batch"!==t&&this.selectFirstRecord()}},deleteRow:function(e,t){if("batch"!==t){var s=e.id;if(s.indexOf("newRow-")>=0)this.realDeleteRow(e,t);else{var a=this;this.$confirm({title:"删除角色会删除相关的菜单，用户关系等，确认删除吗?",onOk:function(){a.realDeleteRow(e,t)},onCancel:function(){}})}}else this.realDeleteRow(e,t)},batchDeleteRow:function(){var e=this;this.$confirm({title:"删除角色会删除相关的菜单，用户关系等，确认删除吗?",onOk:function(){e.ids.forEach((function(t){var s=e.list.filter((function(e){return t===e.id}))[0];e.deleteRow(s,"batch")})),e.selectFirstRecord()},onCancel:function(){}})},selectFirstRecord:function(){this.list.length>0?this.selectItem=this.list[0]:(this.subList=[],this.subTotal=0)},batchSaveRole:function(){var e=this,t=this.list.filter((function(e){return"add"===e.handleType||"edit"===e.handleType}));if(t=t.concat(this.deleteData),0===t.length)this.$message.info("没有可保存的数据！");else{var s=this.validaData();s&&Object(o["b"])(t).then((function(t){e.$message.success("保存成功",3),e.getList()}))}},validaData:function(){var e=this,t=!0;return this.list.forEach((function(s){"undefined"===s.handleType||"add"!==s.handleType&&"edit"!==s.handleType||(""!==s.roleName&&"undefined"!==s.roleName&&null!==s.roleName||(e.$message.info("请先维护角色名称为空的数据！"),t=!1),!t||""!==s.roleKey&&"undefined"!==s.roleKey&&null!==s.roleKey||(e.$message.info("请先维护角色编码为空的数据！"),t=!1))})),t},closeEditCell:function(e){var t=e.filter((function(e){return!0===e.editable}));t.forEach((function(e){e.editable=!1}))},confirmHandleStatus:function(e){var t=this,s="1"===e.status?"启用":"停用";e.status="0"===e.status?"1":"0",Object(o["c"])(e.id,e.status).then((function(){t.$message.success(s+"成功",3)})).catch((function(){this.$message.error(s+"异常",3)}))},handleAddUser:function(){var e=this;this.$nextTick((function(){return e.$refs.selectUserRef.showSelectUser()}))},onShowSizeChange:function(e,t){this.queryParam.pageSize=t,this.getList()},onShowSizeSubChange:function(e,t){this.querySubParam.pageSize=t,this.getRoleUserList()},onSizeChange:function(e,t){this.queryParam.pageNum=1,this.queryParam.pageSize=t,this.getList()},changeSize:function(e,t){this.queryParam.pageNum=e,this.queryParam.pageSize=t,this.getList()},changeSubSize:function(e,t){this.querySubParam.pageNum=e,this.querySubParam.pageSize=t,this.getRoleUserList()},onSelectChange:function(e,t){this.selectedRowKeys=e,this.selectedRows=t,this.ids=this.selectedRows.map((function(e){return e.id})),this.roleKeys=this.selectedRows.map((function(e){return e.roleKey})),this.single=1!==e.length,this.multiple=!e.length},onSelectSubChange:function(e,t){this.selectedSubRowKeys=e,this.selectedSubRows=t,this.subIds=this.selectedSubRows.map((function(e){return e.id})),this.subMultiple=!e.length},handleDeleteSub:function(e){var t=this,s=e.id||this.subIds;this.$confirm({title:"确认删除所选中数据?",onOk:function(){return Object(o["h"])(t.currentSelectRoleId,s).then((function(){t.onSelectSubChange([],[]),t.getRoleUserList(),t.$message.success("删除成功",3)}))},onCancel:function(){}})},handleExport:function(){var e=this;this.$confirm({title:"是否确认导出?",content:"此操作将导出当前条件下所有数据而非选中数据",onOk:function(){return Object(o["i"])(e.queryParam).then((function(t){e.download(t.msg),e.$message.success("导出成功",3)}))},onCancel:function(){}})},renderRowStyle:function(e){var t,s=document.getElementsByClassName("ant-table-row"),a=document.getElementsByClassName("row-selection");a.length&&a[0].classList.remove("row-selection"),s.length&&(t=Object(r["a"])(s),t.find((function(t){return t.dataset.rowKey===e.id})).classList.add("row-selection"))}}},h=d,m=(s("43aa"),s("2877")),f=Object(m["a"])(h,a,n,!1,null,null,null);t["default"]=f.exports},ca00:function(e,t,s){"use strict";s.d(t,"b",(function(){return a})),s.d(t,"a",(function(){return o}));s("99af"),s("a15b"),s("ac1f"),s("5319");function a(){var e=new Date,t=e.getHours();return t<9?"早上好":t<=11?"上午好":t<=13?"中午好":t<20?"下午好":"晚上好"}function n(e,t){return Math.floor(Math.random()*(t-e+1)+e)}function r(e,t){e||(e=1),t||(t="0123456789qwertyuioplkjhgfdsazxcvbnm");for(var s="",a=0;a<e;a++){var r=n(0,t.length-1);s+=t[r]}return s}function o(){var e="0123456789abcdef";return r(32,e)}},cd8a:function(e,t,s){}}]);