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 => {
|
postApi.delete = postId => {
|
||||||
return service({
|
return service({
|
||||||
url: `${baseUrl}/${postId}`,
|
url: `${baseUrl}/${postId}`,
|
||||||
|
|
|
@ -727,14 +727,11 @@ export default {
|
||||||
this.$message.success('请至少选择一项!')
|
this.$message.success('请至少选择一项!')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
for (let index = 0; index < this.selectedRowKeys.length; index++) {
|
postApi.updateStatusInBatch(this.selectedRowKeys, status).then(response => {
|
||||||
const element = this.selectedRowKeys[index]
|
this.$log.debug(`postId: ${this.selectedRowKeys}, status: ${status}`)
|
||||||
postApi.updateStatus(element, status).then(response => {
|
this.selectedRowKeys = []
|
||||||
this.$log.debug(`postId: ${element}, status: ${status}`)
|
this.loadPosts()
|
||||||
this.selectedRowKeys = []
|
})
|
||||||
this.loadPosts()
|
|
||||||
})
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
handleDeleteMore() {
|
handleDeleteMore() {
|
||||||
if (this.selectedRowKeys.length <= 0) {
|
if (this.selectedRowKeys.length <= 0) {
|
||||||
|
|
Loading…
Reference in New Issue