diff --git a/web-admin/src/utils/protocol-source-attachment.test.ts b/web-admin/src/utils/protocol-source-attachment.test.ts index 8bffcb85..60e82a6d 100644 --- a/web-admin/src/utils/protocol-source-attachment.test.ts +++ b/web-admin/src/utils/protocol-source-attachment.test.ts @@ -42,10 +42,19 @@ describe('protocol-source-attachment', () => { }) assert.deepEqual( groups.map((g) => g.label), - ['知情同意书', '孕妇健康调查表'] + ['知情同意书', '孕妇健康调查表', '协议附件'] ) assert.ok(groups.every((g) => g.files.length === 1)) - assert.equal(groups.length, 2) + }) + + it('accepts attachments alias for cell storage protocol files', () => { + const groups = getSourceProtocolAttachmentGroups({ + sourceType: 'cell_storage', + attachments: [{ id: 'alias' }] + }) + const protocol = groups.find((g) => g.label === '协议附件') + assert.ok(protocol) + assert.equal(protocol.files.length, 1) }) it('groups research donation attachments for reception dialog', () => { diff --git a/web-admin/src/utils/protocol-source-attachment.ts b/web-admin/src/utils/protocol-source-attachment.ts index 84a8b635..cfcd2eba 100644 --- a/web-admin/src/utils/protocol-source-attachment.ts +++ b/web-admin/src/utils/protocol-source-attachment.ts @@ -37,13 +37,17 @@ export function getConsentProtocolAttachment( /** * 样本接收弹窗:按来源返回质检需查看的协议附件分组。 - * 细胞存储:仅知情同意书 / 孕妇健康调查表(不展示「协议附件」项) + * 细胞存储:知情同意书 / 孕妇健康调查表 / 协议附件 * 科研捐赠:知情同意书 / 传染病检测报告 / 其他附件 + * 兼容 attachments 别名(协议详情字段名)。 */ export function getSourceProtocolAttachmentGroups( row: Record ): ProtocolSourceAttachmentMeta[] { const source = String(row.sourceType || 'cell_storage').trim() + const protocolFiles = normalizeAttachmentFiles( + row.protocolAttachmentFiles ?? row.attachments + ) if (source === 'research_donation') { return [ { @@ -68,6 +72,10 @@ export function getSourceProtocolAttachmentGroups( { label: '孕妇健康调查表', files: normalizeAttachmentFiles(row.healthSurveyAttachmentFiles) + }, + { + label: '协议附件', + files: protocolFiles } ] }