修复伦理与启动管理的显示问题
This commit is contained in:
@@ -101,6 +101,23 @@ import { exportAuditCsv } from "../../audit/export/auditExportService";
|
||||
import { logAudit } from "../../audit";
|
||||
import { displayDateTime } from "../../utils/display";
|
||||
|
||||
const buildLogKey = (log: any) => {
|
||||
if (log.id) return `id:${log.id}`;
|
||||
return `${log.action || log.eventType || "event"}-${log.entity_id || log.entityId || ""}-${log.created_at || log.timestamp || ""}`;
|
||||
};
|
||||
|
||||
const dedupeLogs = (list: any[]) => {
|
||||
const seen = new Set<string>();
|
||||
const result: any[] = [];
|
||||
list.forEach((log) => {
|
||||
const key = buildLogKey(log);
|
||||
if (seen.has(key)) return;
|
||||
seen.add(key);
|
||||
result.push(log);
|
||||
});
|
||||
return result;
|
||||
};
|
||||
|
||||
const study = useStudyStore();
|
||||
const auth = useAuthStore();
|
||||
const router = useRouter();
|
||||
@@ -163,7 +180,7 @@ const loadLogs = async () => {
|
||||
const { data } = await fetchAuditLogs(study.currentStudy.id, params);
|
||||
const items = Array.isArray(data) ? data : (data as any).items || [];
|
||||
const local = loadLocalLogs();
|
||||
const merged = [...items, ...local];
|
||||
const merged = dedupeLogs([...items, ...local]);
|
||||
rawLogs.value = merged;
|
||||
total.value = (data as any).total || merged.length;
|
||||
enrichLogs();
|
||||
@@ -233,7 +250,7 @@ const fetchAllForExport = async () => {
|
||||
const { data } = await fetchAuditLogs(study.currentStudy.id, params);
|
||||
const items = Array.isArray(data) ? data : (data as any).items || [];
|
||||
const local = loadLocalLogs();
|
||||
const merged = [...items, ...local];
|
||||
const merged = dedupeLogs([...items, ...local]);
|
||||
const userMap = users.value.reduce<Record<string, string>>((acc, cur) => {
|
||||
acc[cur.id] = cur.username;
|
||||
return acc;
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
<el-descriptions-item label="项目名称">{{ project.name }}</el-descriptions-item>
|
||||
<el-descriptions-item label="申办方">{{ project.sponsor || "—" }}</el-descriptions-item>
|
||||
<el-descriptions-item label="状态">{{ statusLabel(project.status) }}</el-descriptions-item>
|
||||
<el-descriptions-item label="创建时间">{{ project.created_at || "—" }}</el-descriptions-item>
|
||||
<el-descriptions-item label="创建时间">{{ displayDateTime(project.created_at) }}</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
<el-skeleton v-else :rows="4" animated />
|
||||
</el-card>
|
||||
@@ -48,6 +48,7 @@ import { fetchStudyDetail } from "../../api/studies";
|
||||
import type { Study } from "../../types/api";
|
||||
import AttachmentList from "../../components/attachments/AttachmentList.vue";
|
||||
import { useStudyStore } from "../../store/study";
|
||||
import { displayDateTime } from "../../utils/display";
|
||||
|
||||
const route = useRoute();
|
||||
const router = useRouter();
|
||||
|
||||
Reference in New Issue
Block a user