chunk-6a9f.93b56e41.js 9.3 KB

1
  1. (window.webpackJsonp=window.webpackJsonp||[]).push([["chunk-6a9f"],{"966M":function(t,e,i){"use strict";i.r(e);var a=i("FyfS"),s=i.n(a),n=i("P2sY"),o=i.n(n),r=i("zF5t"),l={name:"Role",components:{Pagination:i("Mz3J").a},data:function(){return{list:null,total:0,listLoading:!0,listQuery:{page:1,limit:20,name:void 0,sort:"add_time",order:"desc"},dataForm:{id:void 0,name:void 0,desc:void 0},dialogFormVisible:!1,permissionLoading:!1,dialogStatus:"",textMap:{update:"编辑",create:"创建"},rules:{name:[{required:!0,message:"角色名称不能为空",trigger:"blur"}],desc:[{required:!0,message:"角色描述不能为空",trigger:"blur"}]},permissionDialogFormVisible:!1,systemPermissions:null,assignedPermissions:null,permissionForm:{roleId:void 0,permissions:[]}}},created:function(){this.getList()},methods:{getList:function(){var t=this;this.listLoading=!0,Object(r.d)(this.listQuery).then(function(e){t.list=e.data.data.items,t.total=e.data.data.total,t.listLoading=!1}).catch(function(){t.list=[],t.total=0,t.listLoading=!1})},handleFilter:function(){this.listQuery.page=1,this.getList()},resetForm:function(){this.dataForm={id:void 0,name:void 0,desc:void 0}},handleCreate:function(){var t=this;this.resetForm(),this.dialogStatus="create",this.dialogFormVisible=!0,this.$nextTick(function(){t.$refs.dataForm.clearValidate()})},createData:function(){var t=this;this.$refs.dataForm.validate(function(e){e&&Object(r.a)(t.dataForm).then(function(e){t.list.unshift(e.data.data),t.dialogFormVisible=!1,t.$notify.success({title:"成功",message:"添加角色成功"})}).catch(function(e){t.$notify.error({title:"失败",message:e.data.errmsg})})})},handleUpdate:function(t){var e=this;this.dataForm=o()({},t),this.dialogStatus="update",this.dialogFormVisible=!0,this.$nextTick(function(){e.$refs.dataForm.clearValidate()})},updateData:function(){var t=this;this.$refs.dataForm.validate(function(e){e&&Object(r.g)(t.dataForm).then(function(){var e=!0,i=!1,a=void 0;try{for(var n,o=s()(t.list);!(e=(n=o.next()).done);e=!0){var r=n.value;if(r.id===t.dataForm.id){var l=t.list.indexOf(r);t.list.splice(l,1,t.dataForm);break}}}catch(t){i=!0,a=t}finally{try{!e&&o.return&&o.return()}finally{if(i)throw a}}t.dialogFormVisible=!1,t.$notify.success({title:"成功",message:"更新管理员成功"})}).catch(function(e){t.$notify.error({title:"失败",message:e.data.errmsg})})})},handleDelete:function(t){var e=this;this.$confirm("此操作将永久删除该角色---"+t.name+"---, 是否继续?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then(function(){Object(r.b)(t.id).then(function(i){e.$notify.success({title:"成功",message:"删除角色成功"});var a=e.list.indexOf(t);e.list.splice(a,1)}).catch(function(t){e.$notify.error({title:"失败",message:t.data.errmsg})})}).catch(function(){return!1})},handlePermission:function(t){var e=this;this.permissionDialogFormVisible=!0,this.permissionForm.roleId=t.id,Object(r.c)({roleId:t.id}).then(function(t){e.systemPermissions=t.data.data.systemPermissions,e.assignedPermissions=t.data.data.assignedPermissions})},updatePermission:function(){var t=this;this.permissionLoading=!0,this.permissionDialogFormVisible=!1,this.permissionDialogFormVisible=!0,this.permissionForm.permissions=this.$refs.tree.getCheckedKeys(!0),Object(r.f)(this.permissionForm).then(function(e){t.permissionDialogFormVisible=!1,t.$notify.success({title:"成功",message:"授权成功"}),t.permissionLoading=!1}).catch(function(e){t.$notify.error({title:"失败",message:e.data.errmsg}),t.permissionLoading=!1})}}},d=i("KHd+"),m=Object(d.a)(l,function(){var t=this,e=t.$createElement,i=t._self._c||e;return i("div",{staticClass:"app-container"},[i("div",{staticClass:"filter-container"},[i("el-input",{staticClass:"filter-item",staticStyle:{width:"200px"},attrs:{clearable:"",placeholder:"请输入角色名称"},model:{value:t.listQuery.name,callback:function(e){t.$set(t.listQuery,"name",e)},expression:"listQuery.name"}}),t._v(" "),i("el-button",{directives:[{name:"permission",rawName:"v-permission",value:["admin:role:list"],expression:"['admin:role:list']"}],staticClass:"filter-item",attrs:{type:"primary",icon:"el-icon-search"},on:{click:t.handleFilter}},[t._v("查找")]),t._v(" "),i("el-button",{directives:[{name:"permission",rawName:"v-permission",value:["admin:role:create"],expression:"['admin:role:create']"}],staticClass:"filter-item",attrs:{type:"primary",icon:"el-icon-edit"},on:{click:t.handleCreate}},[t._v("添加")])],1),t._v(" "),i("el-table",{directives:[{name:"loading",rawName:"v-loading",value:t.listLoading,expression:"listLoading"}],attrs:{data:t.list,size:"small","element-loading-text":"正在查询中。。。",border:"",fit:"","highlight-current-row":""}},[i("el-table-column",{attrs:{align:"center",label:"角色名称",prop:"name",sortable:""}}),t._v(" "),i("el-table-column",{attrs:{align:"center",label:"说明",prop:"desc"}}),t._v(" "),i("el-table-column",{attrs:{align:"center",label:"操作","class-name":"small-padding fixed-width"},scopedSlots:t._u([{key:"default",fn:function(e){return[i("el-button",{directives:[{name:"permission",rawName:"v-permission",value:["admin:role:update"],expression:"['admin:role:update']"}],attrs:{type:"primary",size:"mini"},on:{click:function(i){t.handleUpdate(e.row)}}},[t._v("编辑")]),t._v(" "),i("el-button",{directives:[{name:"permission",rawName:"v-permission",value:["admin:role:delete"],expression:"['admin:role:delete']"}],attrs:{type:"danger",size:"mini"},on:{click:function(i){t.handleDelete(e.row)}}},[t._v("删除")]),t._v(" "),i("el-button",{directives:[{name:"permission",rawName:"v-permission",value:["admin:role:permissionList"],expression:"['admin:role:permissionList']"}],attrs:{type:"primary",size:"mini"},on:{click:function(i){t.handlePermission(e.row)}}},[t._v("授权")])]}}])})],1),t._v(" "),i("pagination",{directives:[{name:"show",rawName:"v-show",value:t.total>0,expression:"total>0"}],attrs:{total:t.total,page:t.listQuery.page,limit:t.listQuery.limit},on:{"update:page":function(e){t.$set(t.listQuery,"page",e)},"update:limit":function(e){t.$set(t.listQuery,"limit",e)},pagination:t.getList}}),t._v(" "),i("el-dialog",{attrs:{title:t.textMap[t.dialogStatus],visible:t.dialogFormVisible},on:{"update:visible":function(e){t.dialogFormVisible=e}}},[i("el-form",{ref:"dataForm",staticStyle:{width:"400px","margin-left":"50px"},attrs:{rules:t.rules,model:t.dataForm,"status-icon":"","label-position":"left","label-width":"100px"}},[i("el-form-item",{attrs:{label:"角色名称",prop:"name"}},[i("el-input",{model:{value:t.dataForm.name,callback:function(e){t.$set(t.dataForm,"name",e)},expression:"dataForm.name"}})],1),t._v(" "),i("el-form-item",{attrs:{label:"说明",prop:"desc"}},[i("el-input",{model:{value:t.dataForm.desc,callback:function(e){t.$set(t.dataForm,"desc",e)},expression:"dataForm.desc"}})],1)],1),t._v(" "),i("div",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[i("el-button",{on:{click:function(e){t.dialogFormVisible=!1}}},[t._v("取消")]),t._v(" "),"create"==t.dialogStatus?i("el-button",{attrs:{type:"primary"},on:{click:t.createData}},[t._v("确定")]):i("el-button",{attrs:{type:"primary"},on:{click:t.updateData}},[t._v("确定")])],1)],1),t._v(" "),i("el-dialog",{attrs:{visible:t.permissionDialogFormVisible,title:"权限配置"},on:{"update:visible":function(e){t.permissionDialogFormVisible=e}}},[i("el-tree",{ref:"tree",attrs:{data:t.systemPermissions,"default-checked-keys":t.assignedPermissions,"show-checkbox":"","node-key":"id","highlight-current":""},scopedSlots:t._u([{key:"default",fn:function(e){e.node;var a=e.data;return i("span",{staticClass:"custom-tree-node"},[i("span",[t._v(t._s(a.label))]),t._v(" "),a.api?i("el-tag",{attrs:{type:"success",size:"mini"}},[t._v(t._s(a.api))]):t._e()],1)}}])}),t._v(" "),i("div",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[i("el-button",{on:{click:function(e){t.permissionDialogFormVisible=!1}}},[t._v("取消")]),t._v(" "),i("el-button",{attrs:{loading:t.permissionLoading,type:"primary"},on:{click:t.updatePermission}},[t._v("确定")])],1)],1)],1)},[],!1,null,null,null);m.options.__file="role.vue";e.default=m.exports},"gDS+":function(t,e,i){t.exports={default:i("oh+g"),__esModule:!0}},"oh+g":function(t,e,i){var a=i("WEpk"),s=a.JSON||(a.JSON={stringify:JSON.stringify});t.exports=function(t){return s.stringify.apply(s,arguments)}},zF5t:function(t,e,i){"use strict";i.d(e,"d",function(){return m}),i.d(e,"a",function(){return c}),i.d(e,"g",function(){return u}),i.d(e,"b",function(){return p}),i.d(e,"c",function(){return f}),i.d(e,"f",function(){return g}),i.d(e,"e",function(){return v});var a=i("gDS+"),s=i.n(a),n=i("QbLZ"),o=i.n(n),r=i("t3Un"),l=i("Qyje"),d=i.n(l);function m(t){return Object(r.a)({method:"get",params:o()({_gp:"admin.role",_mt:"list"},t)})}function c(t){return Object(r.a)({method:"post",data:d.a.stringify({_gp:"admin.role",_mt:"create",role:s()(t)})})}function u(t){return Object(r.a)({method:"post",data:d.a.stringify({_gp:"admin.role",_mt:"update",role:s()(t)})})}function p(t){return Object(r.a)({method:"post",params:{_gp:"admin.role",_mt:"delete",roleId:t}})}function f(t){return Object(r.a)({method:"get",params:o()({_gp:"admin.role",_mt:"permissionList"},t)})}function g(t){return Object(r.a)({method:"post",data:d.a.stringify({_gp:"admin.role",_mt:"permissionSet",roleSetPermissionDTO:s()(t)})})}function v(t){return Object(r.a)({method:"get",params:{_gp:"admin.role",_mt:"options"}})}}}]);