feat: 权限管理组织获取权限调整
This commit is contained in:
parent
1f04a8423f
commit
a3e8453536
|
@ -14,6 +14,7 @@
|
|||
<script setup lang="ts">
|
||||
import { getProjectList } from '@/api/modules/project-management/project';
|
||||
import useAppStore from '@/store/modules/app';
|
||||
import { hasAnyPermission } from '@/utils/permission';
|
||||
|
||||
import type { ProjectListItem } from '@/models/setting/project';
|
||||
|
||||
|
@ -44,8 +45,12 @@
|
|||
|
||||
onBeforeMount(async () => {
|
||||
try {
|
||||
if (appStore.currentOrgId && hasAnyPermission(['PROJECT_BASE_INFO:READ'])) {
|
||||
const res = await getProjectList(appStore.getCurrentOrgId);
|
||||
projectList.value = res;
|
||||
} else {
|
||||
projectList.value = [];
|
||||
}
|
||||
} catch (error) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.log(error);
|
||||
|
|
|
@ -132,6 +132,7 @@
|
|||
import useLocale from '@/locale/useLocale';
|
||||
import useAppStore from '@/store/modules/app';
|
||||
import useUserStore from '@/store/modules/user';
|
||||
import { hasAnyPermission } from '@/utils/permission';
|
||||
|
||||
import type { ProjectListItem } from '@/models/setting/project';
|
||||
|
||||
|
@ -153,7 +154,7 @@
|
|||
|
||||
async function initProjects() {
|
||||
try {
|
||||
if (appStore.currentOrgId) {
|
||||
if (appStore.currentOrgId && hasAnyPermission(['PROJECT_BASE_INFO:READ'])) {
|
||||
const res = await getProjectList(appStore.getCurrentOrgId);
|
||||
projectList.value = res;
|
||||
} else {
|
||||
|
|
|
@ -52,7 +52,7 @@ function filterProject(role: UserRole, id: string) {
|
|||
return role && role.type === 'PROJECT' && role.scopeId === id;
|
||||
}
|
||||
function filterOrganization(role: UserRole, id: string) {
|
||||
return role && role.type === 'ORGANIZATION' && role.scopeId === id;
|
||||
return role && role.type === 'ORGANIZATION' && (role.scopeId === id || role.scopeId === 'global');
|
||||
}
|
||||
function filterSystem(role: UserRole, id: string) {
|
||||
return role && role.type === 'SYSTEM' && role.scopeId === id;
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
import { getProjectList, switchProject } from '@/api/modules/project-management/project';
|
||||
import { useI18n } from '@/hooks/useI18n';
|
||||
import { useAppStore, useUserStore } from '@/store';
|
||||
import { getFirstRouteNameByPermission } from '@/utils/permission';
|
||||
import { getFirstRouteNameByPermission, hasAnyPermission } from '@/utils/permission';
|
||||
|
||||
import { SelectValue } from '@/models/projectManagement/menuManagement';
|
||||
import type { ProjectListItem } from '@/models/setting/project';
|
||||
|
@ -49,8 +49,11 @@
|
|||
|
||||
async function initProjects() {
|
||||
try {
|
||||
if (appStore.getCurrentOrgId && hasAnyPermission(['PROJECT_BASE_INFO:READ'])) {
|
||||
const res = await getProjectList(appStore.getCurrentOrgId);
|
||||
projectList.value = res;
|
||||
} else {
|
||||
projectList.value = [];
|
||||
}
|
||||
} catch (error) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.log(error);
|
||||
|
|
Loading…
Reference in New Issue