From a4ab4e238b114a45a24dce0be68fc12c4f6c76a8 Mon Sep 17 00:00:00 2001 From: chenjianxing Date: Sat, 16 May 2020 15:06:24 +0800 Subject: [PATCH] =?UTF-8?q?=E6=89=B9=E9=87=8F=E5=88=A0=E9=99=A4=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=E7=94=A8=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../track/controller/TestCaseController.java | 5 +++ .../track/service/TestCaseService.java | 6 ++++ .../track/case/components/TestCaseList.vue | 31 ++++++++++++++++--- frontend/src/i18n/en-US.js | 2 +- frontend/src/i18n/zh-CN.js | 2 +- 5 files changed, 40 insertions(+), 6 deletions(-) diff --git a/backend/src/main/java/io/metersphere/track/controller/TestCaseController.java b/backend/src/main/java/io/metersphere/track/controller/TestCaseController.java index 678394850a..f7d4854159 100644 --- a/backend/src/main/java/io/metersphere/track/controller/TestCaseController.java +++ b/backend/src/main/java/io/metersphere/track/controller/TestCaseController.java @@ -91,4 +91,9 @@ public class TestCaseController { testCaseService.editTestCaseBath(request); } + @PostMapping("/batch/delete") + public void deleteTestCaseBath(@RequestBody TestCaseBatchRequest request){ + testCaseService.deleteTestCaseBath(request); + } + } diff --git a/backend/src/main/java/io/metersphere/track/service/TestCaseService.java b/backend/src/main/java/io/metersphere/track/service/TestCaseService.java index abdf2d252c..2353b857ef 100644 --- a/backend/src/main/java/io/metersphere/track/service/TestCaseService.java +++ b/backend/src/main/java/io/metersphere/track/service/TestCaseService.java @@ -273,4 +273,10 @@ public class TestCaseService { testCaseExample); } + + public void deleteTestCaseBath(TestCaseBatchRequest request) { + TestCaseExample example = new TestCaseExample(); + example.createCriteria().andIdIn(request.getIds()); + testCaseMapper.deleteByExample(example); + } } diff --git a/frontend/src/business/components/track/case/components/TestCaseList.vue b/frontend/src/business/components/track/case/components/TestCaseList.vue index d94e33773e..079b4ee9f8 100644 --- a/frontend/src/business/components/track/case/components/TestCaseList.vue +++ b/frontend/src/business/components/track/case/components/TestCaseList.vue @@ -11,7 +11,8 @@ @@ -204,7 +205,7 @@ this.$emit('testCaseCopy', testCase); }, handleDelete(testCase) { - this.$alert(this.$t('test_track.case.delete_confirm') + testCase.name + "?", '', { + this.$alert(this.$t('test_track.case.delete_confirm') + '\'' + testCase.name + '\'' + "?", '', { confirmButtonText: this.$t('commons.confirm'), callback: (action) => { if (action === 'confirm') { @@ -213,6 +214,20 @@ } }); }, + handleDeleteBatch() { + this.$alert(this.$t('test_track.case.delete_confirm') + "?", '', { + confirmButtonText: this.$t('commons.confirm'), + callback: (action) => { + if (action === 'confirm') { + this.$post('/test/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/case/delete/' + testCaseId, {}, () => { @@ -247,8 +262,16 @@ importTestCase() { this.$refs.testCaseImport.open(); }, - moveToNode() { - this.$emit('moveToNode', this.selectIds); + handleBatch(type){ + if (this.selectIds.size < 1) { + this.$warning(this.$t('test_track.plan_view.select_manipulate')); + return; + } + if (type === 'move'){ + this.$emit('moveToNode', this.selectIds); + } else if (type === 'delete'){ + this.handleDeleteBatch(); + } }, filter(filters) { _filter(filters, this.condition); diff --git a/frontend/src/i18n/en-US.js b/frontend/src/i18n/en-US.js index 09924bb9f5..74fc4bb5d4 100644 --- a/frontend/src/i18n/en-US.js +++ b/frontend/src/i18n/en-US.js @@ -332,7 +332,7 @@ export default { input_type: "Please select type", input_method: "Please select method", input_prerequisite: "Please select prerequisite", - delete_confirm: "Confirm delete test case: ", + delete_confirm: "Confirm delete test case", import: { import: "Import test case", case_import: "Import test case", diff --git a/frontend/src/i18n/zh-CN.js b/frontend/src/i18n/zh-CN.js index be9761be13..e90304ee2c 100644 --- a/frontend/src/i18n/zh-CN.js +++ b/frontend/src/i18n/zh-CN.js @@ -332,7 +332,7 @@ export default { input_type: "请选择用例类型", input_method: "请选择测试方式", input_prerequisite: "请输入前置条件", - delete_confirm: "确认删除测试用例: ", + delete_confirm: "确认删除测试用例", import: { import: "导入用例", case_import: "导入测试用例",