fix(我的工作台): 解决我的仪表盘跨项目跳转问题

--user=郭雨琦
--bug=1013843
https://www.tapd.cn/55049933/bugtrace/bugs/view/1155049933001013843
This commit is contained in:
guoyuqi 2022-06-10 16:38:35 +08:00 committed by f2c-ci-robot[bot]
parent 764e2f6562
commit 4e2af32e82
5 changed files with 36 additions and 19 deletions

View File

@ -735,10 +735,6 @@ export default {
this.handleTabsEdit(this.$t('api_test.definition.request.fast_debug'), "debug", id);
},
init() {
let routeTestCase = this.$route.params.apiDefinition;
if (routeTestCase) {
this.editApi(routeTestCase);
}
let dataRange = this.$route.params.dataSelectRange;
let dataType = this.$route.params.dataType;
if (dataRange) {

View File

@ -106,6 +106,7 @@ import MsChangeHistory from "../../history/ChangeHistory";
import MsTableOperatorButton from "@/business/components/common/components/MsTableOperatorButton";
import MsTipButton from "@/business/components/common/components/MsTipButton";
import DiffVersion from "@/business/components/performance/test/DiffVersion";
import {PROJECT_ID} from "@/common/js/constants";
const requireComponent = require.context('@/business/components/xpack/', true, /\.vue$/);
const versionHistory = requireComponent.keys().length > 0 ? requireComponent("./version/VersionHistory.vue") : {};
@ -179,6 +180,10 @@ export default {
},
created() {
let projectId = this.$route.query.projectId;
if (projectId && projectId !== getCurrentProjectID()) {
sessionStorage.setItem(PROJECT_ID, projectId);
}
this.isReadOnly = !hasPermission('PROJECT_PERFORMANCE_TEST:READ+EDIT');
this.getTest(this.$route.params.testId);
if (hasLicense()) {

View File

@ -221,6 +221,7 @@ import TestCaseMinder from "@/business/components/track/common/minder/TestCaseMi
import IsChangeConfirm from "@/business/components/common/components/IsChangeConfirm";
import {openMinderConfirm, saveMinderConfirm} from "@/business/components/track/common/minder/minderUtils";
import TestCaseEditShow from "@/business/components/track/case/components/TestCaseEditShow";
import {PROJECT_ID} from "@/common/js/constants";
const requireComponent = require.context('@/business/components/xpack/', true, /\.vue$/);
const VersionSelect = requireComponent.keys().length > 0 ? requireComponent("./version/VersionSelect.vue") : {};
@ -263,17 +264,22 @@ export default {
versionEnable: false,
isAsideHidden: true,
showPublicNode: false,
publicTreeNodes: []
publicTreeNodes: [],
ignoreTreeNodes:false,
};
},
created() {
let projectId = this.$route.query.projectId;
if (projectId) {
this.ignoreTreeNodes = true;
if (projectId !== getCurrentProjectID() && projectId !== 'all') {
sessionStorage.setItem(PROJECT_ID, projectId);
}
}
},
mounted() {
this.getProject();
let routeTestCase = this.$route.params.testCase;
if (routeTestCase && routeTestCase.add === true) {
this.addTab({name: 'add'});
} else {
this.init(this.$route);
}
this.init(this.$route);
this.checkVersionEnable();
},
beforeRouteLeave(to, from, next) {
@ -564,14 +570,11 @@ export default {
if (path.indexOf("/track/case/edit") >= 0 || path.indexOf("/track/case/create") >= 0) {
this.testCaseReadOnly = false;
let caseId = this.$route.params.caseId;
let routeTestCase = this.$route.params.testCase;
if (!this.projectId) {
this.$warning(this.$t('commons.check_project_tip'));
return;
}
if (routeTestCase) {
this.editTestCase(routeTestCase);
} else if (caseId) {
if (caseId) {
this.$get('test/case/get/' + caseId, response => {
let testCase = response.data;
this.editTestCase(testCase);
@ -607,10 +610,12 @@ export default {
if (!index) {
this.type = "edit";
this.testCaseReadOnly = false;
if (testCase.label !== "redirect") {
if (this.treeNodes.length < 1) {
this.$warning(this.$t('test_track.case.create_module_first'));
return;
if (!this.ignoreTreeNodes) {
if (testCase.label !== "redirect") {
if (this.treeNodes.length < 1) {
this.$warning(this.$t('test_track.case.create_module_first'));
return;
}
}
}
let hasEditPermission = hasPermission('PROJECT_TRACK_CASE:READ+EDIT');

View File

@ -88,6 +88,12 @@ export default {
}
},
watch: {
'$route.query.projectId'() {
let projectId = this.$route.query.projectId;
if (projectId && projectId !== getCurrentProjectID()) {
sessionStorage.setItem(PROJECT_ID, projectId);
}
},
'$route.params.planId'() {
this.genRedirectParam();
this.getTestPlans();

View File

@ -35,6 +35,7 @@ import TestReviewRelevance from "./components/TestReviewRelevance";
import MsTestPlanHeaderBar from "@/business/components/track/plan/view/comonents/head/TestPlanHeaderBar";
import TestReviewFunction from "@/business/components/track/review/view/components/TestReviewFunction";
import {getCurrentProjectID, hasLicense} from "@/common/js/utils";
import {PROJECT_ID} from "@/common/js/constants";
export default {
name: "TestCaseReviewView",
@ -76,6 +77,10 @@ export default {
}
},
created() {
let projectId = this.$route.query.projectId;
if (projectId) {
sessionStorage.setItem(PROJECT_ID, projectId);
}
this.$EventBus.$on('projectChange', () => {
if (this.$route.name === 'testCaseReviewView') {
this.$router.push('/track/review/all');