Files
zkxw/web-admin/src/utils/protocol-doc-label.ts
T
2026-06-11 15:42:58 +08:00

35 lines
1.1 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
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]}?`
}