(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-2352b25e","chunk-1de2c333","chunk-2d0df437"],{"0b38":function(e,t,a){"use strict";a.r(t);var n=function(){var e=this,t=e._self._c;return t("a-modal",{attrs:{title:"操作",width:800,visible:e.visible,confirmLoading:e.confirmLoading},on:{ok:e.handleOk,cancel:e.handleCancel}},[t("a-spin",{attrs:{spinning:e.confirmLoading}},[t("a-form",{attrs:{form:e.form}},[t("a-form-item",{attrs:{labelCol:e.labelCol,wrapperCol:e.wrapperCol,label:"唯一识别码",hasFeedback:""}},[t("a-input",{directives:[{name:"decorator",rawName:"v-decorator",value:["id",{rules:[]}],expression:"[ 'id', {rules: []} ]"}],attrs:{placeholder:"唯一识别码",disabled:"disabled"}})],1),t("a-form-item",{attrs:{labelCol:e.labelCol,wrapperCol:e.wrapperCol,label:"角色名称",hasFeedback:""}},[t("a-input",{directives:[{name:"decorator",rawName:"v-decorator",value:["name",{rules:[{required:!0,message:"不起一个名字吗?"}]}],expression:"[ 'name', {rules: [{ required: true, message: '不起一个名字吗?' }] }]"}],attrs:{placeholder:"起一个名字"}})],1),t("a-form-item",{attrs:{labelCol:e.labelCol,wrapperCol:e.wrapperCol,label:"状态",hasFeedback:""}},[t("a-select",{directives:[{name:"decorator",rawName:"v-decorator",value:["status",{rules:[]}],expression:"[ 'status', {rules: []} ]"}]},[t("a-select-option",{attrs:{value:1}},[e._v("正常")]),t("a-select-option",{attrs:{value:2}},[e._v("禁用")])],1)],1),t("a-form-item",{attrs:{labelCol:e.labelCol,wrapperCol:e.wrapperCol,label:"描述",hasFeedback:""}},[t("a-textarea",{directives:[{name:"decorator",rawName:"v-decorator",value:["describe",{rules:[]}],expression:"[ 'describe', { rules: [] } ]"}],attrs:{rows:5,placeholder:"..."}})],1),t("a-divider"),t("a-form-item",{attrs:{labelCol:e.labelCol,wrapperCol:e.wrapperCol,label:"拥有权限",hasFeedback:""}},e._l(e.permissions,(function(a,n){return t("a-row",{key:n,attrs:{gutter:16}},[t("a-col",{attrs:{span:4}},[e._v("\n "+e._s(a.name)+":\n ")]),t("a-col",{attrs:{span:20}},[a.actionsOptions.length>0?t("a-checkbox",{attrs:{indeterminate:a.indeterminate,checked:a.checkedAll},on:{change:function(t){return e.onChangeCheckAll(t,a)}}},[e._v("\n 全选\n ")]):e._e(),t("a-checkbox-group",{attrs:{options:a.actionsOptions},on:{change:function(t){return e.onChangeCheck(a)}},model:{value:a.selected,callback:function(t){e.$set(a,"selected",t)},expression:"permission.selected"}})],1)],1)})),1)],1)],1)],1)},r=[],s=a("0fea");function o(e){try{return JSON.parse(e)}catch(t){}return[]}var i=a("88bc"),l=a.n(i),c={name:"RoleModal",data:function(){return{labelCol:{xs:{span:24},sm:{span:5}},wrapperCol:{xs:{span:24},sm:{span:16}},visible:!1,confirmLoading:!1,mdl:{},form:this.$form.createForm(this),permissions:[]}},created:function(){this.loadPermissions()},methods:{add:function(){this.edit({id:0})},edit:function(e){var t=this;if(this.mdl=Object.assign({},e),this.visible=!0,this.mdl.permissions&&this.permissions){var a={};this.mdl.permissions.forEach((function(e){a[e.permissionId]=e.actionEntitySet.map((function(e){return e.action}))})),this.permissions.forEach((function(e){e.selected=a[e.id]}))}this.$nextTick((function(){t.form.setFieldsValue(l()(t.mdl,"id","name","status","describe"))}))},close:function(){this.$emit("close"),this.visible=!1},handleOk:function(){var e=this;this.form.validateFields((function(t,a){t||(e.confirmLoading=!0,new Promise((function(e){setTimeout((function(){return e()}),2e3)})).then((function(){e.$message.success("保存成功"),e.$emit("ok")})).catch((function(){})).finally((function(){e.confirmLoading=!1,e.close()})))}))},handleCancel:function(){this.close()},onChangeCheck:function(e){e.indeterminate=!!e.selected.length&&e.selected.length0?t("a-col",{attrs:{span:20}},e._l(a.actionEntitySet,(function(a,n){return t("a-tag",{key:n,attrs:{color:"cyan"}},[e._v(e._s(a.describe))])})),1):t("a-col",{attrs:{span:20}},[e._v("-")])],1)})),1)],1)}},{key:"action",fn:function(a,n){return t("span",{},[t("a",{on:{click:function(t){return e.$refs.modal.edit(n)}}},[e._v("编辑")]),t("a-divider",{attrs:{type:"vertical"}}),t("a-dropdown",[t("a",{staticClass:"ant-dropdown-link"},[e._v("\n 更多 "),t("a-icon",{attrs:{type:"down"}})],1),t("a-menu",{attrs:{slot:"overlay"},slot:"overlay"},[t("a-menu-item",[t("a",{attrs:{href:"javascript:;"}},[e._v("详情")])]),t("a-menu-item",[t("a",{attrs:{href:"javascript:;"}},[e._v("禁用")])]),t("a-menu-item",[t("a",{attrs:{href:"javascript:;"}},[e._v("删除")])])],1)],1)],1)}}])}),t("role-modal",{ref:"modal",on:{ok:e.handleOk}})],1)},r=[],s=a("e8c4"),o=a("0b38"),i={name:"TableList",components:{STable:s["a"],RoleModal:o["default"]},data:function(){var e=this;return{description:"列表使用场景:后台管理中的权限管理以及角色管理,可用于基于 RBAC 设计的角色权限控制,颗粒度细到每一个操作类型。",visible:!1,form:null,mdl:{},advanced:!1,queryParam:{},columns:[{title:"唯一识别码",dataIndex:"id"},{title:"角色名称",dataIndex:"name"},{title:"状态",dataIndex:"status"},{title:"创建时间",dataIndex:"createTime",sorter:!0},{title:"操作",width:"150px",dataIndex:"action",scopedSlots:{customRender:"action"}}],loadData:function(t){return e.$http.get("/api/role",{params:Object.assign(t,e.queryParam)}).then((function(e){return e.result}))},selectedRowKeys:[],selectedRows:[]}},methods:{handleEdit:function(e){this.mdl=Object.assign({},e),this.mdl.permissions.forEach((function(e){e.actionsOptions=e.actionEntitySet.map((function(e){return{label:e.describe,value:e.action,defaultCheck:e.defaultCheck}}))})),this.visible=!0},handleOk:function(){this.$refs.table.refresh()},onChange:function(e,t){this.selectedRowKeys=e,this.selectedRows=t},toggleAdvanced:function(){this.advanced=!this.advanced}},watch:{}},l=i,c=a("2877"),u=Object(c["a"])(l,n,r,!1,null,null,null);t["default"]=u.exports},"88bc":function(e,t,a){(function(t){var a=1/0,n=9007199254740991,r="[object Arguments]",s="[object Function]",o="[object GeneratorFunction]",i="[object Symbol]",l="object"==typeof t&&t&&t.Object===Object&&t,c="object"==typeof self&&self&&self.Object===Object&&self,u=l||c||Function("return this")();function d(e,t,a){switch(a.length){case 0:return e.call(t);case 1:return e.call(t,a[0]);case 2:return e.call(t,a[0],a[1]);case 3:return e.call(t,a[0],a[1],a[2])}return e.apply(t,a)}function f(e,t){var a=-1,n=e?e.length:0,r=Array(n);while(++a0&&a(i)?t>1?k(i,t-1,a,n,r):m(r,i):n||(r[r.length]=i)}return r}function C(e,t){return e=Object(e),_(e,t,(function(t,a){return a in e}))}function _(e,t,a){var n=-1,r=t.length,s={};while(++n-1&&e%1==0&&e<=n}function I(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function L(e){return!!e&&"object"==typeof e}function N(e){return"symbol"==typeof e||L(e)&&v.call(e)==i}var P=O((function(e,t){return null==e?{}:C(e,f(k(t,1),j))}));e.exports=P}).call(this,a("c8ba"))}}]);