fix(测试跟踪): 用例版本置新按钮显示条件优化

--bug=1023466 --user=陈建星 【测试跟踪】功能用例-编辑-版本-点击置新-提示信息后版本显示一直转圈 https://www.tapd.cn/55049933/s/1339220
This commit is contained in:
chenjianxing 2023-02-21 11:34:31 +08:00 committed by jianxing
parent 739949fafb
commit f1761fa7ec
3 changed files with 35 additions and 55 deletions

View File

@ -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() {

View File

@ -54,53 +54,6 @@
</el-form-item>
</div>
</div>
<!-- origin -->
<!-- <el-row>
<el-col :span="6">
<el-form-item>
<el-checkbox v-model="form.remark">{{
$t("commons.remark")
}}</el-checkbox>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item>
<el-checkbox v-model="form.relateTest">{{
$t("test_track.case.relate_test")
}}</el-checkbox>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item>
<el-checkbox v-model="form.relateDemand">{{
$t("test_track.related_requirements")
}}</el-checkbox>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item>
<el-checkbox v-model="form.relateIssue">{{
$t("test_track.case.relate_issue")
}}</el-checkbox>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="6">
<el-form-item>
<el-checkbox v-model="form.dependency">{{
$t("commons.relationship.name")
}}</el-checkbox>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item>
<el-checkbox v-model="form.archive">{{
$t("test_track.case.attachment")
}}</el-checkbox>
</el-form-item>
</el-col>
</el-row> -->
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="visible = false">{{ $t("commons.cancel") }}</el-button>
@ -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;

View File

@ -39,8 +39,7 @@
<div
class="updated opt-row"
@click.stop="setLatest(item)"
v-if="caseVersionMap.has(item.id)
&& !(isRead || item.id === dataLatestId)"
v-if="showSetNew(item)"
>
{{ $t("case.set_new") }}
</div>
@ -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;