feat: support update post status in batch.

pull/59/head
ruibaby 2019-12-12 13:53:06 +08:00
parent 4296e998f0
commit 115379bcb9
2 changed files with 16 additions and 8 deletions

View File

@ -58,6 +58,17 @@ postApi.updateStatus = (postId, status) => {
})
}
postApi.updateStatusInBatch = (ids, status) => {
return service({
url: `${baseUrl}/status`,
data: {
ids: ids,
status: status
},
method: 'put'
})
}
postApi.delete = postId => {
return service({
url: `${baseUrl}/${postId}`,

View File

@ -727,14 +727,11 @@ export default {
this.$message.success('请至少选择一项!')
return
}
for (let index = 0; index < this.selectedRowKeys.length; index++) {
const element = this.selectedRowKeys[index]
postApi.updateStatus(element, status).then(response => {
this.$log.debug(`postId: ${element}, status: ${status}`)
this.selectedRowKeys = []
this.loadPosts()
})
}
postApi.updateStatusInBatch(this.selectedRowKeys, status).then(response => {
this.$log.debug(`postId: ${this.selectedRowKeys}, status: ${status}`)
this.selectedRowKeys = []
this.loadPosts()
})
},
handleDeleteMore() {
if (this.selectedRowKeys.length <= 0) {