feat: support delete in batch for comment.

pull/59/head
ruibaby 2019-12-12 13:27:02 +08:00
parent ac6e6b5ea7
commit 4296e998f0
2 changed files with 17 additions and 9 deletions

View File

@ -45,6 +45,14 @@ commentApi.delete = (target, commentId) => {
})
}
commentApi.deleteInBatch = (target, ids) => {
return service({
url: `${baseUrl}/${target}/comments`,
data: ids,
method: 'delete'
})
}
commentApi.create = (target, comment) => {
return service({
url: `${baseUrl}/${target}/comments`,

View File

@ -12,7 +12,10 @@
:sm="24"
>
<a-form-item label="关键词">
<a-input v-model="queryParam.keyword" @keyup.enter="handleQuery()"/>
<a-input
v-model="queryParam.keyword"
@keyup.enter="handleQuery()"
/>
</a-form-item>
</a-col>
<a-col
@ -662,14 +665,11 @@ export default {
this.$message.success('请至少选择一项!')
return
}
for (let index = 0; index < this.selectedRowKeys.length; index++) {
const element = this.selectedRowKeys[index]
commentApi.delete(this.type, element).then(response => {
this.$log.debug(`delete: ${element}`)
this.selectedRowKeys = []
this.loadComments()
})
}
commentApi.deleteInBatch(this.type, this.selectedRowKeys).then(response => {
this.$log.debug(`delete: ${this.selectedRowKeys}`)
this.selectedRowKeys = []
this.loadComments()
})
},
handleClearRowKeys() {
this.selectedRowKeys = []