text: (window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-40a6910d"],{"3d18":function(e,t,a){"use strict";a.r(t);var n=function(){var e=this,t=e.$createElement,a=e._self._c||t;return a("content-component",[a("edit-component",{attrs:{slot:"header",configs:e.editConfig,datas:e.datas},on:{submit:e.fetchData},slot:"header"}),a("list-component",{directives:[{name:"loading",rawName:"v-loading",value:e.isLoading,expression:"isLoading"}],attrs:{configs:e.tagConfig,datas:e.datas,border:""}},[a("el-table-column",{attrs:{fixed:"right",label:"操作"},scopedSlots:e._u([{key:"default",fn:function(t){var n=t.row;return[a("edit-component",{attrs:{isEdit:"",datas:e.datas,configs:e.editConfig,editId:n._id,data:n},on:{submit:e.fetchData}}),a("el-button",{attrs:{slot:"reference",type:"danger",size:"small"},on:{click:function(t){return e.delCategories(n)}},slot:"reference"},[e._v("删除")])]}}])})],1),a("div",{staticStyle:{"text-align":"center"},attrs:{slot:"footer"},slot:"footer"},[a("el-pagination",{attrs:{"current-page":e.page,"page-size":e.limit,"page-sizes":[5,10,30,50],layout:"total, prev, sizes, pager, next, jumper",total:e.total},on:{"size-change":e.handleLimitChange,"current-change":e.handlePageChange}})],1)],1)},r=[],s=a("5530"),i=(a("96cf"),a("1da1")),o=a("8bc5"),c=a("5c96"),u=a("94a1"),d=function(){var e=this,t=e.$createElement,a=e._self._c||t;return a("edit-component",e._b({attrs:{isResetParams:"",data:e.data,configs:e.editConfig,btnText:e.setTitle},on:{submit:e.submit}},"edit-component",e.$attrs,!1))},g=[],l=(a("a9e3"),a("93b6")),p={components:{EditComponent:l["a"]},props:{data:{type:Object},isEdit:{type:Boolean,default:!1},editId:{type:[Number,String]},configs:{type:Array,default:function(){return[]}},datas:{type:Array,default:function(){return[]}}},computed:{defaultValue:function(){return!0},setData:function(){return!1},editConfig:function(){return this.configs},setTitle:function(){return this.isEdit?"编辑":"新建分类"}},methods:{submit:function(e){this.isEdit?this.editCategories(e):this.addCategories(e)},addCategories:function(e){var t=this;return Object(i["a"])(regeneratorRuntime.mark((function a(){var n,r;return regeneratorRuntime.wrap((function(a){while(1)switch(a.prev=a.next){case 0:return a.next=2,o["a"].addCategories(Object(s["a"])({},e.params));case 2:n=a.sent,r=n.data,0===r.code?(Object(c["Message"])({message:r.message||"添加成功",type:"success"}),t.$emit("submit"),e.callback()):Object(c["Message"])({message:r.message||"添加失败",type:"error"});case 5:case"end":return a.stop()}}),a)})))()},editCategories:function(e){var t=this;return Object(i["a"])(regeneratorRuntime.mark((function a(){var n,r;return regeneratorRuntime.wrap((function(a){while(1)switch(a.prev=a.next){case 0:return a.next=2,o["a"].editCategories(t.editId,Object(s["a"])({},e.params));case 2:n=a.sent,r=n.data,0===r.code?(Object(c["Message"])({message:r.message||"修改成功",type:"success"}),t.$emit("submit")):Object(c["Message"])({message:r.message||"修改失败",type:"error"}),e.callback();case 6:case"end":return a.stop()}}),a)})))()}}},m=p,f=a("2877"),h=Object(f["a"])(m,d,g,!1,null,null,null),b=h.exports,v=a("f54e"),w=a("1afd"),C=a("b572"),y=new C["a"]({prop:"name",label:"分类名称",width:"120",type:"input",required:!0}),j=new C["a"]({prop:"desc",label:"分类描述",width:"300",type:"input"}),x=new C["a"]({prop:"updatedAt",label:"修改日期"}),O=new C["a"]({prop:"createdAt",label:"创建日期"}),k=new C["b"]([y,j,x,O]).clone(),E=new C["b"]([y,j]).clone(),R={mixins:[w["a"]],components:{ContentComponent:u["a"],EditComponent:b,ListComponent:v["a"]},props:{id:{}},data:function(){return{editConfig:E.getFields(),tagConfig:k.getFields()}},mounted:function(){this.fetchData()},methods:{getDatas:function(){var e=this;return Object(i["a"])(regeneratorRuntime.mark((function t(){var a;return regeneratorRuntime.wrap((function(t){while(1)switch(t.prev=t.next){case 0:return a={limit:e.limit,page:e.page},t.next=3,o["a"].getCategories(a);case 3:return t.abrupt("return",t.sent);case 4:case"end":return t.stop()}}),t)})))()},handleEdit:function(e){this.editItem=Object(s["a"])({},e),this.showDialog=!0},delCategories:function(e){var t=this;this.$confirm("确认删除该分类吗？").then(Object(i["a"])(regeneratorRuntime.mark((function a(){var n,r;return regeneratorRuntime.wrap((function(a){while(1)switch(a.prev=a.next){case 0:return a.next=2,o["a"].delCategories(e._id);case 2:n=a.sent,r=n.data,0===r.code?(Object(c["Message"])({message:r.message||"删除成功",type:"success"}),t.fetchData()):Object(c["Message"])({message:r.message||"删除失败",type:"error"});case 5:case"end":return a.stop()}}),a)})))).catch((function(){}))}}},_=R,D=Object(f["a"])(_,n,r,!1,null,"0a95b9e9",null);t["default"]=D.exports},"8bc5":function(e,t,a){"use strict";var n=a("751a"),r=function(e){arguments.length>1&&void 0!==arguments[1]&&arguments[1];return n["a"].request({url:"/admin/categories",method:"post",data:e})},s=function(e,t){var a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return n["a"].request({url:"/admin/categories/".concat(e),method:"put",data:t,config:a})},i=function(e){arguments.length>1&&void 0!==arguments[1]&&arguments[1];return n["a"].request({url:"/admin/categories",method:"get",params:e})},o=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return n["a"].request({url:"/admin/categories/".concat(e),method:"delete",config:t})};t["a"]={getCategories:i,addCategories:r,editCategories:s,delCategories:o}}}]);