fix(测试跟踪): 功能用例编辑页偶发会跳转到列表页
--bug=1024405 --user=陈建星 【测试跟踪】功能用例-点击创建用例-有时新增tab页进入功能用例列表页面 https://www.tapd.cn/55049933/s/1350974
This commit is contained in:
parent
133868a9d7
commit
e309c6aa42
|
@ -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);
|
||||
// 刷新路由
|
||||
|
|
|
@ -41,8 +41,7 @@ export default {
|
|||
id: TokenKey,
|
||||
state: () => ({
|
||||
language: getLanguage(),
|
||||
showLicenseCountWarning: false,
|
||||
projectChangeFlag: false
|
||||
showLicenseCountWarning: false
|
||||
}),
|
||||
persist: true,
|
||||
getters: {
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -469,7 +469,7 @@ export default {
|
|||
// 这个接口会校验权限
|
||||
getEditSimpleTestCase(testCase.id)
|
||||
.then(() => {
|
||||
openCaseEdit({caseId: testCase.id}, this);
|
||||
openCaseEdit({caseId: testCase.id, projectId: testCase.projectId}, this);
|
||||
})
|
||||
.catch(() => {});
|
||||
},
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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>";
|
||||
|
|
|
@ -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"));
|
||||
}
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Reference in New Issue