审计日志并入系统管理、规范项目成员获取逻辑

This commit is contained in:
Cheng Zhou
2025-12-26 14:57:57 +08:00
parent 7c9befc3c9
commit 71db309e12
17 changed files with 94 additions and 116 deletions
+17
View File
@@ -9,6 +9,23 @@ export const displayEnum = (enumMap: Record<string, string>, value?: string | nu
return enumMap[value] || displayFallback;
};
export const getUserDisplayName = (user?: any) => {
if (!user) return null;
return user.display_name || user.full_name || user.username || user.email || null;
};
export const getMemberDisplayName = (member?: any) => {
if (!member) return null;
return (
getUserDisplayName(member.user) ||
member.display_name ||
member.full_name ||
member.username ||
member.email ||
null
);
};
export const displayUser = (
userId?: string | null,
opts?: { users?: Record<string, string>; members?: Record<string, string> }
+2 -2
View File
@@ -3,7 +3,7 @@ import { useAuthStore } from "../store/auth";
import { useStudyStore } from "../store/study";
const PERMISSIONS: Record<string, string[]> = {
"milestone.create": ["ADMIN", "PM"],
"milestone.create": ["ADMIN", "PM", "CRA", "PV", "IMP"],
"subject.create": ["ADMIN", "PM", "CRA"],
"subject.enroll": ["ADMIN", "PM", "CRA"],
"subject.complete": ["ADMIN", "PM", "CRA"],
@@ -26,7 +26,7 @@ const PERMISSIONS: Record<string, string[]> = {
};
const REASONS: Record<string, string> = {
"milestone.create": "仅项目负责人可以维护里程碑",
"milestone.create": "仅项目成员可维护里程碑",
"subject.enroll": "仅 PM/CRA 可更新受试者状态",
"subject.complete": "仅 PM/CRA 可更新受试者状态",
"subject.drop": "仅 PM/CRA 可更新受试者状态",