12 |
- (window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-64c4234b"],{"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}})},"2e4b":function(e,t,n){"use strict";var r=n("3519"),a=n.n(r);a.a},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},3519:function(e,t,n){},"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},"469f":function(e,t,n){n("6c1c"),n("1654"),e.exports=n("7d7b")},"5d73":function(e,t,n){e.exports=n("469f")},"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},"768b":function(e,t,n){"use strict";var r=n("a745"),a=n.n(r);function i(e){if(a()(e))return e}var o=n("5d73"),s=n.n(o);function c(e,t){var n=[],r=!0,a=!1,i=void 0;try{for(var o,c=s()(e);!(r=(o=c.next()).done);r=!0)if(n.push(o.value),t&&n.length===t)break}catch(u){a=!0,i=u}finally{try{r||null==c["return"]||c["return"]()}finally{if(a)throw i}}return n}function u(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}function l(e,t){return i(e)||c(e,t)||u()}n.d(t,"a",function(){return l})},"7d7b":function(e,t,n){var r=n("e4ae"),a=n("7cd6");e.exports=n("584a").getIterator=function(e){var t=a(e);if("function"!=typeof t)throw TypeError(e+" is not iterable!");return r(t.call(e))}},"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},"82d9":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-permissions/create"}},[e._t("default",[e._v("添加权限")])],2)],1)],1),n("el-table",{attrs:{data:e.perms,resource:"admin-permissions"}},[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(e){var t=e.row;return[n("route-show",{attrs:{data:t}})]}}])}),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("8cdd"),s=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",e._l(e.httpRoute,function(t,r){return n("div",{key:r,staticClass:"mb-1"},[e._l(t.method,function(t){return n("el-tag",{key:t,staticClass:"mr-1"},[e._v("\n "+e._s(t)+"\n ")])}),n("code",[e._v(e._s("/admin-api"+t.path))])],2)}),0)},c=[],u=(n("28a5"),n("768b")),l={name:"RouteShow",props:{data:Object},computed:{httpRoute:function(){var e=this,t=this.data.http_path;return t?t.map(function(t){var n=e.data.http_method,r=t;if(-1!==t.indexOf(":")){var a=t.split(":"),i=Object(u["a"])(a,2);n=i[0],r=i[1],n=n.split(",").filter(function(e){return!!e})}return 0===n.length&&(n=["ANY"]),{method:n,path:r}}):[]}}},f=l,d=n("2877"),p=Object(d["a"])(f,s,c,!1,null,null,null),h=p.exports,m=n("81df"),b=n("69d9"),g=n("3107"),v=n("3c1b"),y=n("c3c6"),w=n("873a"),_={name:"Index",components:{RowToEdit:v["a"],RowDestroy:g["a"],SearchForm:b["a"],Pagination:m["a"],RouteShow:h,ButtonLink:y["a"]},data:function(){return{perms:[],page:null,searchForm:{},first_blood:!0,search:[{field:"id",label:"ID"},{field:"name",label:"名称"},{field:"slug",label:"标识"},{field:"http_path",label:"请求路径"}]}},mixins:[w["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(o["b"])(t.query);case 4:n=e.sent,r=n.data,a=r.data,i=r.meta,this.perms=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}}},k=_,x=(n("2e4b"),Object(d["a"])(k,r,a,!1,null,null,null));t["default"]=x.exports},"8cdd":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-permissions",{params:e})}function i(e){return r["b"].post("admin-permissions",e)}function o(e,t){return r["b"].put("admin-permissions/".concat(e),t)}function s(e){return r["b"].get("admin-permissions/".concat(e,"/edit"))}},"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}}]);
- //# sourceMappingURL=chunk-64c4234b.918c59bd.js.map
|