From df3f4ad784b09ee00f2549aa5b216808fe180fa0 Mon Sep 17 00:00:00 2001 From: chenjianxing Date: Sat, 16 May 2020 14:52:42 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B5=8B=E8=AF=95=E8=AE=A1=E5=88=92-=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=E7=94=A8=E4=BE=8B=E6=89=B9=E9=87=8F=E5=88=A0=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/TestPlanTestCaseController.java | 5 +++++ .../track/service/TestPlanTestCaseService.java | 6 ++++++ .../view/comonents/TestPlanTestCaseList.vue | 17 +++++++++++++++++ 3 files changed, 28 insertions(+) diff --git a/backend/src/main/java/io/metersphere/track/controller/TestPlanTestCaseController.java b/backend/src/main/java/io/metersphere/track/controller/TestPlanTestCaseController.java index c3710d73ee..ae059aadce 100644 --- a/backend/src/main/java/io/metersphere/track/controller/TestPlanTestCaseController.java +++ b/backend/src/main/java/io/metersphere/track/controller/TestPlanTestCaseController.java @@ -58,6 +58,11 @@ public class TestPlanTestCaseController { testPlanTestCaseService.editTestCaseBath(request); } + @PostMapping("/batch/delete") + public void deleteTestCaseBath(@RequestBody TestPlanCaseBatchRequest request){ + testPlanTestCaseService.deleteTestCaseBath(request); + } + @PostMapping("/delete/{id}") public int deleteTestCase(@PathVariable String id){ return testPlanTestCaseService.deleteTestCase(id); diff --git a/backend/src/main/java/io/metersphere/track/service/TestPlanTestCaseService.java b/backend/src/main/java/io/metersphere/track/service/TestPlanTestCaseService.java index 3de8b19187..09dcbac6bb 100644 --- a/backend/src/main/java/io/metersphere/track/service/TestPlanTestCaseService.java +++ b/backend/src/main/java/io/metersphere/track/service/TestPlanTestCaseService.java @@ -113,4 +113,10 @@ public class TestPlanTestCaseService { request.setId(caseId); return extTestPlanTestCaseMapper.list(request).get(0); } + + public void deleteTestCaseBath(TestPlanCaseBatchRequest request) { + TestPlanTestCaseExample example = new TestPlanTestCaseExample(); + example.createCriteria().andIdIn(request.getIds()); + testPlanTestCaseMapper.deleteByExample(example); + } } diff --git a/frontend/src/business/components/track/plan/view/comonents/TestPlanTestCaseList.vue b/frontend/src/business/components/track/plan/view/comonents/TestPlanTestCaseList.vue index da22379c28..b9b9e4f8b3 100644 --- a/frontend/src/business/components/track/plan/view/comonents/TestPlanTestCaseList.vue +++ b/frontend/src/business/components/track/plan/view/comonents/TestPlanTestCaseList.vue @@ -10,6 +10,7 @@ + @@ -261,6 +262,20 @@ } }); }, + handleDeleteBatch() { + this.$alert(this.$t('test_track.plan_view.confirm_cancel_relevance') + " ?", '', { + confirmButtonText: this.$t('commons.confirm'), + callback: (action) => { + if (action === 'confirm') { + this.$post('/test/plan/case/batch/delete', {ids: [...this.selectIds]}, () => { + this.selectIds.clear(); + this.$emit("refresh"); + this.$success(this.$t('commons.delete_success')); + }); + } + } + }); + }, _handleDelete(testCase) { let testCaseId = testCase.id; this.$post('/test/plan/case/delete/' + testCaseId, {}, () => { @@ -293,6 +308,8 @@ this.$refs.executorEdit.openExecutorEdit(); } else if (type === 'status'){ this.$refs.statusEdit.openStatusEdit(); + } else if (type === 'delete') { + this.handleDeleteBatch(); } }, searchMyTestCase() {