|
|
|
@ -82,7 +82,7 @@
|
|
|
|
|
> |
|
|
|
|
<a |
|
|
|
|
href="javascript:void(0);" |
|
|
|
|
@click="handleDeleteMore" |
|
|
|
|
@click="handlePublishMore" |
|
|
|
|
> |
|
|
|
|
<span>发布</span> |
|
|
|
|
</a> |
|
|
|
@ -229,28 +229,7 @@
|
|
|
|
|
<script> |
|
|
|
|
import categoryApi from '@/api/category' |
|
|
|
|
import postApi from '@/api/post' |
|
|
|
|
|
|
|
|
|
export default { |
|
|
|
|
name: 'PostList', |
|
|
|
|
components: {}, |
|
|
|
|
data() { |
|
|
|
|
return { |
|
|
|
|
postStatus: postApi.postStatus, |
|
|
|
|
pagination: { |
|
|
|
|
current: 1, |
|
|
|
|
pageSize: 10, |
|
|
|
|
sort: null |
|
|
|
|
}, |
|
|
|
|
queryParam: { |
|
|
|
|
page: 0, |
|
|
|
|
size: 10, |
|
|
|
|
sort: null, |
|
|
|
|
keyword: null, |
|
|
|
|
categoryId: null, |
|
|
|
|
status: null |
|
|
|
|
}, |
|
|
|
|
// 表头 |
|
|
|
|
columns: [ |
|
|
|
|
const columns = [ |
|
|
|
|
{ |
|
|
|
|
title: '标题', |
|
|
|
|
dataIndex: 'title', |
|
|
|
@ -290,7 +269,28 @@ export default {
|
|
|
|
|
width: '150px', |
|
|
|
|
scopedSlots: { customRender: 'action' } |
|
|
|
|
} |
|
|
|
|
], |
|
|
|
|
] |
|
|
|
|
export default { |
|
|
|
|
name: 'PostList', |
|
|
|
|
components: {}, |
|
|
|
|
data() { |
|
|
|
|
return { |
|
|
|
|
postStatus: postApi.postStatus, |
|
|
|
|
pagination: { |
|
|
|
|
current: 1, |
|
|
|
|
pageSize: 10, |
|
|
|
|
sort: null |
|
|
|
|
}, |
|
|
|
|
queryParam: { |
|
|
|
|
page: 0, |
|
|
|
|
size: 10, |
|
|
|
|
sort: null, |
|
|
|
|
keyword: null, |
|
|
|
|
categoryId: null, |
|
|
|
|
status: null |
|
|
|
|
}, |
|
|
|
|
// 表头 |
|
|
|
|
columns, |
|
|
|
|
selectedRowKeys: [], |
|
|
|
|
selectedRows: [], |
|
|
|
|
categories: [], |
|
|
|
@ -365,22 +365,54 @@ export default {
|
|
|
|
|
this.loadPosts() |
|
|
|
|
}) |
|
|
|
|
}, |
|
|
|
|
handleDeleteClick(postId) { |
|
|
|
|
postApi.delete(postId).then(response => { |
|
|
|
|
this.$message.success('删除成功!') |
|
|
|
|
this.loadPosts() |
|
|
|
|
}) |
|
|
|
|
}, |
|
|
|
|
handlePublishMore() { |
|
|
|
|
if (this.selectedRowKeys.length <= 0) { |
|
|
|
|
this.$message.success('请至少选择一项!') |
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|
for (let index = 0; index < this.selectedRowKeys.length; index++) { |
|
|
|
|
const element = this.selectedRowKeys[index] |
|
|
|
|
postApi.updateStatus(element, 'PUBLISHED').then(response => { |
|
|
|
|
this.$log.debug(`postId: ${element}, status: PUBLISHED`) |
|
|
|
|
this.selectedRowKeys = [] |
|
|
|
|
this.loadPosts() |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
handleRecycleMore() { |
|
|
|
|
if (this.selectedRowKeys.length <= 0) { |
|
|
|
|
this.$message.success('请至少选择一项!') |
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|
for (let index = 0; index < this.selectedRowKeys.length; index++) { |
|
|
|
|
const element = this.selectedRowKeys[index] |
|
|
|
|
postApi.updateStatus(element, 'RECYCLE').then(response => { |
|
|
|
|
this.$log.debug(`postId: ${element}, status: RECYCLE`) |
|
|
|
|
this.selectedRowKeys = [] |
|
|
|
|
this.loadPosts() |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
handleDeleteMore() { |
|
|
|
|
if (this.selectedRowKeys.length <= 0) { |
|
|
|
|
this.$message.success('请至少选择一项!') |
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
handleDeleteClick(postId) { |
|
|
|
|
postApi.delete(postId).then(response => { |
|
|
|
|
this.$message.success('删除成功!') |
|
|
|
|
for (let index = 0; index < this.selectedRowKeys.length; index++) { |
|
|
|
|
const element = this.selectedRowKeys[index] |
|
|
|
|
postApi.delete(element).then(response => { |
|
|
|
|
this.$log.debug(`delete: ${element}`) |
|
|
|
|
this.selectedRowKeys = [] |
|
|
|
|
this.loadPosts() |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
</script> |
|
|
|
|