From 2f8d0e91632aa0eae238a4f89dbfceec818418c3 Mon Sep 17 00:00:00 2001 From: shiziyuan9527 Date: Fri, 8 Jan 2021 14:20:04 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E6=B5=8B=E8=AF=95=E8=AE=A1=E5=88=92):=20?= =?UTF-8?q?=E6=89=B9=E9=87=8F=E5=8F=96=E6=B6=88=E6=80=A7=E8=83=BD=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=E7=94=A8=E4=BE=8B=E5=85=B3=E8=81=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/TestPlanLoadCaseController.java | 5 +++++ .../track/service/TestPlanLoadCaseService.java | 9 +++++++++ .../view/comonents/load/TestPlanLoadCaseList.vue | 16 ++++++++++++++-- 3 files changed, 28 insertions(+), 2 deletions(-) diff --git a/backend/src/main/java/io/metersphere/track/controller/TestPlanLoadCaseController.java b/backend/src/main/java/io/metersphere/track/controller/TestPlanLoadCaseController.java index 28dc2ee23b..ab1730626c 100644 --- a/backend/src/main/java/io/metersphere/track/controller/TestPlanLoadCaseController.java +++ b/backend/src/main/java/io/metersphere/track/controller/TestPlanLoadCaseController.java @@ -52,4 +52,9 @@ public class TestPlanLoadCaseController { public Boolean isExistReport(@RequestBody LoadCaseReportRequest request) { return testPlanLoadCaseService.isExistReport(request); } + + @PostMapping("/batch/delete") + public void batchDelete(@RequestBody List ids) { + testPlanLoadCaseService.batchDelete(ids); + } } diff --git a/backend/src/main/java/io/metersphere/track/service/TestPlanLoadCaseService.java b/backend/src/main/java/io/metersphere/track/service/TestPlanLoadCaseService.java index 28fbb8df29..f300203be7 100644 --- a/backend/src/main/java/io/metersphere/track/service/TestPlanLoadCaseService.java +++ b/backend/src/main/java/io/metersphere/track/service/TestPlanLoadCaseService.java @@ -113,4 +113,13 @@ public class TestPlanLoadCaseService { } testPlanLoadCaseMapper.deleteByExample(testPlanLoadCaseExample); } + + public void batchDelete(List ids) { + if (CollectionUtils.isEmpty(ids)) { + return; + } + TestPlanLoadCaseExample example = new TestPlanLoadCaseExample(); + example.createCriteria().andIdIn(ids); + testPlanLoadCaseMapper.deleteByExample(example); + } } diff --git a/frontend/src/business/components/track/plan/view/comonents/load/TestPlanLoadCaseList.vue b/frontend/src/business/components/track/plan/view/comonents/load/TestPlanLoadCaseList.vue index b2d52f5de1..b099b6095a 100644 --- a/frontend/src/business/components/track/plan/view/comonents/load/TestPlanLoadCaseList.vue +++ b/frontend/src/business/components/track/plan/view/comonents/load/TestPlanLoadCaseList.vue @@ -205,7 +205,19 @@ export default { // // }, handleDeleteBatch() { - + this.$alert(this.$t('test_track.plan_view.confirm_cancel_relevance') + "?", '', { + confirmButtonText: this.$t('commons.confirm'), + callback: (action) => { + if (action === 'confirm') { + let ids = Array.from(this.selectRows).map(row => row.id); + this.result = this.$post('/test/plan/load/case/batch/delete', ids, () => { + this.selectRows.clear(); + this.initTable(); + this.$success(this.$t('test_track.cancel_relevance_success')); + }); + } + } + }) }, handleRunBatch() { @@ -221,7 +233,7 @@ export default { }) }, handleDelete(loadCase) { - this.$get('/test/plan/load/case/delete/' + loadCase.id, () => { + this.result = this.$get('/test/plan/load/case/delete/' + loadCase.id, () => { this.$success(this.$t('test_track.cancel_relevance_success')); this.$emit('refresh'); this.initTable();