diff --git a/backend/src/main/java/io/metersphere/controller/TestCaseController.java b/backend/src/main/java/io/metersphere/controller/TestCaseController.java index 307f8f2fd7..8ff1de02c4 100644 --- a/backend/src/main/java/io/metersphere/controller/TestCaseController.java +++ b/backend/src/main/java/io/metersphere/controller/TestCaseController.java @@ -6,6 +6,8 @@ import io.metersphere.base.domain.*; import io.metersphere.commons.utils.PageUtils; import io.metersphere.commons.utils.Pager; import io.metersphere.controller.request.testcase.QueryTestCaseRequest; +import io.metersphere.controller.request.testcase.TestCaseBatchRequest; +import io.metersphere.controller.request.testcase.TestPlanCaseBatchRequest; import io.metersphere.excel.domain.ExcelResponse; import io.metersphere.service.TestCaseService; import io.metersphere.user.SessionUtils; @@ -82,5 +84,9 @@ public class TestCaseController { testCaseService.testCaseTemplateExport(response); } + @PostMapping("/batch/edit") + public void editTestCaseBath(@RequestBody TestCaseBatchRequest request){ + testCaseService.editTestCaseBath(request); + } } diff --git a/backend/src/main/java/io/metersphere/controller/TestPlanTestCaseController.java b/backend/src/main/java/io/metersphere/controller/TestPlanTestCaseController.java index d46fd3cd4d..07d0f13fdf 100644 --- a/backend/src/main/java/io/metersphere/controller/TestPlanTestCaseController.java +++ b/backend/src/main/java/io/metersphere/controller/TestPlanTestCaseController.java @@ -2,12 +2,10 @@ package io.metersphere.controller; import com.github.pagehelper.Page; import com.github.pagehelper.PageHelper; -import io.metersphere.base.domain.TestCaseWithBLOBs; import io.metersphere.base.domain.TestPlanTestCase; import io.metersphere.commons.utils.PageUtils; import io.metersphere.commons.utils.Pager; -import io.metersphere.controller.request.testcase.QueryTestCaseRequest; -import io.metersphere.controller.request.testcase.TestCaseBatchRequest; +import io.metersphere.controller.request.testcase.TestPlanCaseBatchRequest; import io.metersphere.controller.request.testplancase.QueryTestPlanCaseRequest; import io.metersphere.dto.TestPlanCaseDTO; import io.metersphere.service.TestPlanTestCaseService; @@ -40,7 +38,7 @@ public class TestPlanTestCaseController { } @PostMapping("/batch/edit") - public void editTestCaseBath(@RequestBody TestCaseBatchRequest request){ + public void editTestCaseBath(@RequestBody TestPlanCaseBatchRequest request){ testPlanTestCaseService.editTestCaseBath(request); } diff --git a/backend/src/main/java/io/metersphere/controller/request/testcase/TestCaseBatchRequest.java b/backend/src/main/java/io/metersphere/controller/request/testcase/TestCaseBatchRequest.java index 8f7caf5e39..d0e7c07690 100644 --- a/backend/src/main/java/io/metersphere/controller/request/testcase/TestCaseBatchRequest.java +++ b/backend/src/main/java/io/metersphere/controller/request/testcase/TestCaseBatchRequest.java @@ -1,19 +1,19 @@ package io.metersphere.controller.request.testcase; -import io.metersphere.base.domain.TestCase; +import io.metersphere.base.domain.TestCaseWithBLOBs; import io.metersphere.base.domain.TestPlanTestCase; import java.util.List; -public class TestCaseBatchRequest extends TestPlanTestCase { +public class TestCaseBatchRequest extends TestCaseWithBLOBs { - private List ids; + private List ids; - public List getIds() { + public List getIds() { return ids; } - public void setIds(List ids) { + public void setIds(List ids) { this.ids = ids; } } diff --git a/backend/src/main/java/io/metersphere/controller/request/testcase/TestPlanCaseBatchRequest.java b/backend/src/main/java/io/metersphere/controller/request/testcase/TestPlanCaseBatchRequest.java new file mode 100644 index 0000000000..b0e0e96165 --- /dev/null +++ b/backend/src/main/java/io/metersphere/controller/request/testcase/TestPlanCaseBatchRequest.java @@ -0,0 +1,19 @@ +package io.metersphere.controller.request.testcase; + +import io.metersphere.base.domain.TestCase; +import io.metersphere.base.domain.TestPlanTestCase; + +import java.util.List; + +public class TestPlanCaseBatchRequest extends TestPlanTestCase { + + private List ids; + + public List getIds() { + return ids; + } + + public void setIds(List ids) { + this.ids = ids; + } +} diff --git a/backend/src/main/java/io/metersphere/service/TestCaseService.java b/backend/src/main/java/io/metersphere/service/TestCaseService.java index 581f28287d..a6479b30be 100644 --- a/backend/src/main/java/io/metersphere/service/TestCaseService.java +++ b/backend/src/main/java/io/metersphere/service/TestCaseService.java @@ -1,16 +1,17 @@ package io.metersphere.service; -import com.alibaba.excel.EasyExcel; import com.alibaba.excel.EasyExcelFactory; -import com.alibaba.fastjson.JSON; import com.github.pagehelper.PageHelper; import io.metersphere.base.domain.*; import io.metersphere.base.mapper.*; import io.metersphere.base.mapper.ext.ExtTestCaseMapper; import io.metersphere.commons.exception.MSException; +import io.metersphere.commons.utils.BeanUtils; import io.metersphere.commons.utils.LogUtil; import io.metersphere.controller.request.testcase.QueryTestCaseRequest; +import io.metersphere.controller.request.testcase.TestCaseBatchRequest; +import io.metersphere.controller.request.testcase.TestPlanCaseBatchRequest; import io.metersphere.excel.domain.ExcelErrData; import io.metersphere.excel.domain.ExcelResponse; import io.metersphere.excel.domain.TestCaseExcelData; @@ -31,7 +32,6 @@ import org.springframework.web.multipart.MultipartFile; import javax.annotation.Resource; import javax.servlet.http.HttpServletResponse; import java.io.IOException; -import java.net.URLEncoder; import java.util.*; import java.util.stream.Collectors; @@ -269,4 +269,16 @@ public class TestCaseService { list.add(explain); return list; } + + public void editTestCaseBath(TestCaseBatchRequest request) { + TestCaseExample testCaseExample = new TestCaseExample(); + testCaseExample.createCriteria().andIdIn(request.getIds()); + + TestCaseWithBLOBs testCase = new TestCaseWithBLOBs(); + BeanUtils.copyBean(testCase, request); + testCaseMapper.updateByExampleSelective( + testCase, + testCaseExample); + + } } diff --git a/backend/src/main/java/io/metersphere/service/TestPlanTestCaseService.java b/backend/src/main/java/io/metersphere/service/TestPlanTestCaseService.java index 9f056b6ff2..b6733e067b 100644 --- a/backend/src/main/java/io/metersphere/service/TestPlanTestCaseService.java +++ b/backend/src/main/java/io/metersphere/service/TestPlanTestCaseService.java @@ -6,12 +6,10 @@ import io.metersphere.base.mapper.TestPlanTestCaseMapper; import io.metersphere.base.mapper.ext.ExtTestCaseMapper; import io.metersphere.commons.constants.TestPlanTestCaseStatus; import io.metersphere.commons.utils.BeanUtils; -import io.metersphere.controller.request.testcase.QueryTestCaseRequest; -import io.metersphere.controller.request.testcase.TestCaseBatchRequest; +import io.metersphere.controller.request.testcase.TestPlanCaseBatchRequest; import io.metersphere.controller.request.testplancase.QueryTestPlanCaseRequest; import io.metersphere.dto.TestPlanCaseDTO; import org.apache.commons.lang3.StringUtils; -import org.springframework.context.annotation.Bean; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -44,7 +42,7 @@ public class TestPlanTestCaseService { return testPlanTestCaseMapper.deleteByPrimaryKey(id); } - public void editTestCaseBath(TestCaseBatchRequest request) { + public void editTestCaseBath(TestPlanCaseBatchRequest request) { TestPlanTestCaseExample testPlanTestCaseExample = new TestPlanTestCaseExample(); testPlanTestCaseExample.createCriteria().andIdIn(request.getIds()); diff --git a/frontend/src/business/components/track/case/TestCase.vue b/frontend/src/business/components/track/case/TestCase.vue index 7262e7ce39..318d9fa262 100644 --- a/frontend/src/business/components/track/case/TestCase.vue +++ b/frontend/src/business/components/track/case/TestCase.vue @@ -27,6 +27,7 @@ @testCaseCopy="copyTestCase" @testCaseDetail="showTestCaseDetail" @refresh="refresh" + @moveToNode="moveToNode" ref="testCaseList"> @@ -39,6 +40,9 @@ :select-node="selectNode" ref="testCaseEditDialog"> + + + @@ -49,10 +53,11 @@ import {CURRENT_PROJECT} from '../../../../common/js/constants'; import TestCaseList from "./components/TestCaseList"; import SelectMenu from "../common/SelectMenu"; + import TestCaseMove from "./components/TestCaseMove"; export default { name: "TestCase", - components: {TestCaseList, NodeTree, TestCaseEdit, SelectMenu}, + components: {TestCaseMove, TestCaseList, NodeTree, TestCaseEdit, SelectMenu}, comments: {}, data() { return { @@ -144,7 +149,6 @@ }, editTestCase(testCase) { this.testCaseReadOnly = false; - console.log(this.selectNode); this.$refs.testCaseEditDialog.open(testCase); }, copyTestCase(testCase) { @@ -203,6 +207,14 @@ this.treeNodes = response.data; }); } + }, + moveToNode(selectIds) { + if (selectIds.size < 1) { + this.$warning(this.$t('test_track.plan_view.select_manipulate')); + return; + } + this.$refs.testCaseEditDialog.getModuleOptions(); + this.$refs.testCaseMove.open(this.$refs.testCaseEditDialog.moduleOptions, selectIds); } } } diff --git a/frontend/src/business/components/track/case/components/TestCaseEdit.vue b/frontend/src/business/components/track/case/components/TestCaseEdit.vue index 2b740a7ada..6f8d5101b7 100644 --- a/frontend/src/business/components/track/case/components/TestCaseEdit.vue +++ b/frontend/src/business/components/track/case/components/TestCaseEdit.vue @@ -242,6 +242,9 @@ type: Object } }, + mounted() { + this.getSelectOptions(); + }, methods: { open(testCase) { this.resetForm(); @@ -309,7 +312,7 @@ param.projectId = JSON.parse(localStorage.getItem(CURRENT_PROJECT)).id; } this.$post('/test/case/' + this.operationType, param, () => { - this.$message.success(this.$t('commons.save_success')); + this.$success(this.$t('commons.save_success')); this.dialogFormVisible = false; this.$emit("refresh"); }); diff --git a/frontend/src/business/components/track/case/components/TestCaseImport.vue b/frontend/src/business/components/track/case/components/TestCaseImport.vue index d659c794a6..2fafc562f7 100644 --- a/frontend/src/business/components/track/case/components/TestCaseImport.vue +++ b/frontend/src/business/components/track/case/components/TestCaseImport.vue @@ -67,23 +67,17 @@ this.init(); }, handleExceed(files, fileList) { - this.$message.warning(this.$t('test_track.case.import.upload_limit_count')); + this.$warning(this.$t('test_track.case.import.upload_limit_count')); }, UploadValidate(file) { var suffix =file.name.substring(file.name.lastIndexOf('.') + 1); if (suffix != 'xls' && suffix != 'xlsx') { - this.$message({ - message: this.$t('test_track.case.import.upload_limit_format'), - type: 'warning' - }); + this.$warning(this.$t('test_track.case.import.upload_limit_format')); return false; } if (file.size / 1024 / 1024 > 20) { - this.$message({ - message: this.$t('test_track.case.import.upload_limit_size'), - type: 'warning' - }); + this.$warning(this.$t('test_track.case.import.upload_limit_size')); return false; } return true; @@ -91,7 +85,7 @@ handleSuccess(response) { let res = response.data; if (res.success) { - this.$message.success(this.$t('test_track.case.import.success')); + this.$success(this.$t('test_track.case.import.success')); this.dialogVisible = false; this.$emit("refresh"); } else { @@ -100,7 +94,7 @@ this.fileList = []; }, handleError(err, file, fileList) { - this.$message.error(err.message); + this.$error(err.message); }, init() { this.fileList = []; diff --git a/frontend/src/business/components/track/case/components/TestCaseList.vue b/frontend/src/business/components/track/case/components/TestCaseList.vue index 8382a857f3..d6675c76a5 100644 --- a/frontend/src/business/components/track/case/components/TestCaseList.vue +++ b/frontend/src/business/components/track/case/components/TestCaseList.vue @@ -11,7 +11,7 @@ @@ -73,7 +73,8 @@ + :label="$t('commons.update_time')" + show-overflow-tooltip> @@ -213,10 +214,7 @@ let testCaseId = testCase.id; this.$post('/test/case/delete/' + testCaseId, {}, () => { this.initTableData(); - this.$message({ - message: this.$t('commons.delete_success'), - type: 'success' - }); + this.$success(this.$t('commons.delete_success')); }); }, refresh() { @@ -249,6 +247,9 @@ }, importTestCase() { this.$refs.testCaseImport.open(); + }, + moveToNode() { + this.$emit('moveToNode', this.selectIds); } } } diff --git a/frontend/src/business/components/track/case/components/TestCaseMove.vue b/frontend/src/business/components/track/case/components/TestCaseMove.vue new file mode 100644 index 0000000000..8d09f7ff1c --- /dev/null +++ b/frontend/src/business/components/track/case/components/TestCaseMove.vue @@ -0,0 +1,82 @@ + + + + + diff --git a/frontend/src/business/components/track/common/NodeEdit.vue b/frontend/src/business/components/track/common/NodeEdit.vue index 813a8bfb4a..1c0de65850 100644 --- a/frontend/src/business/components/track/common/NodeEdit.vue +++ b/frontend/src/business/components/track/common/NodeEdit.vue @@ -65,7 +65,7 @@ let param = {}; let url = this.buildParam(param); this.$post(url, param, () => { - this.$message.success(this.$t('commons.save_success')); + this.$success(this.$t('commons.save_success')); this.$emit('refresh'); this.close(); }); diff --git a/frontend/src/business/components/track/common/NodeTree.vue b/frontend/src/business/components/track/common/NodeTree.vue index 89dd1ae83a..d24d1d1491 100644 --- a/frontend/src/business/components/track/common/NodeTree.vue +++ b/frontend/src/business/components/track/common/NodeTree.vue @@ -118,7 +118,7 @@ const children = parent.data.children || parent.data; const index = children.findIndex(d => d.id === data.id); children.splice(index, 1); - this.$message.success(this.$t('commons.delete_success')); + this.$success(this.$t('commons.delete_success')); this.$emit("refresh"); }); } diff --git a/frontend/src/business/components/track/plan/components/TestPlanEdit.vue b/frontend/src/business/components/track/plan/components/TestPlanEdit.vue index 55524fd9bd..c2322c567c 100644 --- a/frontend/src/business/components/track/plan/components/TestPlanEdit.vue +++ b/frontend/src/business/components/track/plan/components/TestPlanEdit.vue @@ -151,7 +151,7 @@ Object.assign(param, this.form); param.workspaceId = localStorage.getItem(WORKSPACE_ID); this.$post('/test/plan/' + this.operationType, param, () => { - this.$message.success(this.$t('commons.save_success')); + this.$success(this.$t('commons.save_success')); this.dialogFormVisible = false; this.$emit("refresh"); }); @@ -165,10 +165,7 @@ if (response.success) { this.projects = response.data; } else { - this.$message()({ - type: 'warning', - message: response.message - }); + this.$warning()(response.message); } }); }, diff --git a/frontend/src/business/components/track/plan/components/TestPlanList.vue b/frontend/src/business/components/track/plan/components/TestPlanList.vue index db9b632f75..43ed79c494 100644 --- a/frontend/src/business/components/track/plan/components/TestPlanList.vue +++ b/frontend/src/business/components/track/plan/components/TestPlanList.vue @@ -48,13 +48,15 @@ show-overflow-tooltip> + :label="$t('commons.create_time')" + show-overflow-tooltip> + :label="$t('commons.update_time')" + show-overflow-tooltip> @@ -142,10 +144,7 @@ let testPlanId = testPlan.id; this.$post('/test/plan/delete/' + testPlanId, {}, () => { this.initTableData(); - this.$message({ - message: this.$t('commons.delete_success'), - type: 'success' - }); + this.$success(this.$t('commons.delete_success')); }); }, intoPlan(row, event, column) { diff --git a/frontend/src/business/components/track/plan/view/comonents/ExecutorEdit.vue b/frontend/src/business/components/track/plan/view/comonents/ExecutorEdit.vue index 29b1d02035..df639fd1f8 100644 --- a/frontend/src/business/components/track/plan/view/comonents/ExecutorEdit.vue +++ b/frontend/src/business/components/track/plan/view/comonents/ExecutorEdit.vue @@ -56,7 +56,7 @@ this.$post('/test/plan/case/batch/edit' , param, () => { this.executor = ''; this.selectIds.clear(); - this.$message.success(this.$t('commons.save_success')); + this.$success(this.$t('commons.save_success')); this.executorEditVisible = false; this.$emit('refresh'); }); diff --git a/frontend/src/business/components/track/plan/view/comonents/StatusEdit.vue b/frontend/src/business/components/track/plan/view/comonents/StatusEdit.vue index fb9f3f5404..2856a3da44 100644 --- a/frontend/src/business/components/track/plan/view/comonents/StatusEdit.vue +++ b/frontend/src/business/components/track/plan/view/comonents/StatusEdit.vue @@ -43,7 +43,7 @@ saveStatus() { let param = {}; if (this.status === '') { - this.$message.warning(this.$t('test_track.plan_view.select_execute_result')); + this.$warning(this.$t('test_track.plan_view.select_execute_result')); return; } param.status = this.status; @@ -51,7 +51,7 @@ this.$post('/test/plan/case/batch/edit' , param, () => { this.selectIds.clear(); this.status = ''; - this.$message.success(this.$t('commons.save_success')); + this.$success(this.$t('commons.save_success')); this.statusEditVisible = false; this.$emit('refresh'); }); diff --git a/frontend/src/business/components/track/plan/view/comonents/TestCaseRelevance.vue b/frontend/src/business/components/track/plan/view/comonents/TestCaseRelevance.vue index 3907d050ed..982f364708 100644 --- a/frontend/src/business/components/track/plan/view/comonents/TestCaseRelevance.vue +++ b/frontend/src/business/components/track/plan/view/comonents/TestCaseRelevance.vue @@ -96,7 +96,7 @@ param.testCaseIds = [...this.selectIds]; this.$post('/test/plan/relevance' , param, () => { this.selectIds.clear(); - this.$message.success("保存成功"); + this.$success("保存成功"); this.dialogFormVisible = false; this.$emit('refresh'); }); diff --git a/frontend/src/business/components/track/plan/view/comonents/TestPlanTestCaseEdit.vue b/frontend/src/business/components/track/plan/view/comonents/TestPlanTestCaseEdit.vue index 33a3b00d88..7b1ba02def 100644 --- a/frontend/src/business/components/track/plan/view/comonents/TestPlanTestCaseEdit.vue +++ b/frontend/src/business/components/track/plan/view/comonents/TestPlanTestCaseEdit.vue @@ -216,7 +216,7 @@ return; } this.$refs.drawer.closeDrawer(); - this.$message.success(this.$t('commons.save_success')); + this.$success(this.$t('commons.save_success')); this.$emit('refresh'); }); }, 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 5444a9a4c8..3f28270253 100644 --- a/frontend/src/business/components/track/plan/view/comonents/TestPlanTestCaseList.vue +++ b/frontend/src/business/components/track/plan/view/comonents/TestPlanTestCaseList.vue @@ -29,7 +29,8 @@ + :label="$t('commons.name')" + show-overflow-tooltip> + :label="$t('commons.update_time')" + show-overflow-tooltip> @@ -230,10 +232,7 @@ let testCaseId = testCase.id; this.$post('/test/plan/case/delete/' + testCaseId, {}, () => { this.$emit("refresh"); - this.$message({ - message: this.$t('commons.delete_success'), - type: 'success' - }); + this.$success(this.$t('commons.delete_success')); }); }, handleSelectAll(selection) { @@ -254,7 +253,7 @@ }, handleBatch(type){ if (this.selectIds.size < 1) { - this.$message.warning(this.$t('test_track.plan_view.select_manipulate')); + this.$warning(this.$t('test_track.plan_view.select_manipulate')); return; } if (type === 'executor'){ diff --git a/frontend/src/i18n/en-US.js b/frontend/src/i18n/en-US.js index ed8b306484..02f6b7a3ff 100644 --- a/frontend/src/i18n/en-US.js +++ b/frontend/src/i18n/en-US.js @@ -185,10 +185,11 @@ export default { recent_plan: "Recent plan", recent_case: "Recent case", case: { - test_case: "Test Case", + test_case: "Test case", + move: "Move case", case_list: "Test Case List", create_case: "Create Case", - eitd_case: "Eidt Case", + edit_case: "Edit Case", no_project: "There is no project in this workspace, please create the project first", priority: "Priority", type: "Type", diff --git a/frontend/src/i18n/zh-CN.js b/frontend/src/i18n/zh-CN.js index 889731ee5b..895c2efb75 100644 --- a/frontend/src/i18n/zh-CN.js +++ b/frontend/src/i18n/zh-CN.js @@ -231,6 +231,7 @@ export default { recent_case: "最近的用例", case: { test_case: "测试用例", + move: "移动用例", case_list: "用例列表", create_case: "创建用例", edit_case: "编辑用例",