From f1761fa7ec647445ac8ac6555c2041e8a2ec5325 Mon Sep 17 00:00:00 2001 From: chenjianxing Date: Tue, 21 Feb 2023 11:34:31 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=B5=8B=E8=AF=95=E8=B7=9F=E8=B8=AA):=20?= =?UTF-8?q?=E7=94=A8=E4=BE=8B=E7=89=88=E6=9C=AC=E7=BD=AE=E6=96=B0=E6=8C=89?= =?UTF-8?q?=E9=92=AE=E6=98=BE=E7=A4=BA=E6=9D=A1=E4=BB=B6=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1023466 --user=陈建星 【测试跟踪】功能用例-编辑-版本-点击置新-提示信息后版本显示一直转圈 https://www.tapd.cn/55049933/s/1339220 --- .../business/case/components/TestCaseEdit.vue | 18 +++++-- .../VersionCreateOtherInfoSelect.vue | 51 ++----------------- .../components/common/CaseVersionHistory.vue | 21 ++++++-- 3 files changed, 35 insertions(+), 55 deletions(-) diff --git a/test-track/frontend/src/business/case/components/TestCaseEdit.vue b/test-track/frontend/src/business/case/components/TestCaseEdit.vue index 712cfed5c7..f56b8fe4f6 100644 --- a/test-track/frontend/src/business/case/components/TestCaseEdit.vue +++ b/test-track/frontend/src/business/case/components/TestCaseEdit.vue @@ -563,7 +563,8 @@ export default { // 2 表示式保存并创建 // 3 表示 saveType: 1, - projectId: null + projectId: null, + createVersionId: null }; }, props: { @@ -1152,6 +1153,11 @@ export default { this.$emit("refresh", response.data); if (this.form.id) { this.$emit("caseEdit", param); + if (this.createVersionId) { + // 如果是创建版本,创建完跳转到对应的版本 + this.createVersionId = null; + this.routerToEdit(response.data.id); + } } else { param.id = response.data.id; this.close(); @@ -1162,9 +1168,11 @@ export default { this.routerToEdit(response.data.id); } } + this.createVersionId = null; }) .catch(() => { this.loading = false; + this.createVersionId = null; }); } }, @@ -1218,6 +1226,9 @@ export default { param.unRelateFileMetaIds = this.$refs.otherInfo.getUnRelateFiles(); } } + if (this.createVersionId) { + param.versionId = this.createVersionId; + } return param; }, parseOldFields(param) { @@ -1484,12 +1495,12 @@ export default { async createVersion(row) { if (this.validateForm()) { // 创建新版本 - this.form.versionId = row.id; let hasOtherInfo = await this.hasOtherInfo(); if (hasOtherInfo) { this.$refs.versionHistory.loading = false; - this.$refs.selectPropDialog.open(); + this.$refs.selectPropDialog.open(row.id); } else { + this.createVersionId = row.id; this.saveCase(() => { if (this.$refs.versionHistory) { this.$refs.versionHistory.loading = false; @@ -1547,6 +1558,7 @@ export default { }, confirmOtherInfo(selectedOtherInfo) { this.selectedOtherInfo = selectedOtherInfo; + this.createVersionId = selectedOtherInfo.versionId; this.saveCase(); }, copyRow() { diff --git a/test-track/frontend/src/business/case/components/VersionCreateOtherInfoSelect.vue b/test-track/frontend/src/business/case/components/VersionCreateOtherInfoSelect.vue index 0afd27f6c3..fd6c3b1cce 100644 --- a/test-track/frontend/src/business/case/components/VersionCreateOtherInfoSelect.vue +++ b/test-track/frontend/src/business/case/components/VersionCreateOtherInfoSelect.vue @@ -54,53 +54,6 @@ - - {{ $t("commons.cancel") }} @@ -124,12 +77,14 @@ export default { relateIssue: false, archive: false, dependency: false, + versionId: null }, }; }, methods: { - open() { + open(versionId) { this.visible = true; + this.form.versionId = versionId; }, close() { this.visible = false; diff --git a/test-track/frontend/src/business/case/components/common/CaseVersionHistory.vue b/test-track/frontend/src/business/case/components/common/CaseVersionHistory.vue index fe58855733..48c00de1e9 100644 --- a/test-track/frontend/src/business/case/components/common/CaseVersionHistory.vue +++ b/test-track/frontend/src/business/case/components/common/CaseVersionHistory.vue @@ -39,8 +39,7 @@
{{ $t("case.set_new") }}
@@ -172,7 +171,8 @@ export default { versionCompareOptions: [], userData: {}, currentVersion: {}, - dataLatestId: "", + dataLatestId: null, + latestVersionId: null, compareDialogVisible: false, // 版本对比相关 versionLeftId: "", @@ -271,9 +271,22 @@ export default { this.loading = true; this.$emit("setLatest", row); }, + showSetNew(item) { + let hasVersionCase = this.caseVersionMap.has(item.id); + let latestVersionCondition = this.caseVersionMap.has(this.latestVersionId) ? item.id === this.latestVersionId : true; + let isNotDataLatestVersionCase = item.id === this.dataLatestId; + return hasVersionCase // 有当前版本的用例 + && latestVersionCondition // 有最新版本的用例,则非最新版本的其他版本不显示置新 + && !this.isRead // 不是只读 + && !isNotDataLatestVersionCase // 已经是最新版本,不显示置新 + }, handleVersionOptions() { let latestData = {}; this.versionOptions.forEach(v => { + if (v.latest) { + // 获取最新版本 + this.latestVersionId = v.id; + } // 获取当前版本 if (v.id === this.currentVersionId) { @@ -288,7 +301,7 @@ export default { // 设置版本的创建人 v.createName = versionCase.createName; - // 获取最新版本 + // 获取当前用例最新版本 if (versionCase.latest) { latestData = v; this.dataLatestId = v.id;