35 lines
1.1 KiB
TypeScript
35 lines
1.1 KiB
TypeScript
export type ProtocolDocKind = 'cell_storage' | 'research_donation'
|
||
|
||
const DOC_TYPE_LABEL: Record<ProtocolDocKind, string> = {
|
||
cell_storage: '采集协议单',
|
||
research_donation: '捐赠协议单'
|
||
}
|
||
|
||
export function getProtocolDocTypeLabel(kind: ProtocolDocKind): string {
|
||
return DOC_TYPE_LABEL[kind]
|
||
}
|
||
|
||
/** 用户姓名 + 协议类型,如「张三的采集协议单」 */
|
||
export function formatProtocolDocSubject(
|
||
kind: ProtocolDocKind,
|
||
row?: { motherName?: string | null; customerName?: string | null } | null
|
||
): string {
|
||
const name = String(row?.motherName || row?.customerName || '').trim()
|
||
const typeLabel = DOC_TYPE_LABEL[kind]
|
||
return name ? `${name}的${typeLabel}` : typeLabel
|
||
}
|
||
|
||
export function formatProtocolDocDeleteConfirm(
|
||
kind: ProtocolDocKind,
|
||
row?: { motherName?: string | null; customerName?: string | null } | null
|
||
): string {
|
||
return `确认删除${formatProtocolDocSubject(kind, row)}?`
|
||
}
|
||
|
||
export function formatProtocolDocBatchDeleteConfirm(
|
||
kind: ProtocolDocKind,
|
||
count: number
|
||
): string {
|
||
return `确认删除选中的 ${count} 条${DOC_TYPE_LABEL[kind]}?`
|
||
}
|