mirror of https://github.com/halo-dev/halo-admin
feat: support update post status in batch.
parent
4296e998f0
commit
115379bcb9
|
@ -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}`,
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Reference in New Issue