1 |
- webpackJsonp([21],{BDhv:function(t,i,e){var s=e("kM2E");s(s.P+s.R,"Set",{toJSON:e("m9gC")("Set")})},eZGL:function(t,i,e){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var s=e("//Fk"),a=e.n(s),n=e("lHA8"),o=e.n(n),l={name:"permissionManage",components:{noData:e("YLOf").a},data:function(){return{sideList:[],sideList_data:[],tableData:[],dialogTableVisible:!1,dialogLoading:!1,dialogTitleName:"新增角色",permissionVal:"",descVal:"",perIds:[],editId:"",acIdx:"helper",roleList:[],role_type:"",sideFlag:!1}},created:function(){this.get_role_type(),this.init()},methods:{switchList:function(t){this.acIdx=t,this.rebackInfo()},goMenumanage:function(){this.$router.push("/menuManage")},openDialog:function(t,i){this.dialogTitleName="edit"==t?"编辑角色":"新增角色",this.dialogTableVisible=!0,this.acIdx="helper",i?(this.permissionVal=i.name,this.descVal=i.desc,this.editId=i.id,this.role_type=i.role_type,this.rebackInfo()):(this.permissionVal="",this.descVal="",this.perIds=[],this.editId="",this.role_type="",this.perIds=[24]),this.sideFlag||this.all_getSideList()},rebackInfo:function(){var t=this;this.dialogLoading=!0;var i={params:{id:this.editId}};this.$axios.get(this.URL.BASEURL+this.URL.reback_permission,i).then(function(i){i=i.data;t.dialogLoading=!1,i&&0==i.errno?t.perIds=[24].concat(i.rst.checked_permission):t.$message({message:i.err,type:"warning"})}).catch(function(){t.dialogLoading=!1})},init:function(){var t=this;this.loading=!0,this.$axios.get(this.URL.BASEURL+this.URL.permission_list,{params:{page:1,page_size:50}}).then(function(i){(i=i.data)&&0==i.errno?t.tableData=i.rst.data:4002!=i.errno&&t.$message({message:i.err,type:"warning"}),t.loading=!1}).catch(function(){t.loading=!1})},addPermission:function(){var t=this;return""==this.name?(this.$message({message:"角色名为必填项",type:"warning"}),!1):""==this.role_type?(this.$message({message:"请选择角色类型",type:"warning"}),!1):(this.$loading(this.$loadingConfig),void this.$axios.post(this.URL.BASEURL+this.URL.add_permission,{name:this.permissionVal,desc:this.descVal,permission_id:new o.a(this.perIds),view_type:this.acIdx,role_type:this.role_type}).then(function(i){i=i.data;t.$loading(t.$loadingConfig).close(),i&&0==i.errno&&(t.dialogTableVisible=!1,t.init()),t.$message({message:i.err,type:"warning"})}).catch(function(){t.$loading(t.$loadingConfig).close()}))},editPermission:function(){var t=this;return""==this.name?(this.$message({message:"角色名为必填项",type:"warning"}),!1):""==this.role_type?(this.$message({message:"请选择角色类型",type:"warning"}),!1):(this.$loading(this.$loadingConfig),void this.$axios.post(this.URL.BASEURL+this.URL.edit_permission,{id:this.editId,name:this.permissionVal,desc:this.descVal,permission_id:new o.a(this.perIds),view_type:this.acIdx,role_type:this.role_type}).then(function(i){i=i.data;t.$loading(t.$loadingConfig).close(),i&&0==i.errno&&(t.dialogTableVisible=!1,t.init()),t.$message({message:i.err,type:"warning"})}).catch(function(){t.$loading(t.$loadingConfig).close()}))},delepermission:function(t){var i=this;if(""==t)return this.$message({message:"角色id未得到",type:"warning"}),!1;this.$confirm("是否删除此角色","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then(function(){i.$axios.get(i.URL.BASEURL+i.URL.dele_permission,{params:{id:t}}).then(function(t){(t=t.data)&&0==t.errno&&i.init(),i.$message({message:t.err,type:"warning"})}).catch(function(t){i.$message({message:t,type:"warning"})})}).catch(function(){})},all_getSideList:function(){var t=this;this.dialogLoading=!0,a.a.all([this.getSideList(),this.getSideList_data()]).then(function(){t.sideFlag=!0,t.dialogLoading=!1})},getSideList_data:function(){var t=this;return new a.a(function(i,e){t.$axios.get(t.URL.BASEURL+t.URL.choose_config_menu,{params:{view_type:"data"}}).then(function(e){e=e.data;i(),e&&0==e.errno?t.sideList_data=e.rst:4002!=e.errno&&t.$message({message:e.err,type:"warning"})}).catch(function(e){i(),t.$message({message:e,type:"warning"})})})},getSideList:function(){var t=this;return new a.a(function(i,e){t.$axios.get(t.URL.BASEURL+t.URL.choose_config_menu,{params:{view_type:"helper"}}).then(function(e){e=e.data;i(),e&&0==e.errno?t.sideList=e.rst:4002!=e.errno&&t.$message({message:e.err,type:"warning"})}).catch(function(e){i(),t.$message({message:e,type:"warning"})})})},chooseperIds:function(t){if(24!=t){var i=this.perIds.indexOf(t);i>-1?this.perIds.splice(i,1):this.perIds.push(t)}else this.$message({message:"首页不能隐藏哟~",type:"warning"})},get_role_type:function(){var t=this;this.$axios.get(this.URL.BASEURL+this.URL.role_type,{}).then(function(i){if((i=i.data)&&0==i.errno&&i.rst){var e=[];for(var s in i.rst)e.push({id:Number(s),name:i.rst[s]});t.roleList=e}}).catch(function(){})}}},r={render:function(){var t=this,i=t.$createElement,e=t._self._c||i;return e("div",{staticClass:"con"},[e("div",[e("el-button",{attrs:{size:"mini",type:"primary"},on:{click:function(i){return t.openDialog("add")}}},[t._v("添加角色")]),t._v(" "),e("span",{staticStyle:{color:"red","font-size":"12px","margin-left":"4px"}},[t._v("* 只有超级管理员可修改角色,普通角色可添加角色,不可编辑修改角色,请慎重添加!")])],1),t._v(" "),e("table",{directives:[{name:"loading",rawName:"v-loading",value:t.loading,expression:"loading"}],staticClass:"tableCon"},[t._m(0),t._v(" "),t.tableData&&t.tableData.length>0?[e("tbody",t._l(t.tableData,function(i,s){return e("tr",{key:i.id},[e("td",[t._v("\n "+t._s(i.name)+"\n ")]),t._v(" "),e("td",[t._v(t._s(i.desc))]),t._v(" "),e("td",[1==i.can_edit?[e("el-button",{attrs:{size:"mini",type:"primary"},on:{click:function(e){return t.openDialog("edit",i)}}},[t._v("修改")]),t._v(" "),e("el-button",{attrs:{size:"mini"},on:{click:function(e){return t.delepermission(i.id)}}},[t._v("删除")])]:e("span",{staticClass:"f12 c-A5A5A5"},[t._v("无权限操作")])],2)])}),0)]:t._e()],2),t._v(" "),t.tableData&&0==t.tableData.length?e("noData"):t._e(),t._v(" "),e("el-dialog",{staticClass:"dialogCon_permission",attrs:{title:t.dialogTitleName,visible:t.dialogTableVisible,width:"700px",top:"60px"},on:{"update:visible":function(i){t.dialogTableVisible=i}}},[e("div",{directives:[{name:"loading",rawName:"v-loading",value:t.dialogLoading,expression:"dialogLoading"}],staticClass:"dialogCon",staticStyle:{"margin-top":"-20px"}},[e("div",{staticClass:"itemBox"},[e("div",{staticClass:"name"},[t._v("角色名称:")]),t._v(" "),e("div",{staticClass:"ipt"},[e("el-input",{attrs:{size:"small",placeholder:"请输入角色名称"},model:{value:t.permissionVal,callback:function(i){t.permissionVal=i},expression:"permissionVal"}})],1)]),t._v(" "),e("div",{staticClass:"itemBox"},[e("div",{staticClass:"name"},[t._v("角色描述:")]),t._v(" "),e("div",{staticClass:"ipt"},[e("el-input",{attrs:{size:"small",placeholder:"请输入角色描述"},model:{value:t.descVal,callback:function(i){t.descVal=i},expression:"descVal"}})],1)]),t._v(" "),e("div",{staticClass:"itemBox"},[e("div",{staticClass:"name"},[t._v("角色类型:")]),t._v(" "),e("div",{staticClass:"ipt"},[e("el-select",{staticStyle:{width:"100%"},attrs:{size:"small",placeholder:"请选择"},model:{value:t.role_type,callback:function(i){t.role_type=i},expression:"role_type"}},t._l(t.roleList,function(t){return e("el-option",{key:t.id,attrs:{label:t.name,value:t.id}})}),1)],1)]),t._v(" "),e("div",{staticClass:"itemBox configBox"},[e("div",{staticClass:"name"},[t._v("角色配置:")]),t._v(" "),e("div",{staticClass:"ipt",staticStyle:{"max-height":"400px","overflow-y":"auto"}},[e("div",{staticClass:"tabBar"},[e("div",{staticClass:"acClass"},[t._v("猎羽")])]),t._v(" "),e("div",{staticClass:"sideBox"},t._l(t.sideList,function(i,s){return e("div",{key:i.id,class:0==s?"":"tMar20"},[e("div",{on:{click:function(e){return t.chooseperIds(i.id)}}},[e("span",{staticClass:"fWeight600"},[t._v(t._s(i.title))]),t._v(" "),i.sub&&0==i.sub.length?[t.perIds.indexOf(i.id)>-1?e("span",{staticClass:"yescheck"},[e("i",{staticClass:"el-icon-check f12"})]):e("span",{staticClass:"noCheck"})]:t._e()],2),t._v(" "),e("div",{staticClass:"flex-align-center",staticStyle:{"flex-wrap":"wrap"}},[t._l(i.sub,function(i,s){return["menuManage"!=i.route&&1!=t.$cookie.getCookie("isSuperManage")||"menuManage"!=i.route&&1==t.$cookie.getCookie("isSuperManage")?e("div",{key:"child"+i.id,staticClass:"rMar15 tMar10",on:{click:function(e){return t.chooseperIds(i.id)}}},[e("span",[t._v(t._s(i.title))]),t._v(" "),t.perIds.indexOf(i.id)>-1?e("span",{staticClass:"yescheck"},[e("i",{staticClass:"el-icon-check f12"})]):e("span",{staticClass:"noCheck"})]):t._e()]})],2)])}),0),t._v(" "),e("div",{staticClass:"tabBar tMar20"},[e("div",{staticClass:"acClass"},[t._v("数据看板")])]),t._v(" "),e("div",{staticClass:"sideBox"},t._l(t.sideList_data,function(i,s){return e("div",{key:i.id,class:0==s?"":"tMar20"},[e("div",{on:{click:function(e){return t.chooseperIds(i.id)}}},[e("span",{staticClass:"fWeight600"},[t._v(t._s(i.title))]),t._v(" "),i.sub&&0==i.sub.length?[t.perIds.indexOf(i.id)>-1?e("span",{staticClass:"yescheck"},[e("i",{staticClass:"el-icon-check f12"})]):e("span",{staticClass:"noCheck"})]:t._e()],2),t._v(" "),e("div",{staticClass:"flex-align-center",staticStyle:{"flex-wrap":"wrap"}},t._l(i.sub,function(i,s){return e("div",{key:"child"+i.id,staticClass:"rMar15 tMar10",on:{click:function(e){return t.chooseperIds(i.id)}}},[e("span",[t._v(t._s(i.title))]),t._v(" "),t.perIds.indexOf(i.id)>-1?e("span",{staticClass:"yescheck"},[e("i",{staticClass:"el-icon-check f12"})]):e("span",{staticClass:"noCheck"})])}),0)])}),0)])])]),t._v(" "),e("div",{staticClass:"dialog-footer",staticStyle:{"margin-top":"-20px"},attrs:{slot:"footer"},slot:"footer"},[e("el-button",{attrs:{size:"mini"},on:{click:function(i){t.dialogTableVisible=!1}}},[t._v("取 消")]),t._v(" "),e("el-button",{attrs:{size:"mini",type:"primary"},on:{click:function(i){"新增角色"==t.dialogTitleName?t.addPermission():t.editPermission()}}},[t._v("确\n 定")])],1)])],1)},staticRenderFns:[function(){var t=this.$createElement,i=this._self._c||t;return i("thead",[i("tr",[i("th",[this._v("角色名称")]),this._v(" "),i("th",[this._v("描述")]),this._v(" "),i("th",[this._v("操作")])])])}]};var c=e("VU/8")(l,r,!1,function(t){e("ycf2")},"data-v-5db6d37c",null);i.default=c.exports},ioQ5:function(t,i,e){e("HpRW")("Set")},lHA8:function(t,i,e){t.exports={default:e("pPW7"),__esModule:!0}},oNmr:function(t,i,e){e("9Bbf")("Set")},pPW7:function(t,i,e){e("M6a0"),e("zQR9"),e("+tPU"),e("ttyz"),e("BDhv"),e("oNmr"),e("ioQ5"),t.exports=e("FeBl").Set},ttyz:function(t,i,e){"use strict";var s=e("9C8M"),a=e("LIJb");t.exports=e("qo66")("Set",function(t){return function(){return t(this,arguments.length>0?arguments[0]:void 0)}},{add:function(t){return s.def(a(this,"Set"),t=0===t?0:t,t)}},s)},ycf2:function(t,i){}});
|