fix(测试跟踪): 版本接口响应过长时初始版本设置有误

--bug=1024033 --user=宋昌昌 【测试跟踪】功能用例-新建-版本和tab页标题未显示 https://www.tapd.cn/55049933/s/1354553
This commit is contained in:
song-cc-rock 2023-03-22 18:51:46 +08:00
parent 20b48ab6fe
commit 1292b00103
3 changed files with 11 additions and 7 deletions

View File

@ -65,6 +65,10 @@ export default {
getProjectVersions(projectId) getProjectVersions(projectId)
.then(response => { .then(response => {
this.versionOptions = response.data; this.versionOptions = response.data;
let latestVersions = this.versionOptions.filter(version => version.latest);
if (latestVersions && latestVersions.length === 1) {
localStorage.setItem("latest-version", latestVersions[0].id);
}
}); });
} }
}, },

View File

@ -651,9 +651,8 @@
#{id} #{id}
</foreach> </foreach>
</if> </if>
<if test="request.relevanceCreateTime >0"> <if test="request.relevanceCreateTime > 0">
and test_case.id in (select test_case_id from test_case_test where test_case_test.create_time >= and test_case.id in (select test_case_id from test_case_test where test_case_test.create_time >= #{request.relevanceCreateTime})
#{request.createTime})
</if> </if>
<if test="request.createTime >0"> <if test="request.createTime >0">
and test_case.create_time >= #{request.createTime} and test_case.create_time >= #{request.createTime}

View File

@ -590,7 +590,8 @@ export default {
editableState: false, editableState: false,
isNameEdit: false, isNameEdit: false,
useUserStore: {}, useUserStore: {},
priorityOptions: [] priorityOptions: [],
initLatestVersionId: ""
}; };
}, },
props: { props: {
@ -742,7 +743,7 @@ export default {
(r) => { (r) => {
let latestVersion = r.data.filter(version => version.latest); let latestVersion = r.data.filter(version => version.latest);
if (latestVersion && latestVersion.length === 1 && this.editable) { if (latestVersion && latestVersion.length === 1 && this.editable) {
this.initLatestVersionId = latestVersion[0].id; this.initLatestVersionId = latestVersion[0].id
} }
} }
); );
@ -1003,7 +1004,7 @@ export default {
let user = JSON.parse(localStorage.getItem(TokenKey)); let user = JSON.parse(localStorage.getItem(TokenKey));
this.form.maintainer = user.id; this.form.maintainer = user.id;
this.form.tags = []; this.form.tags = [];
this.form.versionId = this.initLatestVersionId; this.form.versionId = localStorage.getItem("latest-version") || this.initLatestVersionId;
this.getSelectOptions(); this.getSelectOptions();
this.customFieldForm = parseCustomField( this.customFieldForm = parseCustomField(
this.form, this.form,
@ -1082,7 +1083,7 @@ export default {
// //
testCase.id = getUUID(); testCase.id = getUUID();
testCase.refId = null; testCase.refId = null;
testCase.versionId = this.initLatestVersionId; testCase.versionId = localStorage.getItem("latest-version") || this.initLatestVersionId;
this.form.id = null; this.form.id = null;
testCase.casePublic = false; testCase.casePublic = false;
} }