From d8de2463a793df58591c0e329736652d1d2c85c8 Mon Sep 17 00:00:00 2001 From: song-tianyang Date: Wed, 1 Feb 2023 10:51:20 +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=AE=A1=E5=88=92=E8=B7=B3?= =?UTF-8?q?=E8=BD=AC=E8=B7=A8=E9=A1=B9=E7=9B=AE=E5=9C=BA=E6=99=AF=E6=8A=A5?= =?UTF-8?q?=E5=91=8A=E6=97=B6=E5=87=BA=E7=8E=B0=E7=9A=84=E6=89=80=E5=B1=9E?= =?UTF-8?q?=E6=A8=A1=E5=9D=97=E4=B8=A2=E5=A4=B1=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1022175 --user=宋天阳 【测试跟踪】github#21463,从测试报告点击用例名进入用例编辑页,module会丢失 https://www.tapd.cn/55049933/s/1329608 --- .../base/mapper/ext/ExtProjectMapper.java | 2 ++ .../base/mapper/ext/ExtProjectMapper.xml | 7 +++++++ .../controller/ProjectController.java | 5 +++++ .../metersphere/service/ProjectService.java | 4 ++++ .../automation/report/ApiReportViewHeader.vue | 19 +++++++++---------- 5 files changed, 27 insertions(+), 10 deletions(-) diff --git a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtProjectMapper.java b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtProjectMapper.java index baf76a4a40..8c5b8eab57 100644 --- a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtProjectMapper.java +++ b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtProjectMapper.java @@ -47,4 +47,6 @@ public interface ExtProjectMapper { void updateUseDefaultCaseTemplateProject(@Param("originId") String originId,@Param("templateId") String templateId,@Param("projectId") String projectId); List getThirdPartProjectIds(); + + ProjectDTO getProjectByScenario(String scenarioId); } diff --git a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtProjectMapper.xml b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtProjectMapper.xml index 0803bdd795..06907f7227 100644 --- a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtProjectMapper.xml +++ b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtProjectMapper.xml @@ -432,4 +432,11 @@ NULL) + diff --git a/backend/src/main/java/io/metersphere/controller/ProjectController.java b/backend/src/main/java/io/metersphere/controller/ProjectController.java index 8af9599fc3..e393150ecd 100644 --- a/backend/src/main/java/io/metersphere/controller/ProjectController.java +++ b/backend/src/main/java/io/metersphere/controller/ProjectController.java @@ -164,4 +164,9 @@ public class ProjectController { public void checkThirdProjectExist(@RequestBody Project project) { projectService.checkThirdProjectExist(project); } + + @GetMapping("/api/project/get/{id}") + public ProjectDTO getProjectByScenario(@PathVariable String id) { + return projectService.getProjectByScenario(id); + } } diff --git a/backend/src/main/java/io/metersphere/service/ProjectService.java b/backend/src/main/java/io/metersphere/service/ProjectService.java index 7213f71627..af4de6955d 100644 --- a/backend/src/main/java/io/metersphere/service/ProjectService.java +++ b/backend/src/main/java/io/metersphere/service/ProjectService.java @@ -1082,4 +1082,8 @@ public class ProjectService { } } } + + public ProjectDTO getProjectByScenario(String id) { + return extProjectMapper.getProjectByScenario(id); + } } diff --git a/frontend/src/business/components/api/automation/report/ApiReportViewHeader.vue b/frontend/src/business/components/api/automation/report/ApiReportViewHeader.vue index 02592e255a..98fa5e611e 100644 --- a/frontend/src/business/components/api/automation/report/ApiReportViewHeader.vue +++ b/frontend/src/business/components/api/automation/report/ApiReportViewHeader.vue @@ -136,16 +136,15 @@ export default { }, clickResource() { let workspaceId = getCurrentWorkspaceId(); - if (this.report.projectId !== getCurrentProjectID()) { - this.$get("/project/get/" + this.report.projectId, response => { - if (response.data) { - workspaceId = response.data.workspaceId; - this.checkPermission(workspaceId, this.report.projectId, response.data.name); - } - }); - } else { - this.checkPermission(workspaceId, this.report.projectId, null); - } + this.$get("/project/api/project/get/" + this.scenarioId, res => { + let scenarioProjectId = res.data.id; + if (scenarioProjectId !== getCurrentProjectID()) { + workspaceId = res.data.workspaceId; + this.checkPermission(workspaceId, scenarioProjectId, res.data.name); + } else { + this.checkPermission(workspaceId, scenarioProjectId, null); + } + }); }, checkPermission(workspaceId, projectId, projectName) { this.$get("/workspace/get/" + workspaceId, response => {