diff --git a/src/api/comment.js b/src/api/comment.js index 60a40351..7a577107 100644 --- a/src/api/comment.js +++ b/src/api/comment.js @@ -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`, diff --git a/src/views/comment/components/CommentTab.vue b/src/views/comment/components/CommentTab.vue index 952ff11c..22d4ef3e 100644 --- a/src/views/comment/components/CommentTab.vue +++ b/src/views/comment/components/CommentTab.vue @@ -12,7 +12,10 @@ :sm="24" > - + { - 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 = []