(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-87e2df70"],{c405:function(t,e,a){"use strict";a("3a23"),a("612f");var n=a("9efd"),s="/api/admin/categories",o={};function r(t,e){e.forEach(function(e){t.key===e.parentId&&(t.children||(t.children=[]),t.children.push({key:e.id,title:e.name,isLeaf:!1}))}),t.children?t.children.forEach(function(t){return r(t,e)}):t.isLeaf=!0}o.listAll=function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return Object(n["a"])({url:"".concat(s),params:{more:t},method:"get"})},o.listTree=function(){return Object(n["a"])({url:"".concat(s,"/tree_view"),method:"get"})},o.create=function(t){return Object(n["a"])({url:s,data:t,method:"post"})},o.delete=function(t){return Object(n["a"])({url:"".concat(s,"/").concat(t),method:"delete"})},o.get=function(t){return Object(n["a"])({url:"".concat(s,"/").concat(t),method:"get"})},o.update=function(t,e){return Object(n["a"])({url:"".concat(s,"/").concat(t),data:e,method:"put"})},o.concreteTree=function(t){var e={key:0,title:"top",children:[]};return r(e,t),e.children},e["a"]=o},caf6:function(t,e,a){"use strict";var n=a("9efd"),s="/api/admin/posts",o={listLatest:function(t){return Object(n["a"])({url:"".concat(s,"/latest"),params:{top:t},method:"get"})},query:function(t){return Object(n["a"])({url:s,params:t,method:"get"})},get:function(t){return Object(n["a"])({url:"".concat(s,"/").concat(t),method:"get"})},create:function(t){return Object(n["a"])({url:s,method:"post",data:t})},update:function(t,e){return Object(n["a"])({url:"".concat(s,"/").concat(t),method:"put",data:e})},updateStatus:function(t,e){return Object(n["a"])({url:"".concat(s,"/").concat(t,"/status/").concat(e),method:"put"})},delete:function(t){return Object(n["a"])({url:"".concat(s,"/").concat(t),method:"delete"})},postStatus:{PUBLISHED:{color:"green",status:"success",text:"已发布"},DRAFT:{color:"yellow",status:"warning",text:"草稿"},RECYCLE:{color:"red",status:"error",text:"回收站"}}};e["a"]=o},dae2:function(t,e,a){"use strict";a.r(e);var n=function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("div",{staticClass:"page-header-index-wide"},[a("a-card",{attrs:{bordered:!1}},[a("div",{staticClass:"table-page-search-wrapper"},[a("a-form",{attrs:{layout:"inline"}},[a("a-row",{attrs:{gutter:48}},[a("a-col",{attrs:{md:6,sm:24}},[a("a-form-item",{attrs:{label:"关键词"}},[a("a-input",{model:{value:t.queryParam.keyword,callback:function(e){t.$set(t.queryParam,"keyword",e)},expression:"queryParam.keyword"}})],1)],1),a("a-col",{attrs:{md:6,sm:24}},[a("a-form-item",{attrs:{label:"文章状态"}},[a("a-select",{attrs:{placeholder:"请选择文章状态"},on:{change:t.handleQuery},model:{value:t.queryParam.status,callback:function(e){t.$set(t.queryParam,"status",e)},expression:"queryParam.status"}},t._l(Object.keys(t.postStatus),function(e){return a("a-select-option",{key:e,attrs:{value:e}},[t._v(t._s(t.postStatus[e].text))])}),1)],1)],1),a("a-col",{attrs:{md:6,sm:24}},[a("a-form-item",{attrs:{label:"分类目录"}},[a("a-select",{attrs:{placeholder:"请选择分类"},on:{change:t.handleQuery},model:{value:t.queryParam.categoryId,callback:function(e){t.$set(t.queryParam,"categoryId",e)},expression:"queryParam.categoryId"}},t._l(t.categories,function(e){return a("a-select-option",{key:e.id},[t._v(t._s(e.name))])}),1)],1)],1),a("a-col",{attrs:{md:6,sm:24}},[a("span",{staticClass:"table-page-search-submitButtons"},[a("a-button",{attrs:{type:"primary"},on:{click:t.handleQuery}},[t._v("查询")]),a("a-button",{staticStyle:{"margin-left":"8px"},on:{click:t.handleResetParam}},[t._v("重置")])],1)])],1)],1)],1),a("div",{staticClass:"table-operator"},[a("router-link",{attrs:{to:{name:"PostEdit"}}},[a("a-button",{attrs:{type:"primary",icon:"plus"}},[t._v("写文章")])],1),a("a-dropdown",{directives:[{name:"show",rawName:"v-show",value:null!=t.queryParam.status&&""!=t.queryParam.status,expression:"queryParam.status!=null && queryParam.status!=''"}]},[a("a-menu",{attrs:{slot:"overlay"},slot:"overlay"},["DRAFT"===t.queryParam.status?a("a-menu-item",{key:"1"},[a("a",{attrs:{href:"javascript:void(0);"},on:{click:t.handleDeleteMore}},[a("span",[t._v("发布")])])]):t._e(),"PUBLISHED"===t.queryParam.status||"DRAFT"===t.queryParam.status?a("a-menu-item",{key:"2"},[a("a",{attrs:{href:"javascript:void(0);"},on:{click:t.handleRecycleMore}},[a("span",[t._v("移到回收站")])])]):t._e(),"RECYCLE"===t.queryParam.status?a("a-menu-item",{key:"3"},[a("a",{attrs:{href:"javascript:void(0);"},on:{click:t.handleDeleteMore}},[a("span",[t._v("永久删除")])])]):t._e()],1),a("a-button",{staticStyle:{"margin-left":"8px"}},[t._v("\n 批量操作\n "),a("a-icon",{attrs:{type:"down"}})],1)],1)],1),a("div",{staticStyle:{"margin-top":"15px"}},[a("a-table",{attrs:{rowKey:function(t){return t.id},rowSelection:{onChange:t.onSelectionChange,getCheckboxProps:t.getCheckboxProps},columns:t.columns,dataSource:t.formattedPosts,loading:t.postsLoading,pagination:!1},scopedSlots:t._u([{key:"postTitle",fn:function(e){return a("ellipsis",{attrs:{length:25,tooltip:""}},[t._v(t._s(e))])}},{key:"status",fn:function(e){return a("span",{},[a("a-badge",{attrs:{status:e.status}}),t._v("\n "+t._s(e.text)+"\n ")],1)}},{key:"categories",fn:function(e){return a("span",{},t._l(e,function(e,n){return a("a-tag",{key:n,attrs:{color:"blue"}},[t._v(t._s(e.name))])}),1)}},{key:"tags",fn:function(e){return a("span",{},t._l(e,function(e,n){return a("a-tag",{key:n,attrs:{color:"green"}},[t._v(t._s(e.name))])}),1)}},{key:"updateTime",fn:function(e){return a("span",{},[t._v(t._s(t._f("timeAgo")(e)))])}},{key:"action",fn:function(e,n){return a("span",{},["PUBLISHED"===n.status||"DRAFT"===n.status?a("a",{attrs:{href:"javascript:;"},on:{click:function(e){return t.handleEditClick(n)}}},[t._v("编辑")]):"RECYCLE"===n.status?a("a-popconfirm",{attrs:{title:"你确定要发布【"+n.title+"】文章?",okText:"确定",cancelText:"取消"},on:{confirm:function(e){return t.handleEditStatusClick(n.id,"PUBLISHED")}}},[a("a",{attrs:{href:"javascript:;"}},[t._v("还原")])]):t._e(),a("a-divider",{attrs:{type:"vertical"}}),"PUBLISHED"===n.status||"DRAFT"===n.status?a("a-popconfirm",{attrs:{title:"你确定要将【"+n.title+"】文章移到回收站?",okText:"确定",cancelText:"取消"},on:{confirm:function(e){return t.handleEditStatusClick(n.id,"RECYCLE")}}},[a("a",{attrs:{href:"javascript:;"}},[t._v("回收站")])]):"RECYCLE"===n.status?a("a-popconfirm",{attrs:{title:"你确定要永久删除【"+n.title+"】文章?",okText:"确定",cancelText:"取消"},on:{confirm:function(e){return t.handleDeleteClick(n.id)}}},[a("a",{attrs:{href:"javascript:;"}},[t._v("删除")])]):t._e()],1)}}])}),a("div",{staticClass:"page-wrapper"},[a("a-pagination",{staticClass:"pagination",attrs:{total:t.pagination.total,pageSizeOptions:["1","2","5","10","20","50","100"],showSizeChanger:""},on:{showSizeChange:t.handlePaginationChange,change:t.handlePaginationChange}})],1)],1)])],1)},s=[],o=(a("ab56"),a("c405")),r=a("caf6"),i={name:"PostList",components:{},data:function(){return{postStatus:r["a"].postStatus,pagination:{current:1,pageSize:10,sort:null},queryParam:{page:0,size:10,sort:null,keyword:null,categoryId:null,status:null},columns:[{title:"标题",dataIndex:"title",scopedSlots:{customRender:"postTitle"}},{title:"状态",className:"status",dataIndex:"statusProperty",scopedSlots:{customRender:"status"}},{title:"分类目录",dataIndex:"categories",scopedSlots:{customRender:"categories"}},{title:"标签",dataIndex:"tags",scopedSlots:{customRender:"tags"}},{title:"评论量",dataIndex:"commentCount"},{title:"访问量",dataIndex:"visits"},{title:"更新时间",dataIndex:"updateTime",scopedSlots:{customRender:"updateTime"}},{title:"操作",width:"150px",scopedSlots:{customRender:"action"}}],selectedRowKeys:[],selectedRows:[],categories:[],posts:[],postsLoading:!1}},computed:{formattedPosts:function(){var t=this;return this.posts.map(function(e){return e.statusProperty=t.postStatus[e.status],e})}},created:function(){this.loadCategories(),this.loadPosts()},methods:{loadPosts:function(){var t=this;this.postsLoading=!0,this.queryParam.page=this.pagination.current-1,this.queryParam.size=this.pagination.pageSize,this.queryParam.sort=this.pagination.sort,r["a"].query(this.queryParam).then(function(e){t.posts=e.data.data.content,t.pagination.total=e.data.data.total,t.postsLoading=!1})},loadCategories:function(){var t=this;o["a"].listAll().then(function(e){t.categories=e.data.data})},handleEditClick:function(t){this.$router.push({name:"PostEdit",query:{postId:t.id}})},onSelectionChange:function(t){this.selectedRowKeys=t,this.$log.debug("SelectedRowKeys: ".concat(t))},getCheckboxProps:function(t){return{props:{disabled:"RECYCLE"===t.status,name:t.title}}},handlePaginationChange:function(t,e){this.$log.debug("Current: ".concat(t,", PageSize: ").concat(e)),this.pagination.current=t,this.pagination.pageSize=e,this.loadPosts()},handleResetParam:function(){this.queryParam.keyword=null,this.queryParam.categoryId=null,this.queryParam.status=null,this.loadPosts()},handleQuery:function(){this.queryParam.page=0,this.loadPosts()},handleEditStatusClick:function(t,e){var a=this;r["a"].updateStatus(t,e).then(function(t){a.$message.success("操作成功!"),a.loadPosts()})},handleRecycleMore:function(){this.selectedRowKeys.length<=0&&this.$message.success("请至少选择一项!")},handleDeleteMore:function(){this.selectedRowKeys.length<=0&&this.$message.success("请至少选择一项!")},handleDeleteClick:function(t){var e=this;r["a"].delete(t).then(function(t){e.$message.success("删除成功!"),e.loadPosts()})}}},c=i,u=a("17cc"),l=Object(u["a"])(c,n,s,!1,null,null,null);e["default"]=l.exports}}]);