fix(工作台): 工作台TAB权限控制问题

--bug=1025376 --user=宋昌昌 【 系统设置】特殊权限的用户登录后我的工作台-我的待办/我的关注/我创建的页面提示无权限 https://www.tapd.cn/55049933/s/1362999
This commit is contained in:
song-cc-rock 2023-04-14 20:49:09 +08:00 committed by 刘瑞斌
parent bf1d38ffa2
commit 4fc707729a
4 changed files with 87 additions and 6 deletions

View File

@ -8,6 +8,8 @@
<script>
import WorkstationDetail from "@/business/detail/WorkstationDetail";
import { getCurrentProjectID } from "metersphere-frontend/src/utils/token";
import { hasPermissions } from "metersphere-frontend/src/utils/permission"
export default {
name: "Creation",
@ -21,12 +23,31 @@ export default {
projectId: getCurrentProjectID(),
};
},
methods: {},
methods: {
setDefaultCurrentTodo() {
// TABTAB
if (hasPermissions('PROJECT_TRACK_CASE:READ')) {
this.currentTodo = 'track_case';
} else if (hasPermissions('PROJECT_TRACK_PLAN:READ')) {
this.currentTodo = 'track_plan';
} else if (hasPermissions('PROJECT_TRACK_REVIEW:READ')) {
this.currentTodo = 'track_review';
} else if (hasPermissions('PROJECT_TRACK_ISSUE:READ')) {
this.currentTodo = 'track_issue';
} else if (hasPermissions('PROJECT_API_DEFINITION:READ')) {
this.currentTodo = 'api_definition';
} else if (hasPermissions('PROJECT_API_SCENARIO:READ')) {
this.currentTodo = 'api_automation';
} else if (hasPermissions('PROJECT_PERFORMANCE_TEST:READ')) {
this.currentTodo = 'performance';
}
}
},
created() {
if (this.$route.query.name) {
this.currentTodo = this.$route.query.name;
} else {
this.currentTodo = "track_case";
this.setDefaultCurrentTodo();
}
},
};

View File

@ -491,6 +491,24 @@ export default {
this.changeProjectName(projectId);
});
},
setDefaultCurrentTodo() {
// TABTAB
if (hasPermissions('PROJECT_TRACK_CASE:READ')) {
this.currentTodo = 'track_case';
} else if (hasPermissions('PROJECT_TRACK_PLAN:READ')) {
this.currentTodo = 'track_plan';
} else if (hasPermissions('PROJECT_TRACK_REVIEW:READ')) {
this.currentTodo = 'track_review';
} else if (hasPermissions('PROJECT_TRACK_ISSUE:READ')) {
this.currentTodo = 'track_issue';
} else if (hasPermissions('PROJECT_API_DEFINITION:READ')) {
this.currentTodo = 'api_definition';
} else if (hasPermissions('PROJECT_API_SCENARIO:READ')) {
this.currentTodo = 'api_automation';
} else if (hasPermissions('PROJECT_PERFORMANCE_TEST:READ')) {
this.currentTodo = 'performance';
}
}
},
props: {
isFocus: {
@ -529,6 +547,7 @@ export default {
}
},
created() {
this.setDefaultCurrentTodo();
this.init();
this.userStore = useUserStore();
},

View File

@ -8,6 +8,7 @@
<script>
import WorkstationDetail from "@/business/detail/WorkstationDetail";
import { getCurrentProjectID } from "metersphere-frontend/src/utils/token";
import { hasPermissions } from "metersphere-frontend/src/utils/permission"
export default {
name: "Focus",
@ -20,12 +21,31 @@ export default {
projectId: getCurrentProjectID(),
};
},
methods: {},
methods: {
setDefaultCurrentTodo() {
// TABTAB
if (hasPermissions('PROJECT_TRACK_CASE:READ')) {
this.currentTodo = 'track_case';
} else if (hasPermissions('PROJECT_TRACK_PLAN:READ')) {
this.currentTodo = 'track_plan';
} else if (hasPermissions('PROJECT_TRACK_REVIEW:READ')) {
this.currentTodo = 'track_review';
} else if (hasPermissions('PROJECT_TRACK_ISSUE:READ')) {
this.currentTodo = 'track_issue';
} else if (hasPermissions('PROJECT_API_DEFINITION:READ')) {
this.currentTodo = 'api_definition';
} else if (hasPermissions('PROJECT_API_SCENARIO:READ')) {
this.currentTodo = 'api_automation';
} else if (hasPermissions('PROJECT_PERFORMANCE_TEST:READ')) {
this.currentTodo = 'performance';
}
}
},
created() {
if (this.$route.query.name) {
this.currentTodo = this.$route.query.name;
} else {
this.currentTodo = "track_case";
this.setDefaultCurrentTodo();
}
},
};

View File

@ -8,6 +8,8 @@
<script>
import WorkstationDetail from "@/business/detail/WorkstationDetail";
import { getCurrentProjectID } from "metersphere-frontend/src/utils/token";
import {hasPermissions} from "metersphere-frontend/src/utils/permission"
export default {
name: "Upcoming",
@ -20,12 +22,31 @@ export default {
projectId: getCurrentProjectID(),
};
},
methods: {},
methods: {
setDefaultCurrentTodo() {
// TABTAB
if (hasPermissions('PROJECT_TRACK_CASE:READ')) {
this.currentTodo = 'track_case';
} else if (hasPermissions('PROJECT_TRACK_PLAN:READ')) {
this.currentTodo = 'track_plan';
} else if (hasPermissions('PROJECT_TRACK_REVIEW:READ')) {
this.currentTodo = 'track_review';
} else if (hasPermissions('PROJECT_TRACK_ISSUE:READ')) {
this.currentTodo = 'track_issue';
} else if (hasPermissions('PROJECT_API_DEFINITION:READ')) {
this.currentTodo = 'api_definition';
} else if (hasPermissions('PROJECT_API_SCENARIO:READ')) {
this.currentTodo = 'api_automation';
} else if (hasPermissions('PROJECT_PERFORMANCE_TEST:READ')) {
this.currentTodo = 'performance';
}
}
},
created() {
if (this.$route.query.name) {
this.currentTodo = this.$route.query.name;
} else {
this.currentTodo = "track_case";
this.setDefaultCurrentTodo();
}
},
};