优化中心联系人展示名称解析

- 新增中心联系人展示名解析服务,支持从逗号分隔用户 ID 解析姓名\n- 中心列表接口返回 contact_display,避免前端依赖项目成员权限才能展示联系人姓名\n- 中心管理和立项会议授权页面优先使用后端联系人展示名\n- 补充联系人解析服务测试和立项会议授权页面展示顺序测试
This commit is contained in:
Cheng Zhou
2026-06-04 16:30:17 +08:00
parent d6452e3f9d
commit 4ea0e88c98
7 changed files with 118 additions and 1 deletions
+1
View File
@@ -153,6 +153,7 @@ const memberNameMap = computed(() => {
});
const contactLabel = (row: any) => {
if (row?.contact_display) return row.contact_display;
if (!row?.contact) return TEXT.common.fallback;
return String(row.contact)
.split(",")
@@ -19,4 +19,20 @@ describe("StartupMeetingAuth permissions", () => {
expect(source).toContain("canCreateAuth");
expect(source).toContain("if (!canCreateAuth.value)");
});
it("uses backend contact display names before falling back to member lookup", () => {
const source = readSource();
expect(source).toContain("row.contact_display");
expect(source.indexOf("row.contact_display")).toBeLessThan(source.indexOf("memberNameMap.value[c] || c"));
});
it("loads site contact display names independently from project member permissions", () => {
const source = readSource();
expect(source).toContain("fetchSites(studyId, { limit: 500 })");
expect(source).toContain("if (canReadMembers.value)");
expect(source.indexOf("fetchSites(studyId, { limit: 500 })")).toBeLessThan(source.indexOf("if (canReadMembers.value)"));
expect(source.indexOf("contact_display: site.contact_display")).toBeLessThan(source.indexOf("const membersResp = canReadMembers.value"));
});
});
@@ -85,6 +85,7 @@ const siteActiveMap = computed(() => {
});
const contactLabel = (row: any) => {
if (row?.contact_display) return row.contact_display;
if (!row?.contact) return TEXT.common.fallback;
return String(row.contact)
.split(",")
@@ -106,6 +107,7 @@ const kickoffRows = computed(() => {
site_id: site.id,
site_name: site.name || TEXT.common.fallback,
contact: site.contact,
contact_display: site.contact_display,
kickoff_date: meeting?.kickoff_date || null,
meeting_id: meeting?.id,
status: meeting?.kickoff_date ? "COMPLETED" : "PENDING",