12 |
- (window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-5a2a6a56"],{"0fb6":function(e,t,n){},"15b5":function(e,t,n){"use strict";var r=n("5f54"),a=n.n(r);a.a},"1c4c":function(e,t,n){"use strict";var r=n("9b43"),a=n("5ca1"),i=n("4bf8"),o=n("1fa8"),s=n("33a4"),c=n("9def"),u=n("f1ae"),l=n("27ee");a(a.S+a.F*!n("5cc5")(function(e){Array.from(e)}),"Array",{from:function(e){var t,n,a,f,d=i(e),p="function"==typeof this?this:Array,h=arguments.length,m=h>1?arguments[1]:void 0,b=void 0!==m,g=0,v=l(d);if(b&&(m=r(m,h>2?arguments[2]:void 0,2)),void 0==v||p==Array&&s(v))for(t=c(d.length),n=new p(t);t>g;g++)u(n,g,b?m(d[g],g):d[g]);else for(f=v.call(d),n=new p;!(a=f.next()).done;g++)u(n,g,b?o(f,m,[a.value,g],!0):a.value);return n.length=g,n}})},3107: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("bd0b"),s=n("bf9a"),c=n("873a"),u=n("91a0"),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,d=n("2877"),p=Object(d["a"])(f,r,a,!1,null,null,null);t["a"]=p.exports},"3c1b":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("c3c6"),o=n("91a0"),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},"421a":function(e,t,n){},"4b88":function(e,t,n){"use strict";var r=n("421a"),a=n.n(r);a.a},"5f54":function(e,t,n){},"69d9":function(e,t,n){"use strict";n("8e6e"),n("456d"),n("7f7f"),n("ac6a");var r=n("bd86");function a(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 i(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?a(n,!0).forEach(function(t){Object(r["a"])(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):a(n).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var o,s,c={name:"SearchForm",data:function(){return{form:{},show:!0}},props:{fields:Array,resetCurrentPage:{type:Boolean,default:!0}},created:function(){this.initFormShow()},methods:{onSubmit:function(){var e=this,t=i({},this.$route.query);this.resetCurrentPage&&delete t.page,this.fields.forEach(function(n){var r=n.field,a=e.form[r];"string"===typeof a&&(a=a.trim()),""===a||void 0===a?delete t[r]:(t[r]=a,"time_between"===r&&(t[r]=null==a?a:[a[0],a[1]]))}),this.$router.push({path:this.$route.path,query:t})},dateFormat:function(e){var t=e.getFullYear()+"-"+this.p(e.getMonth()+1)+"-"+this.p(e.getDate()),n=this.p(e.getHours())+":"+this.p(e.getMinutes())+":"+this.p(e.getSeconds());return t+n},p:function(e){return e<10?"0"+e:e},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)})},toggleShow:function(){this.show=!this.show},getOffsetHeight:function(){var e=document.getElementById("div-searchForm"),t=e.clientWidth||e.offsetWidth;this.formHeight=t}},watch:{$route:{handler:function(){this.setFormValueFromQuery()},immediate:!0}},render:function(e){var t=this;return e("el-collapse-transition",[e("div",{directives:[{name:"show",value:this.show}]},[e("el-form",{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",{style:"width:150px;",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){return e("el-option",{key:t.value||t.id,attrs:{label:t.label||t.name,value:String(t.value||t.id)}})})]);break;case"time-between":r=e("el-date-picker",{attrs:{type:"datetimerange","value-format":"yyyy-MM-dd HH:mm:ss","start-placeholder":n.label1,"end-placeholder":n.label2},model:{value:t.form[n.field],callback:function(e){t.$set(t.form,n.field,e)}}});break;case"super-input":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)}}});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}},["重置"])])])])])}},u=c,l=(n("cafd"),n("2877")),f=Object(l["a"])(u,o,s,!1,null,"6dd66826",null);t["a"]=f.exports},"72a6":function(e,t,n){"use strict";n.d(t,"b",function(){return a}),n.d(t,"c",function(){return i}),n.d(t,"d",function(){return o}),n.d(t,"a",function(){return s});var r=n("bf9a");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"))}},"81df":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:10}},props:{page:Object,layout:{type:String,default:"total, prev, pager, next, sizes, jumper"},autoPush:{type:Boolean,default:!0}},computed:{pageSizes:function(){var e=[10,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,"f691fd2e",null);t["a"]=c.exports},"91a0":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 ] 属性"))}}}},bd0b: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("15b5"),n("2877")),u=Object(c["a"])(s,r,a,!1,null,"f59b5a72",null);t["a"]=u.exports},cafd:function(e,t,n){"use strict";var r=n("0fb6"),a=n.n(r);a.a},ccb1: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("div",{staticClass:"header-button"},[n("search-form",{ref:"searchForm",attrs:{fields:e.search}}),n("div",{staticClass:"selections"},[n("button-link",{attrs:{type:"success",to:"/admin-roles/create"}},[e._t("default",[e._v("添加角色")])],2)],1)],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("69d9"),s=n("72a6"),c=n("81df"),u=n("3107"),l=n("3c1b"),f=n("c3c6"),d=n("873a"),p={name:"Index",components:{RowToEdit:l["a"],RowDestroy:u["a"],SearchForm:o["a"],Pagination:c["a"],ButtonLink:f["a"]},data:function(){return{search:[{field:"id",label:"ID"},{field:"name",label:"名称"},{field:"slug",label:"标识"},{field:"permission_name",label:"权限"}],roles:[],page:null,first_blood:!0}},mixins:[d["m"]],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,this.autoPageSize(53,t);case 2:return e.next=4,Object(s["b"])(t.query);case 4:n=e.sent,r=n.data,a=r.data,i=r.meta,this.roles=a,this.page=i;case 10:case"end":return e.stop()}},e,this)}));function t(t){return e.apply(this,arguments)}return t}(),immediate:!0}}},h=p,m=(n("4b88"),n("2877")),b=Object(m["a"])(h,r,a,!1,null,null,null);t["default"]=b.exports}}]);
- //# sourceMappingURL=chunk-5a2a6a56.6b0429ab.js.map
|