修复(权限管理):统一 PM 系统导航与权限校验
This commit is contained in:
@@ -32,20 +32,22 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 管理后台控制卡片 - 常驻左侧底部 -->
|
||||
<div v-if="isAdmin" class="sidebar-admin">
|
||||
<button class="admin-action-card" type="button" @click="enterAdmin">
|
||||
<!-- ADMIN / PM 可进入系统管理,其他角色仅可选择项目 -->
|
||||
<div v-if="canEnterManagement" class="sidebar-admin">
|
||||
<button class="admin-action-card" type="button" @click="enterManagement">
|
||||
<span class="admin-glow-layer" aria-hidden="true"></span>
|
||||
<div class="admin-card-head">
|
||||
<div class="admin-icon-box">
|
||||
<el-icon><Monitor /></el-icon>
|
||||
</div>
|
||||
<div class="admin-text-box">
|
||||
<span class="admin-kicker">ADMIN SYSTEM</span>
|
||||
<strong>管理后台</strong>
|
||||
<span class="admin-kicker">{{ isAdmin ? "ADMIN SYSTEM" : "SYSTEM MANAGEMENT" }}</span>
|
||||
<strong>系统管理</strong>
|
||||
</div>
|
||||
</div>
|
||||
<p class="admin-desc">人员账号管理、项目授权、审计及系统配置</p>
|
||||
<p class="admin-desc">
|
||||
{{ isAdmin ? "人员账号管理、项目授权、审计及系统配置" : "查看并维护您负责项目的授权与范围配置" }}
|
||||
</p>
|
||||
<div class="admin-foot">
|
||||
<span>进入控制台</span>
|
||||
<el-icon><ArrowRight /></el-icon>
|
||||
@@ -170,13 +172,16 @@ const loading = ref(false);
|
||||
const loggingOut = ref(false);
|
||||
const isTransitioning = ref(false);
|
||||
const isAdmin = computed(() => isSystemAdmin(auth.user));
|
||||
const canEnterManagement = computed(() =>
|
||||
isAdmin.value || projects.value.some((project) => project.role_in_study === "PM"),
|
||||
);
|
||||
|
||||
const userDisplayName = computed(
|
||||
() => auth.user?.full_name || auth.user?.username || auth.user?.email || TEXT.common.labels.userFallback,
|
||||
);
|
||||
const userInitial = computed(() => userDisplayName.value.charAt(0).toUpperCase() || TEXT.common.labels.userInitialFallback);
|
||||
const entrySubtitle = computed(() =>
|
||||
isAdmin.value ? "进入管理后台,或选择一个项目开始桌面工作。" : "请选择本次要进入的项目。",
|
||||
canEnterManagement.value ? "进入系统管理,或选择一个项目开始桌面工作。" : "请选择本次要进入的项目。",
|
||||
);
|
||||
|
||||
const statusLabel = (status: string | undefined) =>
|
||||
@@ -194,12 +199,20 @@ const loadProjects = async () => {
|
||||
}
|
||||
};
|
||||
|
||||
const enterAdmin = () => {
|
||||
if (!isAdmin.value) return;
|
||||
const enterManagement = () => {
|
||||
if (!canEnterManagement.value) return;
|
||||
isTransitioning.value = true;
|
||||
window.setTimeout(() => {
|
||||
studyStore.clearCurrentStudy();
|
||||
router.push("/admin/users");
|
||||
window.setTimeout(async () => {
|
||||
if (isAdmin.value) {
|
||||
studyStore.clearCurrentStudy();
|
||||
} else {
|
||||
const pmProject = projects.value.find((project) => project.role_in_study === "PM");
|
||||
if (pmProject) {
|
||||
studyStore.setCurrentStudy(pmProject);
|
||||
await studyStore.loadCurrentStudyPermissions().catch(() => {});
|
||||
}
|
||||
}
|
||||
await router.push(isAdmin.value ? "/admin/users" : "/admin/projects");
|
||||
}, 300);
|
||||
};
|
||||
|
||||
@@ -414,7 +427,7 @@ onMounted(() => {
|
||||
color: #ef4444;
|
||||
}
|
||||
|
||||
/* 常驻管理后台卡片(精致浅色流光) */
|
||||
/* 常驻系统管理卡片(精致浅色流光) */
|
||||
.sidebar-admin {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user