1 line
3.6 KiB
JavaScript
1 line
3.6 KiB
JavaScript
webpackJsonp([51],{Rmz3:function(n,e,i){var t=i("oSJT");"string"==typeof t&&(t=[[n.i,t,""]]),t.locals&&(n.exports=t.locals);i("Xatw")("37325e73",t,!0)},fyWp:function(n,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var t=i("s/F+"),s=i.n(t),r=i("yrbl"),l=i.n(r),c=i("EwHo"),o={data:function(){return{checkAll:!1,id:"",ruleForm:{},configRule:[],checkList:[],isIndeterminate:!1,privilegeIds:[],countPrivilegeIds:[]}},mounted:function(){var n=this;return l()(s.a.mark(function e(){var i,t;return s.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return i=n,t=n.$route.params.id,n.id=t,e.next=5,c.a.getRolePrivileges(t).then(function(n){i.boolPrivileges(n),i.configRule=n});case 5:case"end":return e.stop()}},e,n)}))()},methods:{submitForm:function(n){var e=this.$route.params.id,i=this;this.$refs[n].validate(function(n){if(!n)return console.log("error submit!!"),!1;c.a.postRolePrivileges(e,i.privilegeIds),i.$notify({title:"成功",message:"配置权限成功",type:"success",duration:2e3}),i.$router.push("../role-manager")})},handleCheckAllChange:function(){this.isIndeterminate=!1,this.boolPrivileges(this.configRule,this.checkAll)},handleCancel:function(){this.$router.push("../role-manager")},statusCheck:function(){0==this.privilegeIds.length&&(this.isIndeterminate=!1),this.privilegeIds.length>0&&(this.isIndeterminate=!0,this.privilegeIds.length==this.countPrivilegeIds.length?(this.checkAll=!0,this.isIndeterminate=!1):(this.checkAll=!1,this.isIndeterminate=!0))},handleCheckedChange:function(n){if(n.checked)this.privilegeIds.push(n.id);else for(var e=0;e<this.privilegeIds.length;e++)this.privilegeIds[e]==n.id&&this.privilegeIds.splice(e,1);this.statusCheck()},boolPrivileges:function(n,e){for(var i in n)void 0===e?void 0!==n[i].own&&(this.countPrivilegeIds.push(n[i].id),1===n[i].own?(n[i].checked=!0,this.privilegeIds.push(n[i].id)):n[i].checked=!1,this.statusCheck()):e?void 0!==n[i].own&&(n[i].checked=!0,this.privilegeIds.push(n[i].id)):e||(n[i].checked=!1,this.privilegeIds=[]),this.boolPrivileges(n[i].privileges,e)}}},a={render:function(){var n=this,e=n.$createElement,i=n._self._c||e;return i("div",{staticClass:"config-main"},[i("el-checkbox",{attrs:{indeterminate:n.isIndeterminate},on:{change:n.handleCheckAllChange},model:{value:n.checkAll,callback:function(e){n.checkAll=e},expression:"checkAll"}},[n._v("全选")]),n._v(" "),i("el-form",{ref:"ruleForm",attrs:{model:n.ruleForm}},[n._l(n.configRule,function(e){return e.privileges.length>0?i("el-form-item",{key:e.id,staticClass:"par-name",attrs:{label:e.name}},n._l(e.privileges,function(e){return i("el-checkbox",{key:e.id,attrs:{label:e.description},on:{change:function(i){n.handleCheckedChange(e)}},model:{value:e.checked,callback:function(i){n.$set(e,"checked",i)},expression:"child.checked"}})})):n._e()}),n._v(" "),i("el-row",{staticClass:"operation-container",attrs:{type:"flex",justify:"flex-start"}},[i("el-col",{attrs:{span:3}},[i("el-button",{attrs:{type:"primary"},on:{click:function(e){n.submitForm("ruleForm")}}},[n._v("确定")])],1),n._v(" "),i("el-col",{attrs:{span:3}},[i("el-button",{attrs:{type:"danger"},on:{click:n.handleCancel}},[n._v("返回")])],1)],1)],2)],1)},staticRenderFns:[]};var h=i("rCDr")(o,a,!1,function(n){i("Rmz3")},"data-v-67008392",null);e.default=h.exports},oSJT:function(n,e,i){(n.exports=i("uszS")(!1)).push([n.i,"\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n",""])}}); |