fix(测试跟踪): 修复测试跟踪跳转非本项目用例时查询失败的问题

--bug=1028790 --user=宋天阳 【测试跟踪】测试计划-接口用例-点击ID-跳转项目错误
https://www.tapd.cn/55049933/s/1404343
This commit is contained in:
song-tianyang 2023-08-16 14:14:05 +08:00 committed by 建国
parent 040a3d264f
commit 75e2991219
3 changed files with 45 additions and 26 deletions

View File

@ -1,4 +1,5 @@
import {get, post} from '../plugins/request'
const BASE_URL = '/project/';
export function getOwnerProjects() {
@ -9,6 +10,10 @@ export function getProjectListAll() {
return get(BASE_URL + 'list/all')
}
export function getProject(projectId) {
return get(BASE_URL + 'get/' + projectId);
}
export function getUserProjectList(data) {
return post(BASE_URL + 'list/related', data)
}

View File

@ -238,7 +238,7 @@ import MsContainer from "metersphere-frontend/src/components/MsContainer";
import MsBottomContainer from "metersphere-frontend/src/components/MsBottomContainer";
import BatchEdit from "@/business/case/components/BatchEdit";
import {API_METHOD_COLOUR, CASE_PRIORITY, RESULT_MAP,} from "metersphere-frontend/src/model/JsonData";
import {getCurrentProjectID, getCurrentWorkspaceId,} from "metersphere-frontend/src/utils/token";
import {getCurrentProjectID,} from "metersphere-frontend/src/utils/token";
import {hasLicense, hasPermission,} from "metersphere-frontend/src/utils/permission";
import {getUUID, strMapToObj} from "metersphere-frontend/src/utils";
import PriorityTableItem from "../../../../common/tableItems/planview/PriorityTableItem";
@ -273,6 +273,7 @@ import MsTestPlanApiStatus from "@/business/plan/view/comonents/api/TestPlanApiS
import {getProjectVersions} from "@/business/utils/sdk-utils";
import {TEST_PLAN_API_CASE_CONFIGS} from "metersphere-frontend/src/components/search/search-components";
import MsTestPlanRunModeWithEnv from "@/business/plan/common/TestPlanRunModeWithEnv";
import {getProject} from "@/api/project";
export default {
name: "TestPlanApiCaseList",
@ -726,19 +727,25 @@ export default {
}
},
openApiById(item) {
let projectId = item.projectId;
getProject(projectId).then((rsp) => {
if (rsp.data) {
let workspaceId = rsp.data.workspaceId;
let definitionData = this.$router.resolve(
"/api/definition/default/" +
getUUID() +
"/apiTestCase/single:" +
item.caseId +
"/" +
getCurrentProjectID() +
projectId +
"/" +
item.protocol +
"/" +
getCurrentWorkspaceId()
workspaceId
);
window.open(definitionData.href, "_blank");
}
});
},
getTagToolTips(tags) {
try {

View File

@ -286,7 +286,7 @@
import MsTableHeader from "metersphere-frontend/src/components/MsTableHeader";
import MsTablePagination from "metersphere-frontend/src/components/pagination/TablePagination";
import MsTag from "metersphere-frontend/src/components/MsTag";
import {getCurrentProjectID, getCurrentWorkspaceId,} from "metersphere-frontend/src/utils/token";
import {getCurrentProjectID,} from "metersphere-frontend/src/utils/token";
import {getUUID, strMapToObj} from "metersphere-frontend/src/utils";
import {hasLicense, hasPermission,} from "metersphere-frontend/src/utils/permission";
import MsTableMoreBtn from "metersphere-frontend/src/components/table/TableMoreBtn";
@ -323,6 +323,7 @@ import MsTestPlanApiStatus from "@/business/plan/view/comonents/api/TestPlanApiS
import {getVersionFilters} from "@/business/utils/sdk-utils";
import {TEST_PLAN_API_SCENARIO_CONFIGS} from "metersphere-frontend/src/components/search/search-components";
import MsTestPlanRunModeWithEnv from "@/business/plan/common/TestPlanRunModeWithEnv";
import {getProject} from "@/api/project";
export default {
name: "MsTestPlanApiScenarioList",
@ -676,17 +677,23 @@ export default {
}
},
openById(item) {
let projectId = item.projectId;
getProject(projectId).then((rsp) => {
if (rsp.data) {
let workspaceId = rsp.data.workspaceId;
let automationData = this.$router.resolve(
"/api/automation/default/" +
getUUID() +
"/scenario/edit:" +
item.caseId +
"/" +
item.projectId +
projectId +
"/" +
getCurrentWorkspaceId()
workspaceId
);
window.open(automationData.href, "_blank");
}
});
},
getTagToolTips(tags) {
try {