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;