(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-a725bfba"],{"12f7":function(e,t,s){},"6bca":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,n=t.data;return s("div",{},[e._v("\n "+e._s(i.label)+"\n "),1==n.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)])},n=[],a=(s("7f7f"),s("ac6a"),s("6762"),s("2fdb"),s("c7eb")),r=(s("96cf"),s("1da1")),l=s("2909"),o=s("99b4"),c=(s("4360"),s("1a62")),h={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:[],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(l["a"])(t),Object(l["a"])(s)),n=null;this.isplatform&&(n=-1),"update"==this.pageType?Object(o["M"])({id:this.id,organId:this.organId,roleDesc:this.result.roleDesc,roleName:this.result.roleName,menuIds:i,tenantId:n}).then((function(t){e.messageTips("修改",t)})):"create"==this.pageType&&Object(o["K"])({organId:this.organId,roleDesc:this.result.roleDesc,roleName:this.result.roleName,menuIds:i,tenantId:n}).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(a["a"])().mark((function e(){var t=this;return Object(a["a"])().wrap((function(e){while(1)switch(e.prev=e.next){case 0:Object(c["c"])({hid:0}).then(function(){var e=Object(r["a"])(Object(a["a"])().mark((function e(s){var i,n,r,l;return Object(a["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(o["s"])({id:t.id});case 5:n=e.sent,200==n.code&&(r=n.data,t.checkAll=r.menuIds.length>=t.slideCount,t.isIndeterminate=r.menuIds.length>0&&r.menuIds.length=this.slideCount,this.isIndeterminate=e.length>0&&e.length0;n--)i.includes(e[n-1])||s.splice(n-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)}}},u=h,d=(s("a494"),s("2877")),p=Object(d["a"])(u,i,n,!1,null,"58d0461b",null);t["default"]=p.exports},a494:function(e,t,s){"use strict";s("12f7")}}]);