修复(权限管理):统一 PM 系统导航与权限校验

This commit is contained in:
Cheng Zhou
2026-07-10 22:12:59 +08:00
parent f11a5c84d9
commit f2fa10c178
47 changed files with 4071 additions and 1555 deletions
+9 -3
View File
@@ -438,7 +438,7 @@ const routes: RouteRecordRaw[] = [
path: "permissions/project",
name: "AdminPermissionsProject",
component: PermissionManagement,
meta: { title: "项目权限配置", systemPermission: SYSTEM_PERMISSION_PROJECT_CONFIG },
meta: { title: "项目访问控制", systemPermission: SYSTEM_PERMISSION_PROJECT_CONFIG },
},
],
},
@@ -592,8 +592,14 @@ router.beforeEach(async (to, _from, next) => {
}
if (isDesktopRuntime && token && !isAdmin && to.path.startsWith("/admin")) {
next({ path: DESKTOP_PROJECT_ENTRY_PATH });
return;
const hasPmProject = studyStore.currentStudyRole === "PM" || (studyStore.currentStudy as any)?.role_in_study === "PM";
if (!hasPmProject) await studyStore.ensureDefaultPmStudy().catch(() => {});
const canAccessProjectManagement = studyStore.currentStudyRole === "PM" || (studyStore.currentStudy as any)?.role_in_study === "PM";
if (!canAccessProjectManagement) {
next({ path: DESKTOP_PROJECT_ENTRY_PATH });
return;
}
if (!studyStore.currentPermissions) await studyStore.loadCurrentStudyPermissions().catch(() => {});
}
if (isDesktopRuntime && token && isAdmin && to.path.startsWith("/admin") && studyStore.currentStudy) {