From 75e299121996fa183f0b9beebdb930029848078e Mon Sep 17 00:00:00 2001 From: song-tianyang Date: Wed, 16 Aug 2023 14:14:05 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=B5=8B=E8=AF=95=E8=B7=9F=E8=B8=AA):=20?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=B5=8B=E8=AF=95=E8=B7=9F=E8=B8=AA=E8=B7=B3?= =?UTF-8?q?=E8=BD=AC=E9=9D=9E=E6=9C=AC=E9=A1=B9=E7=9B=AE=E7=94=A8=E4=BE=8B?= =?UTF-8?q?=E6=97=B6=E6=9F=A5=E8=AF=A2=E5=A4=B1=E8=B4=A5=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1028790 --user=宋天阳 【测试跟踪】测试计划-接口用例-点击ID-跳转项目错误 https://www.tapd.cn/55049933/s/1404343 --- .../sdk-parent/frontend/src/api/project.js | 5 +++ .../comonents/api/TestPlanApiCaseList.vue | 35 +++++++++++-------- .../comonents/api/TestPlanApiScenarioList.vue | 31 +++++++++------- 3 files changed, 45 insertions(+), 26 deletions(-) diff --git a/framework/sdk-parent/frontend/src/api/project.js b/framework/sdk-parent/frontend/src/api/project.js index 49806d0062..8cd485f395 100644 --- a/framework/sdk-parent/frontend/src/api/project.js +++ b/framework/sdk-parent/frontend/src/api/project.js @@ -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) } diff --git a/test-track/frontend/src/business/plan/view/comonents/api/TestPlanApiCaseList.vue b/test-track/frontend/src/business/plan/view/comonents/api/TestPlanApiCaseList.vue index cff2764ed1..0cd7f9e12d 100644 --- a/test-track/frontend/src/business/plan/view/comonents/api/TestPlanApiCaseList.vue +++ b/test-track/frontend/src/business/plan/view/comonents/api/TestPlanApiCaseList.vue @@ -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 definitionData = this.$router.resolve( - "/api/definition/default/" + - getUUID() + - "/apiTestCase/single:" + - item.caseId + - "/" + - getCurrentProjectID() + - "/" + - item.protocol + - "/" + - getCurrentWorkspaceId() - ); - window.open(definitionData.href, "_blank"); + 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 + + "/" + + projectId + + "/" + + item.protocol + + "/" + + workspaceId + ); + window.open(definitionData.href, "_blank"); + } + }); }, getTagToolTips(tags) { try { diff --git a/test-track/frontend/src/business/plan/view/comonents/api/TestPlanApiScenarioList.vue b/test-track/frontend/src/business/plan/view/comonents/api/TestPlanApiScenarioList.vue index 4bdea17e2c..9471cba57f 100644 --- a/test-track/frontend/src/business/plan/view/comonents/api/TestPlanApiScenarioList.vue +++ b/test-track/frontend/src/business/plan/view/comonents/api/TestPlanApiScenarioList.vue @@ -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 automationData = this.$router.resolve( - "/api/automation/default/" + - getUUID() + - "/scenario/edit:" + - item.caseId + - "/" + - item.projectId + - "/" + - getCurrentWorkspaceId() - ); - window.open(automationData.href, "_blank"); + 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 + + "/" + + projectId + + "/" + + workspaceId + ); + window.open(automationData.href, "_blank"); + } + }); }, getTagToolTips(tags) { try {