中文:收口权限与中心/立项配置改造

This commit is contained in:
Cheng Zhou
2026-05-12 10:16:52 +08:00
parent 6e90370a5f
commit 77e842637d
67 changed files with 706 additions and 669 deletions
+4 -8
View File
@@ -47,13 +47,10 @@
<el-icon><Calendar /></el-icon>
<span>{{ TEXT.menu.projectMilestones }}</span>
</el-menu-item>
<el-sub-menu index="fees">
<template #title>
<el-icon><Coin /></el-icon>
<span>{{ TEXT.menu.finance }}</span>
</template>
<el-menu-item index="/fees/contracts">{{ TEXT.menu.feeContracts }}</el-menu-item>
</el-sub-menu>
<el-menu-item index="/fees/contracts">
<el-icon><Coin /></el-icon>
<span>{{ TEXT.menu.feeContracts }}</span>
</el-menu-item>
<el-sub-menu index="materials">
<template #title>
<el-icon><Box /></el-icon>
@@ -226,7 +223,6 @@ const study = useStudyStore();
const router = useRouter();
const route = useRoute();
const isAdmin = computed(() => auth.user?.role === "ADMIN");
const isPm = computed(() => auth.user?.role === "PM" || study.currentStudyRole === "PM");
const isCollapsed = ref(localStorage.getItem("ctms_sidebar_collapsed") === "1");
/* 动态设置 body 上的侧边栏宽度 CSS 变量,用于全局弹窗定位偏移 */
@@ -67,6 +67,7 @@ import AttachmentUploader from "./AttachmentUploader.vue";
import { formatFileSize } from "./attachmentUtils";
import { useAuthStore } from "../../store/auth";
import { useStudyStore } from "../../store/study";
import { getProjectRole, isSystemAdmin } from "../../utils/roles";
import { listMembers } from "../../api/members";
import { displayDateTime, displayUser, getMemberDisplayName, getUserDisplayName } from "../../utils/display";
import { TEXT } from "../../locales";
@@ -203,11 +204,10 @@ const preview = (row: any) => {
const canDelete = (row: any) => {
if (props.readonly) return false;
const userId = auth.user?.id;
const role = auth.user?.role;
const projectRole = study.currentStudyRole || (study.currentStudy as any)?.role_in_study;
const projectRole = getProjectRole(study.currentStudy, study.currentStudyRole);
const ownerId =
row.uploaded_by_id || (row.uploaded_by && typeof row.uploaded_by === "object" ? row.uploaded_by.id : row.uploaded_by);
return userId === ownerId || role === "ADMIN" || projectRole === "PM";
return userId === ownerId || isSystemAdmin(auth.user) || projectRole === "PM";
};
const remove = async (row: any) => {
@@ -83,6 +83,7 @@ import { fetchAttachments, uploadAttachment, deleteAttachment } from "../../api/
import { listMembers } from "../../api/members";
import { useAuthStore } from "../../store/auth";
import { useStudyStore } from "../../store/study";
import { getProjectRole, isSystemAdmin } from "../../utils/roles";
import { formatFileSize } from "../attachments/attachmentUtils";
import { displayUser, getMemberDisplayName, getUserDisplayName } from "../../utils/display";
import StateEmpty from "../StateEmpty.vue";
@@ -269,11 +270,10 @@ const download = (row: any) => {
const canDelete = (row: any) => {
if (props.readonly) return false;
const userId = auth.user?.id;
const role = auth.user?.role;
const projectRole = study.currentStudyRole || (study.currentStudy as any)?.role_in_study;
const projectRole = getProjectRole(study.currentStudy, study.currentStudyRole);
const ownerId =
row.uploaded_by_id || (row.uploaded_by && typeof row.uploaded_by === "object" ? row.uploaded_by.id : row.uploaded_by);
return userId === ownerId || role === "ADMIN" || projectRole === "PM";
return userId === ownerId || isSystemAdmin(auth.user) || projectRole === "PM";
};
const remove = async (row: any) => {