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 // 2
// 3 // 3
saveType: 1, saveType: 1,
projectId: null projectId: null,
createVersionId: null
}; };
}, },
props: { props: {
@ -1152,6 +1153,11 @@ export default {
this.$emit("refresh", response.data); this.$emit("refresh", response.data);
if (this.form.id) { if (this.form.id) {
this.$emit("caseEdit", param); this.$emit("caseEdit", param);
if (this.createVersionId) {
//
this.createVersionId = null;
this.routerToEdit(response.data.id);
}
} else { } else {
param.id = response.data.id; param.id = response.data.id;
this.close(); this.close();
@ -1162,9 +1168,11 @@ export default {
this.routerToEdit(response.data.id); this.routerToEdit(response.data.id);
} }
} }
this.createVersionId = null;
}) })
.catch(() => { .catch(() => {
this.loading = false; this.loading = false;
this.createVersionId = null;
}); });
} }
}, },
@ -1218,6 +1226,9 @@ export default {
param.unRelateFileMetaIds = this.$refs.otherInfo.getUnRelateFiles(); param.unRelateFileMetaIds = this.$refs.otherInfo.getUnRelateFiles();
} }
} }
if (this.createVersionId) {
param.versionId = this.createVersionId;
}
return param; return param;
}, },
parseOldFields(param) { parseOldFields(param) {
@ -1484,12 +1495,12 @@ export default {
async createVersion(row) { async createVersion(row) {
if (this.validateForm()) { if (this.validateForm()) {
// //
this.form.versionId = row.id;
let hasOtherInfo = await this.hasOtherInfo(); let hasOtherInfo = await this.hasOtherInfo();
if (hasOtherInfo) { if (hasOtherInfo) {
this.$refs.versionHistory.loading = false; this.$refs.versionHistory.loading = false;
this.$refs.selectPropDialog.open(); this.$refs.selectPropDialog.open(row.id);
} else { } else {
this.createVersionId = row.id;
this.saveCase(() => { this.saveCase(() => {
if (this.$refs.versionHistory) { if (this.$refs.versionHistory) {
this.$refs.versionHistory.loading = false; this.$refs.versionHistory.loading = false;
@ -1547,6 +1558,7 @@ export default {
}, },
confirmOtherInfo(selectedOtherInfo) { confirmOtherInfo(selectedOtherInfo) {
this.selectedOtherInfo = selectedOtherInfo; this.selectedOtherInfo = selectedOtherInfo;
this.createVersionId = selectedOtherInfo.versionId;
this.saveCase(); this.saveCase();
}, },
copyRow() { copyRow() {

View File

@ -54,53 +54,6 @@
</el-form-item> </el-form-item>
</div> </div>
</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> </el-form>
<span slot="footer" class="dialog-footer"> <span slot="footer" class="dialog-footer">
<el-button @click="visible = false">{{ $t("commons.cancel") }}</el-button> <el-button @click="visible = false">{{ $t("commons.cancel") }}</el-button>
@ -124,12 +77,14 @@ export default {
relateIssue: false, relateIssue: false,
archive: false, archive: false,
dependency: false, dependency: false,
versionId: null
}, },
}; };
}, },
methods: { methods: {
open() { open(versionId) {
this.visible = true; this.visible = true;
this.form.versionId = versionId;
}, },
close() { close() {
this.visible = false; this.visible = false;

View File

@ -39,8 +39,7 @@
<div <div
class="updated opt-row" class="updated opt-row"
@click.stop="setLatest(item)" @click.stop="setLatest(item)"
v-if="caseVersionMap.has(item.id) v-if="showSetNew(item)"
&& !(isRead || item.id === dataLatestId)"
> >
{{ $t("case.set_new") }} {{ $t("case.set_new") }}
</div> </div>
@ -172,7 +171,8 @@ export default {
versionCompareOptions: [], versionCompareOptions: [],
userData: {}, userData: {},
currentVersion: {}, currentVersion: {},
dataLatestId: "", dataLatestId: null,
latestVersionId: null,
compareDialogVisible: false, compareDialogVisible: false,
// //
versionLeftId: "", versionLeftId: "",
@ -271,9 +271,22 @@ export default {
this.loading = true; this.loading = true;
this.$emit("setLatest", row); 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() { handleVersionOptions() {
let latestData = {}; let latestData = {};
this.versionOptions.forEach(v => { this.versionOptions.forEach(v => {
if (v.latest) {
//
this.latestVersionId = v.id;
}
// //
if (v.id === this.currentVersionId) { if (v.id === this.currentVersionId) {
@ -288,7 +301,7 @@ export default {
// //
v.createName = versionCase.createName; v.createName = versionCase.createName;
// //
if (versionCase.latest) { if (versionCase.latest) {
latestData = v; latestData = v;
this.dataLatestId = v.id; this.dataLatestId = v.id;