1 |
- (window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-2fafed85"],{4426:function(e,t,s){"use strict";s.r(t);var i=function(){var e=this,t=e.$createElement,s=e._self._c||t;return s("div",{staticClass:"m-container"},[s("h2",[s("el-page-header",{attrs:{content:("create"==e.pageType?"添加":"修改")+"角色"},on:{back:e.onCancel}})],1),e._v(" "),s("div",{staticClass:"m-core"},[s("el-form",{ref:"form",staticStyle:{width:"500px"},attrs:{"label-width":"120px"}},[s("el-form-item",{attrs:{label:"角色名称",prop:"roleName"}},[s("el-input",{model:{value:e.result.roleName,callback:function(t){e.$set(e.result,"roleName","string"===typeof t?t.trim():t)},expression:"result.roleName"}})],1),e._v(" "),s("el-form-item",{attrs:{label:"角色描述"}},[s("el-input",{attrs:{type:"textarea"},model:{value:e.result.roleDesc,callback:function(t){e.$set(e.result,"roleDesc","string"===typeof t?t.trim():t)},expression:"result.roleDesc"}})],1),e._v(" "),s("el-form-item",{attrs:{label:"搜索"}},[s("el-input",{staticStyle:{width:"210px"},attrs:{clearable:""},model:{value:e.seachRoleValue,callback:function(t){e.seachRoleValue="string"===typeof t?t.trim():t},expression:"seachRoleValue"}}),e._v(" "),s("el-button",{staticStyle:{"margin-left":"10px"},attrs:{type:"danger"},on:{click:e.seachRoles}},[e._v("搜索")])],1),e._v(" "),s("el-form-item",{attrs:{label:"基本权限"}},[s("el-checkbox",{attrs:{indeterminate:e.isIndeterminate},on:{change:e.onCheckAll},model:{value:e.checkAll,callback:function(t){e.checkAll="string"===typeof t?t.trim():t},expression:"checkAll"}},[e._v("全选")]),e._v(" "),s("el-tree",{ref:"tree",attrs:{data:e.data,"show-checkbox":"","node-key":"id","filter-node-method":e.filterNode,accordion:"","highlight-current":"","default-checked-keys":e.result.menuIds,props:e.defaultProps},on:{check:e.onTreeCheck},scopedSlots:e._u([{key:"default",fn:function(t){var i=t.node,a=t.data;return s("div",{},[e._v("\n "+e._s(i.label)+"\n "),1==a.type?s("el-tag",{attrs:{effect:"dark"}},[e._v("按钮")]):e._e()],1)}}])})],1),e._v(" "),s("el-form-item",[s("el-button",{attrs:{type:"primary"},on:{click:e.onSubmit}},[e._v("立即"+e._s("create"==e.pageType?"创建":"修改"))]),e._v(" "),s("el-button",{on:{click:function(t){return e.onReSet("form")}}},[e._v("重置")])],1)],1)],1)])},a=[],n=(s("7f7f"),s("ac6a"),s("6762"),s("2fdb"),s("c7eb")),r=(s("96cf"),s("1da1")),l=s("5530"),o=s("2909"),c=s("99b4"),h=(s("4360"),s("1a62")),u={name:"adminOperation",data:function(){return{organId:null,pageType:null,id:null,page:null,isIndeterminate:!1,data:[],defaultProps:{children:"children",label:"label"},result:{roleName:null,roleDesc:null},checkAll:!1,splice:[],silderList:[],allChildIds:[],slideCount:0,seachRoleValue:"",filterIds:[4794,4743,3306,3307,3309,4627],isplatform:null}},mounted:function(){this.onReSet(),this.init(),console.log(this.$route)},activated:function(){this.onReSet(),this.init()},methods:{init:function(){this.pageType=this.$route.query.type,this.id=this.$route.query.id,this.page=this.$route.query.page,this.isplatform=this.$route.query.isplatform,"create"==this.pageType&&this.$refs.tree.setCheckedKeys([4229]),this.lookSilder()},onSubmit:function(){var e=this,t=this.$refs.tree.getCheckedKeys(),s=this.$refs.tree.getHalfCheckedKeys(),i=[].concat(Object(o["a"])(t),Object(o["a"])(s)),a={organId:this.organId,roleDesc:this.result.roleDesc,roleName:this.result.roleName,menuIds:i};this.isplatform&&(a.tenantId=-1),"update"==this.pageType?Object(c["M"])(Object(l["a"])({id:this.id},a)).then((function(t){e.messageTips("修改",t)})):"create"==this.pageType&&Object(c["K"])(Object(l["a"])({},a)).then((function(t){e.messageTips("添加",t)}))},messageTips:function(e,t){200==t.code?(this.$message.success("".concat(e,"成功")),this.$store.dispatch("delVisitedViews",this.$route),this.isplatform?this.$router.push({path:"/platformAdminManger",query:{page:this.page}}):this.$router.push({path:"/adminManager",query:{page:this.page}})):this.$message.error(t.msg)},lookSilder:function(){var e=Object(r["a"])(Object(n["a"])().mark((function e(){var t=this;return Object(n["a"])().wrap((function(e){while(1)switch(e.prev=e.next){case 0:Object(h["c"])({hid:0}).then(function(){var e=Object(r["a"])(Object(n["a"])().mark((function e(s){var i,a,r,l;return Object(n["a"])().wrap((function(e){while(1)switch(e.prev=e.next){case 0:if(i=[],200==s.code&&(t.silderList=s.data,i=t.setTableData(s.data),t.data=i),"update"!=t.pageType){e.next=9;break}return e.next=5,Object(c["s"])({id:t.id});case 5:a=e.sent,200==a.code&&(r=a.data,t.checkAll=r.menuIds.length>=t.slideCount,t.isIndeterminate=r.menuIds.length>0&&r.menuIds.length<t.slideCount,l=t.getParent(r.menuIds,i),r.menuIds=l,t.result=r),e.next=10;break;case 9:t.onReSet();case 10:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}());case 1:case"end":return e.stop()}}),e)})));function t(){return e.apply(this,arguments)}return t}(),onTreeCheck:function(){var e=this.$refs.tree.getCheckedKeys();this.checkAll=e.length>=this.slideCount,this.isIndeterminate=e.length>0&&e.length<this.slideCount},onCheckAll:function(e){e?(this.isIndeterminate=!1,this.$refs.tree.setCheckedNodes(this.data)):this.$refs.tree.setCheckedNodes([])},getParent:function(e,t){var s=JSON.parse(JSON.stringify(e));this.getAllChildIds(t);for(var i=this.allChildIds,a=e.length;a>0;a--)i.includes(e[a-1])||s.splice(a-1,1);return s},getAllChildIds:function(e){var t=this,s=this.allChildIds;e.forEach((function(e,i){e.children&&e.children.length>0?t.getAllChildIds(e.children):s.push(e.id)}))},setTableData:function(e){var t=this,s=[];s=e.map((function(e){if(!t.filterIds.includes(e.id)){var s={};return s={id:e.id,name:e.name,label:e.name,type:e.type,path:e.path,permission:e.permission,icon:e.icon,parentId:e.parentId},t.slideCount++,e.sysMenus&&e.sysMenus.length>0&&(s.children=t.setTableData(e.sysMenus)),s}return null}));var i=[];return s.forEach((function(e){e&&i.push(e)})),i},onReSet:function(){this.$refs.tree.setCheckedNodes([]),this.result={roleName:null,roleDesc:null},this.isIndeterminate=!1,this.checkAll=!1},onCancel:function(){this.$store.dispatch("delVisitedViews",this.$route),this.isplatform?this.$router.push({path:"/platformAdminManger",query:{page:this.page}}):this.$router.push({path:"/adminManager",query:{page:this.page}})},seachRoles:function(){this.$refs.tree.filter(this.seachRoleValue)},filterNode:function(e,t){return console.log(t),!e||-1!==t.label.indexOf(e)},onReSetRole:function(){this.seachRoleValue="",this.data=this.setTableData(this.silderList)}}},d=u,p=(s("b4db"),s("2877")),f=Object(p["a"])(d,i,a,!1,null,"09eccaca",null);t["default"]=f.exports},"70a8":function(e,t,s){},b4db:function(e,t,s){"use strict";s("70a8")}}]);
|