From c43861ba434fb0e997afc5c861c58ee43e467079 Mon Sep 17 00:00:00 2001 From: song-cc-rock Date: Fri, 5 May 2023 17:04:50 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E5=B7=A5=E4=BD=9C=E5=8F=B0):=20=E4=BB=AA?= =?UTF-8?q?=E8=A1=A8=E7=9B=98Card=E8=B7=B3=E8=BD=AC=E6=9D=83=E9=99=90?= =?UTF-8?q?=E6=8E=A7=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1025906 --user=宋昌昌 【工作台】项目只有首页权限从工作台中查看测试计划提示异常 https://www.tapd.cn/55049933/s/1368856 --- .../src/business/creation/Creation.vue | 5 +++- .../dashboard/components/MyDashboardCard.vue | 27 ++++++++++++++++--- .../frontend/src/business/focus/Focus.vue | 5 +++- .../src/business/head/TableHeader.vue | 2 +- .../src/business/upcoming/Upcoming.vue | 5 +++- 5 files changed, 37 insertions(+), 7 deletions(-) diff --git a/workstation/frontend/src/business/creation/Creation.vue b/workstation/frontend/src/business/creation/Creation.vue index d233a1f8a7..cf6286fc90 100644 --- a/workstation/frontend/src/business/creation/Creation.vue +++ b/workstation/frontend/src/business/creation/Creation.vue @@ -1,7 +1,7 @@ @@ -26,6 +26,7 @@ export default { methods: { setDefaultCurrentTodo() { // 设置当前默认TAB页为下一个有权限的菜单TAB + // 如果该用户无权限存在, 则空白 if (hasPermissions('PROJECT_TRACK_CASE:READ')) { this.currentTodo = 'track_case'; } else if (hasPermissions('PROJECT_TRACK_PLAN:READ')) { @@ -40,6 +41,8 @@ export default { this.currentTodo = 'api_automation'; } else if (hasPermissions('PROJECT_PERFORMANCE_TEST:READ')) { this.currentTodo = 'performance'; + } else { + this.currentTodo = 'empty' } } }, diff --git a/workstation/frontend/src/business/dashboard/components/MyDashboardCard.vue b/workstation/frontend/src/business/dashboard/components/MyDashboardCard.vue index c57b97d1eb..2833dbc394 100644 --- a/workstation/frontend/src/business/dashboard/components/MyDashboardCard.vue +++ b/workstation/frontend/src/business/dashboard/components/MyDashboardCard.vue @@ -8,9 +8,9 @@
- + class="card-info" shadow="never" @click.native="gotoDetail(option.name, option.permission)">
{{option.label}}
{{option.value}}
@@ -24,6 +24,7 @@ import {getFollowTotalCount, getUpcomingTotalCount} from "@/api/workstation"; import {getCurrentWorkspaceId} from "metersphere-frontend/src/utils/token"; +import {hasPermissions} from "metersphere-frontend/src/utils/permission" export default { name: "MyUpcomingCard", @@ -42,48 +43,62 @@ export default { name: 'track_case', value:0, label: this.$t('workstation.table_name.track_case'), + permission: 'PROJECT_TRACK_CASE:READ' }, { name:"track_plan", value:0, label: this.$t('workstation.table_name.track_plan'), + permission: 'PROJECT_TRACK_PLAN:READ' }, { name:"track_review", value:0, label: this.$t('workstation.table_name.track_review'), + permission: 'PROJECT_TRACK_REVIEW:READ' }, { name:"track_issue", value:0, label: this.$t('workstation.table_name.track_issue'), + permission: 'PROJECT_TRACK_ISSUE:READ' }, { name:"api_definition", value:0, label: this.$t('workstation.table_name.api_definition'), + permission: 'PROJECT_API_DEFINITION:READ' }, { name:"api_case", value:0, label: this.$t('workstation.table_name.api_case'), + permission: 'PROJECT_API_DEFINITION:READ' }, { name:"api_automation", value:0, label: this.$t('workstation.table_name.api_automation'), + permission: 'PROJECT_API_SCENARIO:READ' }, { name:"performance", value:0, label: this.$t('workstation.table_name.performance'), + permission: 'PROJECT_PERFORMANCE_TEST:READ' }, ], title:"", }; }, methods:{ - gotoDetail(name){ + hasPermissions(permission) { + return hasPermissions(permission); + }, + gotoDetail(name, permission){ + if (!hasPermissions(permission)) { + return; + } if (this.cardType === 'upcoming') { let upcoming =this.$router.resolve({ path: "/workstation/upcoming", @@ -158,6 +173,12 @@ export default { background: #F5F6F7; } } +.no-permission { + background: #F5F6F7; + &:hover { + cursor: not-allowed; + } +} .top-css { left: 24px; font-weight: 650; diff --git a/workstation/frontend/src/business/focus/Focus.vue b/workstation/frontend/src/business/focus/Focus.vue index 3859bb6d55..6885b0f584 100644 --- a/workstation/frontend/src/business/focus/Focus.vue +++ b/workstation/frontend/src/business/focus/Focus.vue @@ -1,7 +1,7 @@ @@ -24,6 +24,7 @@ export default { methods: { setDefaultCurrentTodo() { // 设置当前默认TAB页为下一个有权限的菜单TAB + // 如果该用户无权限存在, 则空白 if (hasPermissions('PROJECT_TRACK_CASE:READ')) { this.currentTodo = 'track_case'; } else if (hasPermissions('PROJECT_TRACK_PLAN:READ')) { @@ -38,6 +39,8 @@ export default { this.currentTodo = 'api_automation'; } else if (hasPermissions('PROJECT_PERFORMANCE_TEST:READ')) { this.currentTodo = 'performance'; + } else { + this.currentTodo = 'empty' } } }, diff --git a/workstation/frontend/src/business/head/TableHeader.vue b/workstation/frontend/src/business/head/TableHeader.vue index c840ae17bf..154b0283b1 100644 --- a/workstation/frontend/src/business/head/TableHeader.vue +++ b/workstation/frontend/src/business/head/TableHeader.vue @@ -5,7 +5,7 @@ - + diff --git a/workstation/frontend/src/business/upcoming/Upcoming.vue b/workstation/frontend/src/business/upcoming/Upcoming.vue index e50ae784c4..112706487c 100644 --- a/workstation/frontend/src/business/upcoming/Upcoming.vue +++ b/workstation/frontend/src/business/upcoming/Upcoming.vue @@ -2,7 +2,7 @@