From df4db6b7368e38a3282831689a0c868b60d9132f Mon Sep 17 00:00:00 2001 From: chenjianxing Date: Tue, 1 Nov 2022 18:27:55 +0800 Subject: [PATCH] =?UTF-8?q?refactor(=E6=B5=8B=E8=AF=95=E8=B7=9F=E8=B8=AA):?= =?UTF-8?q?=20=E6=B5=8B=E8=AF=95=E8=AE=A1=E5=88=92=E5=8A=9F=E8=83=BD?= =?UTF-8?q?=E7=94=A8=E4=BE=8B=E8=B7=A8=E9=A1=B9=E7=9B=AE=E8=B7=B3=E8=BD=AC?= =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1018699 --user=陈建星 【测试跟踪】测试计划中,无项目权限账号点击测试用例发生跳转,提示异常后再系统管理页面显示,建议优化 https://www.tapd.cn/55049933/s/1285584 --- .../controller/TestCaseController.java | 5 +++++ test-track/frontend/src/api/testCase.js | 6 ++++-- .../functional/FunctionalTestCaseEdit.vue | 18 +++++++++++++++--- 3 files changed, 24 insertions(+), 5 deletions(-) diff --git a/test-track/backend/src/main/java/io/metersphere/controller/TestCaseController.java b/test-track/backend/src/main/java/io/metersphere/controller/TestCaseController.java index 9e4259fa2b..00259a3d07 100644 --- a/test-track/backend/src/main/java/io/metersphere/controller/TestCaseController.java +++ b/test-track/backend/src/main/java/io/metersphere/controller/TestCaseController.java @@ -242,6 +242,11 @@ public class TestCaseController { return testCaseService.testCaseImport(file, request, httpRequest); } + @GetMapping("/check/permission/{projectId}") + public boolean checkProjectPermission(@PathVariable String projectId) { + return baseCheckPermissionService.getUserRelatedProjectIds().contains(projectId); + } + @GetMapping("/export/template/{projectId}/{importType}") @RequiresPermissions(PermissionConstants.PROJECT_TRACK_CASE_READ_EXPORT) public void testCaseTemplateExport(@PathVariable String projectId, @PathVariable String importType, HttpServletResponse response) { diff --git a/test-track/frontend/src/api/testCase.js b/test-track/frontend/src/api/testCase.js index 297b9a1b03..57cc67377e 100644 --- a/test-track/frontend/src/api/testCase.js +++ b/test-track/frontend/src/api/testCase.js @@ -1,6 +1,4 @@ import {post, get} from "metersphere-frontend/src/plugins/request"; -import {$success} from "metersphere-frontend/src/plugins/message"; -import i18n from "@/i18n"; import {getCurrentProjectID, getCurrentWorkspaceId} from "metersphere-frontend/src/utils/token"; import {buildPagePath} from "@/api/base-network"; @@ -246,3 +244,7 @@ export function saveCaseRelevanceScenario(caseId, param) { export function saveCaseRelevanceLoad(caseId, param) { return post(BASE_URL + "relate/test/performance/" + caseId, param); } + +export function checkProjectPermission(projectId) { + return get(BASE_URL + "check/permission/" + projectId); +} diff --git a/test-track/frontend/src/business/plan/view/comonents/functional/FunctionalTestCaseEdit.vue b/test-track/frontend/src/business/plan/view/comonents/functional/FunctionalTestCaseEdit.vue index dbb4aa8f82..6820650f9f 100644 --- a/test-track/frontend/src/business/plan/view/comonents/functional/FunctionalTestCaseEdit.vue +++ b/test-track/frontend/src/business/plan/view/comonents/functional/FunctionalTestCaseEdit.vue @@ -43,7 +43,11 @@ - + @@ -166,6 +171,8 @@ import StatusTableItem from "@/business/common/tableItems/planview/StatusTableIt import {testPlanTestCaseEdit, testPlanTestCaseGet} from "@/api/remote/plan/test-plan-test-case"; import {testPlanEditStatus} from "@/api/remote/plan/test-plan"; import {getTestTemplate} from "@/api/custom-field-template"; +import {getCurrentProjectID} from "@/business/utils/sdk-utils"; +import {checkProjectPermission} from "@/api/testCase"; export default { name: "FunctionalTestCaseEdit", @@ -190,6 +197,7 @@ export default { return { loading: false, showDialog: false, + hasProjectPermission: true, testCase: {}, index: 0, editor: ClassicEditor, @@ -235,7 +243,7 @@ export default { }, pageTotal() { return Math.ceil(this.total / this.pageSize); - } + }, }, methods: { handleClose() { @@ -431,6 +439,10 @@ export default { }); }, openTestCaseEdit(testCase, tableData) { + checkProjectPermission(testCase.projectId) + .then(r => { + this.hasProjectPermission = r.data; + }); this.showDialog = true; this.activeTab = 'detail'; this.hasTapdId = false;