text: (window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-ff5a332e"],{"0240":function(e,t,n){"use strict";var r=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("button-link",{attrs:{size:"small",to:e.link}},[e._t("default",[e._v("编辑")])],2)},a=[],i=n("76ab"),o=n("1614"),s={name:"RowToEdit",components:{ButtonLink:i["a"]},mixins:[o["a"]],data:function(){return{identify:void 0}},computed:{link:function(){return this.checkResourceName(),"/".concat(this.resource,"/").concat(this.identify,"/edit")}},mounted:function(){this.setIdentify()}},c=s,u=n("2877"),l=Object(u["a"])(c,r,a,!1,null,null,null);t["a"]=l.exports},"07e1":function(e,t,n){"use strict";var r=n("f42a"),a=n.n(r);a.a},1614:function(e,t,n){"use strict";n("7f7f"),n("5df3"),n("1c4c"),n("c5f6");t["a"]={inject:{elTable:{default:""}},data:function(){return{identify:void 0}},props:{resource:{type:String,default:function(){return this.elTable&&this.elTable.resource}},data:{type:Array,default:function(){return this.elTable&&this.elTable.data}},index:[Number,String],rowKey:{type:String,default:function(){return this.elTable&&this.elTable.rowKey}}},methods:{getIndex:function(){if(void 0!==this.index)return this.index;if(this.elTable){var e=this.findTr();if(e){var t=Array.from(this.elTable.$el.querySelectorAll(".el-table__body tr")).indexOf(e);return-1===t?void 0:t}}},findTr:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.$el;if(e){var t=e.tagName.toLowerCase();return"tr"===t?e:"tbody"===t?void 0:this.findTr(e.parentNode)}},setIdentify:function(){if(void 0===this.identify){var e=this.getIndex();this.identify=this.data[e][this.rowKey]}},checkResourceName:function(){if(!this.resource)throw new Error("必须在 [ 表格 ] 或者 [ ".concat(this.$options.name," ] 中，传入 [ resource ] 属性"))}}}},1799:function(e,t,n){"use strict";var r=function(){var e=this,t=e.$createElement,n=e._self._c||t;return e.page?n("el-pagination",e._b({ref:"page",attrs:{"page-sizes":e.pageSizes,"current-page":e.currentPage,"page-size":e.perPage,total:e.page.total,layout:e.layout,background:""},on:{"size-change":e.onSizeChange,"current-change":e.onChange,"update:currentPage":function(t){e.currentPage=t},"update:current-page":function(t){e.currentPage=t},"update:pageSize":function(t){e.perPage=t},"update:page-size":function(t){e.perPage=t}}},"el-pagination",e.$attrs,!1)):e._e()},a=[],i={name:"Pagination",data:function(){return{currentPage:1,perPage:15}},props:{page:Object,layout:{type:String,default:"total, prev, pager, next, sizes, jumper"},autoPush:{type:Boolean,default:!0}},computed:{pageSizes:function(){var e=[15,30,50,100,200],t=this.page.per_page;return-1===e.indexOf(t)?[this.page.per_page].concat(e):e}},methods:{push:function(){var e=Object.assign({},this.$route.query,{page:this.currentPage,per_page:this.perPage});this.$router.push({path:this.$route.path,query:e})},onSizeChange:function(e){this.$emit("size-change",e),this.autoPush&&(this.currentPage=1,this.push())},onChange:function(e){this.$emit("current-change",e),this.autoPush&&this.push()}},watch:{page:{handler:function(e){var t=this;e&&(this.currentPage=e.current_page,this.perPage=e.per_page,this.$nextTick((function(){t.$refs.page.internalCurrentPage=e.current_page})))},immediate:!0}}},o=i,s=n("2877"),c=Object(s["a"])(o,r,a,!1,null,"0d3103cd",null);t["a"]=c.exports},"38db":function(e,t,n){"use strict";n("8e6e"),n("456d"),n("7f7f"),n("ac6a");var r=n("bd86"),a=(n("96cf"),n("3b8d"));function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function o(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?i(n,!0).forEach((function(t){Object(r["a"])(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):i(n).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var s,c,u={name:"SearchForm",data:function(){return{form:{},show:!1}},computed:{anyQuery:function(){var e=this;return this.fields.some((function(t){if(e.$route.query[t.field])return!0}))}},props:{fields:Array,resetCurrentPage:{type:Boolean,default:!0}},created:function(){this.initFormShow()},methods:{onSubmit:function(){var e=Object(a["a"])(regeneratorRuntime.mark((function e(){var t,n=this;return regeneratorRuntime.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return t=o({},this.$route.query),this.resetCurrentPage&&delete t.page,this.fields.forEach((function(e){var r=e.field,a=n.form[r];"string"===typeof a&&(a=a.trim()),""===a||void 0===a?delete t[r]:t[r]=a})),e.prev=3,e.next=6,this.$router.push({path:this.$route.path,query:t});case 6:e.next=12;break;case 8:if(e.prev=8,e.t0=e["catch"](3),"NavigationDuplicated"===e.t0.name){e.next=12;break}throw e.t0;case 12:case"end":return e.stop()}}),e,this,[[3,8]])})));function t(){return e.apply(this,arguments)}return t}(),onReset:function(){this.form={},this.onSubmit()},initFormShow:function(){var e=this;this.fields.some((function(t){if(e.$route.query[t.field])return e.show=!0,!0}))},setFormValueFromQuery:function(){var e=this,t=this.$route.query;this.fields.forEach((function(n){var r=n.field,a=t[r];e.$set(e.form,r,a)}))}},watch:{$route:{handler:function(){this.setFormValueFromQuery()},immediate:!0}},render:function(e){var t=this;return e("el-button",{attrs:{type:this.anyQuery?"primary":""},class:"search-button"},[e("el-popover",{attrs:{placement:"bottom-start",trigger:"click","popper-class":"search-form-popover"}},[e("el-form",{class:"pb-3",attrs:{inline:!0},nativeOn:{keydown:function(e){return"button"in e||!t._k(e.keyCode,"enter",13,e.key,"Enter")?(e.preventDefault(),t.onSubmit(e)):null}}},[this.fields.map((function(n){var r;switch(n.type){case"el-select":r=e("el-select",{attrs:{placeholder:n.label,filterable:!0,clearable:!0},model:{value:t.form[n.field],callback:function(e){t.$set(t.form,n.field,e)}}},[n.options.map((function(t){var r=n.valueField||"id",a=n.labelField||"name";return e("el-option",{key:t[r],attrs:{label:t[a],value:String(t[r])}})}))]);break;default:r=e("el-input",{attrs:{placeholder:n.label,clearable:!0},model:{value:t.form[n.field],callback:function(e){t.$set(t.form,n.field,e)}}})}return e("el-form-item",{key:n.field},[r])})),e("el-form-item",{class:"actions"},[e("el-button",{attrs:{type:"primary"},on:{click:this.onSubmit}},["查询"]),e("el-button",{on:{click:this.onReset}},["重置"])])]),e("span",{class:"trigger",slot:"reference"})]),"筛选"])}},l=u,f=(n("8b21"),n("07e1"),n("2877")),p=Object(f["a"])(l,s,c,!1,null,"68604f9a",null);t["a"]=p.exports},"6ae0":function(e,t,n){},"6bea":function(e,t,n){"use strict";n.r(t);var r=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("el-card",{scopedSlots:e._u([{key:"header",fn:function(){return[n("content-header")]},proxy:!0}])},[n("el-button-group",{staticClass:"mb-3"},[n("search-form",{attrs:{fields:e.search}})],1),n("el-table",{attrs:{data:e.roles,resource:"admin-roles"}},[n("el-table-column",{attrs:{prop:"id",label:"ID",width:"60"}}),n("el-table-column",{attrs:{prop:"name",label:"名称",width:"150"}}),n("el-table-column",{attrs:{prop:"slug",label:"标识",width:"150"}}),n("el-table-column",{attrs:{label:"权限","min-width":"400"},scopedSlots:e._u([{key:"default",fn:function(t){var r=t.row;return e._l(r.permissions,(function(t){return n("el-tag",{key:t.id,staticClass:"mr-1"},[e._v("\n          "+e._s(t.name)+"\n        ")])}))}}])}),n("el-table-column",{attrs:{prop:"created_at",label:"添加时间",width:"180"}}),n("el-table-column",{attrs:{prop:"updated_at",label:"修改时间",width:"180"}}),n("el-table-column",{attrs:{label:"操作",width:"150"},scopedSlots:e._u([{key:"default",fn:function(e){e.row,e.$index;return[n("el-button-group",[n("row-to-edit"),n("row-destroy")],1)]}}])})],1),n("div",{staticClass:"card-footer"},[n("pagination",{attrs:{page:e.page}})],1)],1)},a=[],i=(n("96cf"),n("3b8d")),o=n("38db"),s=n("fff0"),c=n("1799"),u=n("d3fc"),l=n("0240"),f={name:"Index",components:{RowToEdit:l["a"],RowDestroy:u["a"],SearchForm:o["a"],Pagination:c["a"]},data:function(){return{search:[{field:"id",label:"ID"},{field:"name",label:"名称"},{field:"slug",label:"标识"},{field:"permission_name",label:"权限"}],roles:[],page:null}},watch:{$route:{handler:function(){var e=Object(i["a"])(regeneratorRuntime.mark((function e(t){var n,r,a,i;return regeneratorRuntime.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,Object(s["c"])(t.query);case 2:n=e.sent,r=n.data,a=r.data,i=r.meta,this.roles=a,this.page=i;case 8:case"end":return e.stop()}}),e,this)})));function t(t){return e.apply(this,arguments)}return t}(),immediate:!0}}},p=f,d=n("2877"),h=Object(d["a"])(p,r,a,!1,null,null,null);t["default"]=h.exports},"6fc0":function(e,t,n){"use strict";var r=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n(e.comp,e._b({tag:"component",staticClass:"pop-confirm",attrs:{type:e.type,disabled:e.disabled}},"component",e.$attrs,!1),[n("el-popover",{attrs:{placement:"top",width:"160",disabled:e.disabled},model:{value:e.visible,callback:function(t){e.visible=t},expression:"visible"}},[n("p",[e._v(e._s(e.notice))]),n("div",{staticStyle:{"text-align":"right",margin:"0"}},[n("el-button",{attrs:{size:"mini"},on:{click:e.onCancel}},[e._v("取消")]),n("loading-action",{attrs:{type:e.confirmType,size:"mini",action:e.action,disabled:e.disabled}},[e._v("\n        确定\n      ")])],1),n("span",{staticClass:"trigger",attrs:{slot:"reference"},slot:"reference"})]),e._t("default")],2)},a=[],i=(n("96cf"),n("3b8d")),o={name:"PopConfirm",data:function(){return{visible:!1}},props:{notice:{type:String,default:"确认操作？"},confirmType:{type:String,default:"primary"},confirm:Function,type:String,disabled:Boolean,comp:{type:String,default:"el-button"}},methods:{onCancel:function(){this.visible=!1,this.$emit("cancel")},action:function(){var e=Object(i["a"])(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){while(1)switch(e.prev=e.next){case 0:if(!this.disabled){e.next=2;break}return e.abrupt("return");case 2:return e.next=4,this.confirm();case 4:this.visible=!1;case 5:case"end":return e.stop()}}),e,this)})));function t(){return e.apply(this,arguments)}return t}()}},s=o,c=(n("7868"),n("2877")),u=Object(c["a"])(s,r,a,!1,null,"f5b0dac6",null);t["a"]=u.exports},7868:function(e,t,n){"use strict";var r=n("6ae0"),a=n.n(r);a.a},"8b21":function(e,t,n){"use strict";var r=n("a299"),a=n.n(r);a.a},a299:function(e,t,n){},d3fc:function(e,t,n){"use strict";var r=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("pop-confirm",e._b({attrs:{type:"danger",confirm:e.onConfirm,size:"small"}},"pop-confirm",e.$attrs,!1),[e._t("default",[e._v("删除")])],2)},a=[],i=(n("96cf"),n("3b8d")),o=n("6fc0"),s=n("ff66"),c=n("90fe"),u=n("1614"),l={name:"RowDestroy",components:{PopConfirm:o["a"]},mixins:[u["a"]],methods:{onConfirm:function(){var e=Object(i["a"])(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return this.checkResourceName(),this.setIdentify(),e.next=4,s["b"].delete("".concat(this.resource,"/").concat(this.identify));case 4:this.data.splice(this.getIndex(),1),this.$message.success(Object(c["h"])("destroyed"));case 6:case"end":return e.stop()}}),e,this)})));function t(){return e.apply(this,arguments)}return t}()}},f=l,p=n("2877"),d=Object(p["a"])(f,r,a,!1,null,null,null);t["a"]=d.exports},f42a:function(e,t,n){},fff0:function(e,t,n){"use strict";n.d(t,"c",(function(){return a})),n.d(t,"d",(function(){return i})),n.d(t,"e",(function(){return o})),n.d(t,"b",(function(){return s})),n.d(t,"a",(function(){return c}));var r=n("ff66");function a(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return r["b"].get("admin-roles",{params:e})}function i(e){return r["b"].post("admin-roles",e)}function o(e,t){return r["b"].put("admin-roles/".concat(e),t)}function s(e){return r["b"].get("admin-roles/".concat(e,"/edit"))}function c(){return r["b"].get("admin-roles/create")}}}]);
  //# sourceMappingURL=chunk-ff5a332e.e346573b.js.map