(("undefined"!==typeof self?self:this)["webpackJsonpresource_management"]=("undefined"!==typeof self?self:this)["webpackJsonpresource_management"]||[]).push([[6],{2:function(e,s){},"456b":function(e,s,r){"use strict";r("9a2e")},"731a":function(e,s,r){"use strict";r.r(s);var i=function(){var e=this,s=e.$createElement,r=e._self._c||s;return r("div",[r("el-dialog",{directives:[{name:"dialogDrag",rawName:"v-dialogDrag"}],staticClass:"mini-dialog",attrs:{width:"565px","append-to-body":!0,visible:e.permissionProps.visible,title:e.permissionProps.title},on:{"update:visible":function(s){return e.$set(e.permissionProps,"visible",s)}}},[r("el-form",[r("el-form-item",{attrs:{label:"选择权限"}},[r("el-card",{staticClass:"wraper--tree overflow-y-auto m-t-10"},[e.permissionProps.visible?r("el-tree",{directives:[{name:"loading",rawName:"v-loading",value:e.treeLoading,expression:"treeLoading"}],ref:"tree",attrs:{data:e.permissionTreeData,"show-checkbox":"","node-key":"name",props:e.defaultProps}}):e._e()],1)],1)],1),r("div",{staticClass:"flex justify-center",attrs:{slot:"footer"},slot:"footer"},[r("el-button",{staticClass:"iconfont icon-save",attrs:{size:"small",type:"primary"},on:{click:function(s){return e.save()}}},[e._v("保存")]),r("el-button",{staticClass:"iconfont icon-close",attrs:{size:"small"},on:{click:function(s){return e.cancel()}}},[e._v("取消")])],1)],1)],1)},t=[],n=r("c7eb"),a=r("2909"),o=r("3835"),c=r("1da1"),d=(r("99af"),r("4de4"),r("7db0"),r("d81d"),r("b0c0"),r("d3b7"),r("159b"),r("392c")),p=new d["PermissionsApi"],l={props:{permissionProps:{type:Object,default:function(){return{visible:!0,providerKey:"",providerName:"",title:""}}}},name:"operateRolePerssionDialog",components:{},data:function(){return{treeLoading:!1,permissionTreeData:[],defaultProps:{label:"displayName",children:"permissions"},defaultCheckedNodes:[]}},watch:{permissionProps:{deep:!0,immediate:!0,handler:function(e){e.visible&&this.getPermissions()}}},methods:{cancel:function(){this.permissionProps.visible=!1},save:function(){var e=this;return Object(c["a"])(Object(n["a"])().mark((function s(){var r,i,t,c,d;return Object(n["a"])().wrap((function(s){while(1)switch(s.prev=s.next){case 0:return r=_.filter(e.$refs.tree.getCheckedNodes(),(function(e){return _.has(e,"isGranted")})),r=_.map(r,(function(e){return{isGranted:!0,name:e.name}})),i=_.filter(e.defaultCheckedNodes,(function(e){return!_.find(r,["name",e.name])})),i=_.map(i,(function(e){return{isGranted:!1,name:e.name}})),s.next=6,p.update({providerKey:e.permissionProps.providerKey,providerName:e.permissionProps.providerName,body:{permissions:[].concat(Object(a["a"])(i),Object(a["a"])(r))}});case 6:t=s.sent,c=Object(o["a"])(t,2),d=c[0],c[1],d||(e.$message.success({showClose:!0,message:"修改权限成功"}),e.permissionProps.visible=!1);case 11:case"end":return s.stop()}}),s)})))()},getPermissions:function(){var e=this;return Object(c["a"])(Object(n["a"])().mark((function s(){var r,i,t,c;return Object(n["a"])().wrap((function(s){while(1)switch(s.prev=s.next){case 0:return e.treeLoading=!0,e.defaultCheckedNodes=[],s.next=4,p.get({providerName:e.permissionProps.providerName,providerKey:e.permissionProps.providerKey});case 4:r=s.sent,i=Object(o["a"])(r,2),t=i[0],c=i[1],t||(e.permissionTreeData=c.groups,_.forEach(e.permissionTreeData,(function(s){var r=_.cloneDeep(s.permissions);if("U"===e.permissionProps.providerName){var i=!0;_.forEach(s.permissions,(function(e){e.disabled=e.isGranted&&"R"===e.grantedProviders[0].providerName,e.disabled||(i=!1)})),s.disabled=i}e.defaultCheckedNodes=[].concat(Object(a["a"])(e.defaultCheckedNodes),Object(a["a"])(_.filter(r,"isGranted"))),s.permissions=_.filter(s.permissions,(function(e){return _.isNil(e.parentName)})),_.forEach(s.permissions,(function(s){s.permissions=_.filter(r,(function(r){return"U"===e.permissionProps.providerName&&(r.disabled=r.isGranted&&"R"===r.grantedProviders[0].providerName),r.parentName===s.name}))}))})),e.$nextTick((function(){e.$refs.tree.setCheckedNodes(e.defaultCheckedNodes),e.treeLoading=!1})));case 9:case"end":return s.stop()}}),s)})))()}},created:function(){}},u=l,f=(r("456b"),r("2877")),m=Object(f["a"])(u,i,t,!1,null,"57b8d1fb",null);s["default"]=m.exports},"7e53":function(e,s,r){s=e.exports=r("2350")(!1),s.push([e.i,".wraper--tree[data-v-57b8d1fb]{height:500px}",""])},"9a2e":function(e,s,r){var i=r("7e53");i.__esModule&&(i=i.default),"string"===typeof i&&(i=[[e.i,i,""]]),i.locals&&(e.exports=i.locals);var t=r("499e").default;t("5e0bc3e2",i,!0,{sourceMap:!1,shadowMode:!1})}}]);
//# sourceMappingURL=resource-management.umd.min.6.js.map