fix(web-admin): 科研捐赠导出补齐运费并按批次合并单元格

列表未返回样本运费批次导致运费列为空。导出按同一运费批次合并运输方式与运费列,并按模板对齐储存状态等字段。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
zlwuandCursor committed 2026-11-06 12:06:49 +08:00
1 parent 6be55186b0
commit d413398b3d
6 files changed
+193 -17

No files matched your search

@@ -37,6 +37,10 @@ export type ProtocolAuditFlatRow = {
labStorageCode: string
transportType: string
transportLabel: string
/** 样本运费批次;多样本共用时 id 相同 */
freightId: string
freightTransportLabel: string
freightAmountLabel: string
paymentSummary: QcProtocolPaymentSummary | null
monthlyVerifyNo: string
donationStatus: string
@@ -90,7 +94,13 @@ export function flattenProtocolAuditRows(
slots.forEach((item, sampleIndex) => {
const rec = item || {}
const transport = asRecord(rec.transport)
const freight = asRecord(rec.freight)
const transportType = str(transport?.transportType)
const freightAmountLabel = str(freight?.freightAmountLabel)
const freightAmount =
freight?.freightAmount == null || freight?.freightAmount === ''
? ''
: String(freight.freightAmount)
out.push({
rowKey: `${protocolId}|${str(rec.sampleCode) || sampleIndex}`,
protocolId,
@@ -113,6 +123,9 @@ export function flattenProtocolAuditRows(
labStorageCode: str(rec.labStorageCode),
transportType,
transportLabel: '',
freightId: str(freight?.id),
freightTransportLabel: str(freight?.transportModeLabel) || str(freight?.transportMode),
freightAmountLabel: freightAmountLabel || freightAmount,
paymentSummary:
protocol.paymentSummary && typeof protocol.paymentSummary === 'object'
? (protocol.paymentSummary as QcProtocolPaymentSummary)