fix(测试跟踪): 功能用例编辑页偶发会跳转到列表页

--bug=1024405 --user=陈建星 【测试跟踪】功能用例-点击创建用例-有时新增tab页进入功能用例列表页面 https://www.tapd.cn/55049933/s/1350974
This commit is contained in:
chenjianxing 2023-03-15 20:14:11 +08:00 committed by jianxing
parent 133868a9d7
commit e309c6aa42
8 changed files with 20 additions and 32 deletions

View File

@ -204,7 +204,6 @@ export default {
switchProject({id: this.userId, lastProjectId: projectId})
.then(response => {
this.userStore.switchProject(response);
this.userStore.projectChangeFlag = true;
this.$EventBus.$emit('projectChange');
this.changeProjectName(projectId);
//

View File

@ -41,8 +41,7 @@ export default {
id: TokenKey,
state: () => ({
language: getLanguage(),
showLicenseCountWarning: false,
projectChangeFlag: false
showLicenseCountWarning: false
}),
persist: true,
getters: {

View File

@ -762,11 +762,6 @@ export default {
});
},
async loadTestCase() {
if (this.useUserStore.projectChangeFlag) {
this.useUserStore.projectChangeFlag = false;
this.$router.push('/track/case/all');
return;
}
if (this.isPublicShow) {
this.resetForm();
@ -838,8 +833,8 @@ export default {
editPublicCase() {
//
getEditSimpleTestCase(this.caseId)
.then(() => {
openCaseEdit({caseId: this.caseId}, this);
.then((r) => {
openCaseEdit({caseId: this.caseId, projectId: r.data.projectId}, this);
})
.catch(() => {});
},
@ -1017,16 +1012,17 @@ export default {
});
} else {
this.projectId = this.routeProjectId;
if (this.projectId) {
// routeProjectId
if (getCurrentProjectID() !== this.projectId) {
setCurrentProjectID(this.projectId);
location.reload();
return;
}
}
//
if (this.isCopy || this.isAdd) {
// routeProjectId
if (this.routeProjectId) {
if (getCurrentProjectID() !== this.projectId) {
setCurrentProjectID(this.projectId);
location.reload();
return;
}
} else {
if (!this.projectId) {
// routeProjectId 使
this.projectId = getCurrentProjectID();
}
@ -1043,9 +1039,8 @@ export default {
await getEditSimpleTestCase(this.caseId).then((response) => {
let testCase = response.data;
if (getCurrentProjectID() !== testCase.projectId) {
//
setCurrentProjectID(testCase.projectId);
location.reload();
//
this.$router.push({path: '/track/case/all', query: {projectId: getCurrentProjectID()}});
} else {
this.projectId = testCase.projectId;
}

View File

@ -469,7 +469,7 @@ export default {
//
getEditSimpleTestCase(testCase.id)
.then(() => {
openCaseEdit({caseId: testCase.id}, this);
openCaseEdit({caseId: testCase.id, projectId: testCase.projectId}, this);
})
.catch(() => {});
},

View File

@ -64,10 +64,8 @@ export function openCaseEdit(query, v) {
if (!query.type) {
delete query.type;
}
if (query.type !== 'copy') {
// 编辑不带项目id会检查用例的权限
// 复制需要带项目id复制到当前项目包括用例库的复制
delete query.projectId;
if (!query.projectId) {
query.projectId = getCurrentProjectID();
}
let path = '/track/case/edit/' + query.caseId;
delete query.caseId;

View File

@ -618,7 +618,7 @@ export default {
this.relationGraphOpen = val;
},
openTestTestCase(item) {
openCaseEdit({caseId: item.caseId}, this);
openCaseEdit({caseId: item.caseId, projectId: item.projectId}, this);
},
addPLabel(str) {
return "<p>" + str + "</p>";

View File

@ -81,7 +81,7 @@ export default {
openTestCase() {
checkProjectPermission(this.testCase.projectId).then((r) => {
if (r.data) {
openCaseEdit({caseId: this.testCase.caseId}, this);
openCaseEdit({caseId: this.testCase.caseId, projectId: this.testCase.projectId}, this);
} else {
this.$error(this.$t("commons.project_permission"));
}

View File

@ -655,12 +655,9 @@ export default {
},
handleEdit(testCase, column) {
let query = {
caseId: testCase.id,
projectId: testCase.projectId
};
let path = '/track/case/edit/' + query.caseId;
delete query.projectId;
delete query.caseId;
let path = '/track/case/edit/' + testCase.id;
let TestCaseData = this.$router.resolve({
path,
query,