From 4dd4b4c8d2fa2ec0721c7eef1d67f89dfc28015e Mon Sep 17 00:00:00 2001 From: zhangdahai112 Date: Sun, 16 Jan 2022 02:20:38 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=B5=8B=E8=AF=95=E8=B7=9F=E8=B8=AA):=20?= =?UTF-8?q?=E5=A4=8D=E5=88=B6=E5=8A=9F=E8=83=BD=E7=94=A8=E4=BE=8B=E5=8F=AA?= =?UTF-8?q?=E5=A4=8D=E5=88=B6=E5=BD=93=E5=89=8D=E7=89=88=E6=9C=AC=EF=BC=88?= =?UTF-8?q?=E6=B2=A1=E5=81=9A=E5=85=B6=E4=BB=96=E4=BF=A1=E6=81=AF=E7=9A=84?= =?UTF-8?q?=E5=A4=8D=E5=88=B6=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../io/metersphere/track/controller/TestCaseController.java | 1 - .../components/track/case/components/TestCaseEdit.vue | 4 +++- .../components/track/case/components/TestCaseList.vue | 5 +++++ 3 files changed, 8 insertions(+), 2 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 c24796449b..901f5506f4 100644 --- a/backend/src/main/java/io/metersphere/track/controller/TestCaseController.java +++ b/backend/src/main/java/io/metersphere/track/controller/TestCaseController.java @@ -210,7 +210,6 @@ public class TestCaseController { @SendNotice(taskType = NoticeConstants.TaskType.TRACK_TEST_CASE_TASK, targetClass = TestCaseMapper.class, event = NoticeConstants.Event.CREATE, mailTemplate = "track/TestCaseCreate", subject = "测试用例通知") public TestCase addTestCase(@RequestPart("request") EditTestCaseRequest request, @RequestPart(value = "file", required = false) List files) { - request.setId(UUID.randomUUID().toString()); return testCaseService.save(request, files); } diff --git a/frontend/src/business/components/track/case/components/TestCaseEdit.vue b/frontend/src/business/components/track/case/components/TestCaseEdit.vue index 263b12736c..dd0322b507 100644 --- a/frontend/src/business/components/track/case/components/TestCaseEdit.vue +++ b/frontend/src/business/components/track/case/components/TestCaseEdit.vue @@ -624,7 +624,9 @@ export default { if (callback) { callback(); } - this.getComments(this.currentTestCaseInfo); + if (this.type !== 'copy') { + this.getComments(this.currentTestCaseInfo); + } }, handlePre() { this.index--; diff --git a/frontend/src/business/components/track/case/components/TestCaseList.vue b/frontend/src/business/components/track/case/components/TestCaseList.vue index 7303d4f380..a4bcbd6a16 100644 --- a/frontend/src/business/components/track/case/components/TestCaseList.vue +++ b/frontend/src/business/components/track/case/components/TestCaseList.vue @@ -275,6 +275,7 @@ import TestCasePreview from "@/business/components/track/case/components/TestCas import {editTestCaseOrder} from "@/network/testCase"; import {getGraphByCondition} from "@/network/graph"; import MsTableAdvSearchBar from "@/business/components/common/components/search/MsTableAdvSearchBar"; +import {getUUID} from "@/common/js/utils"; const requireComponent = require.context('@/business/components/xpack/', true, /\.vue$/); const relationshipGraphDrawer = requireComponent.keys().length > 0 ? requireComponent("./graph/RelationshipGraphDrawer.vue") : {}; @@ -856,6 +857,10 @@ export default { this.$get('test/case/get/' + testCase.id, response => { let testCase = response.data; testCase.name = 'copy_' + testCase.name; + //复制的时候只复制当前版本 + testCase.id = getUUID(); + testCase.refId = null; + testCase.versionId = null; this.$emit('testCaseCopy', testCase); }); },