refactor(测试跟踪): 访问测试计划URL,若不在当前项目,跳转到对应的项目
--bug=1020873 --user=陈建星 【测试跟踪】github#20653,通过测试计划的链接URL进入测试计划,计划的所属项目和计划名称显示不正确 https://www.tapd.cn/55049933/s/1315909
This commit is contained in:
parent
eb4134eea7
commit
483a8b4a3e
|
@ -18,6 +18,10 @@ export function getCurrentProjectID() {
|
|||
return getCurrentUser().lastProjectId;
|
||||
}
|
||||
|
||||
export function setCurrentProjectID(projectId) {
|
||||
sessionStorage.setItem(PROJECT_ID, projectId);
|
||||
}
|
||||
|
||||
export function getCurrentUser() {
|
||||
try {
|
||||
const store = useUserStore();
|
||||
|
|
|
@ -76,13 +76,13 @@ import TestPlanFunctional from "./comonents/functional/TestPlanFunctional";
|
|||
import TestPlanApi from "./comonents/api/TestPlanApi";
|
||||
import TestPlanUi from "./comonents/ui/TestPlanUi";
|
||||
import TestPlanLoad from "@/business/plan/view/comonents/load/TestPlanLoad";
|
||||
import {getCurrentProjectID} from "metersphere-frontend/src/utils/token";
|
||||
import {getCurrentProjectID, setCurrentProjectID} from "metersphere-frontend/src/utils/token";
|
||||
import {hasLicense} from "metersphere-frontend/src/utils/permission"
|
||||
import TestPlanReportContent from "@/business/plan/view/comonents/report/detail/TestPlanReportContent";
|
||||
import IsChangeConfirm from "metersphere-frontend/src/components/IsChangeConfirm";
|
||||
import {PROJECT_ID, WORKSPACE_ID} from "metersphere-frontend/src/utils/constants";
|
||||
import {useStore} from "@/store";
|
||||
import {testPlanListAll} from "@/api/remote/plan/test-plan";
|
||||
import {testPlanGet, testPlanListAll} from "@/api/remote/plan/test-plan";
|
||||
import {isProjectVersionEnable} from "@/business/utils/sdk-utils";
|
||||
|
||||
export default {
|
||||
|
@ -207,11 +207,23 @@ export default {
|
|||
testPlanListAll({projectId: getCurrentProjectID()})
|
||||
.then(response => {
|
||||
this.testPlans = response.data;
|
||||
let hasPlan = false;
|
||||
this.testPlans.forEach(plan => {
|
||||
if (this.planId && plan.id === this.planId) {
|
||||
hasPlan = true;
|
||||
this.currentPlan = plan;
|
||||
}
|
||||
});
|
||||
if (!hasPlan) {
|
||||
if (this.planId) {
|
||||
testPlanGet(this.planId)
|
||||
.then((r) => {
|
||||
let plan = r.data;
|
||||
setCurrentProjectID(plan.projectId);
|
||||
location.reload();
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
changePlan(plan) {
|
||||
|
|
|
@ -2,7 +2,7 @@ export {operationConfirm, removeGoBackListener, handleCtrlSEvent, byteToSize, re
|
|||
getTypeByFileName, strMapToObj, getUUID, windowPrint} from "metersphere-frontend/src/utils";
|
||||
export {parseCustomFilesForList, getCustomFieldFilter, buildBatchParam} from "metersphere-frontend/src/utils/tableUtils";
|
||||
export {sortCustomFields, parseCustomField, buildCustomFields} from "metersphere-frontend/src/utils/custom_field";
|
||||
export {getCurrentProjectID, getCurrentWorkspaceId, getCurrentUser} from "metersphere-frontend/src/utils/token";
|
||||
export {getCurrentProjectID, getCurrentWorkspaceId, getCurrentUser, setCurrentProjectID} from "metersphere-frontend/src/utils/token";
|
||||
export {hasLicense, hasPermissions, hasPermission} from "metersphere-frontend/src/utils/permission";
|
||||
export {get, post, downloadFile, fileDownloadGet, fileDownloadPost, fileUpload, generateShareUrl, generateModuleUrl} from "metersphere-frontend/src/plugins/request";
|
||||
export {CURRENT_LANGUAGE} from "metersphere-frontend/src/utils/constants";
|
||||
|
|
Loading…
Reference in New Issue