fix(web-admin): 科研捐赠导出补齐运费并按批次合并单元格
列表未返回样本运费批次导致运费列为空。导出按同一运费批次合并运输方式与运费列,并按模板对齐储存状态等字段。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
6be55186b0
commit
d413398b3d
6 files changed
+193
-17
No files matched your search
@@ -7,6 +7,7 @@ import {
|
||||
RESEARCH_HEADERS,
|
||||
buildCellStorageLedgerRows,
|
||||
buildCustomerServiceLedgerRows,
|
||||
buildFreightMergeRanges,
|
||||
buildPresignLedgerRows,
|
||||
buildResearchLedgerRows,
|
||||
formatLedgerDateTime
|
||||
@@ -141,14 +142,20 @@ describe('buildResearchLedgerRows', () => {
|
||||
birthOrder: 1,
|
||||
maternalBloodCollectTime: '2025-08-29 13:30:00',
|
||||
consentFormUrls: 'http://example/consent',
|
||||
remark: ''
|
||||
remark: '',
|
||||
freightId: 'fr1',
|
||||
freightTransportLabel: '专线车',
|
||||
freightAmountLabel: '100'
|
||||
} as unknown as ProtocolAuditFlatRow
|
||||
const [row] = buildResearchLedgerRows([flat])
|
||||
const { rows } = buildResearchLedgerRows([flat])
|
||||
const row = rows[0]
|
||||
assert.equal(row.length, RESEARCH_HEADERS.length)
|
||||
assert.equal(row[1], '2025年')
|
||||
assert.equal(row[4], '202508001')
|
||||
assert.equal(row[6], '已作废(实验室废弃)')
|
||||
assert.equal(row[6], '实验室废弃')
|
||||
assert.equal(row[7], '母血乙肝阳性')
|
||||
assert.equal(row[16], '专线车')
|
||||
assert.equal(row[17], '100')
|
||||
assert.equal(row[18], '女')
|
||||
assert.equal(row[19], '3000g')
|
||||
assert.equal(row[20], '顺产')
|
||||
@@ -176,15 +183,57 @@ describe('buildResearchLedgerRows', () => {
|
||||
newbornDeliveryTime: '',
|
||||
newbornSex: '',
|
||||
newbornWeightGram: '',
|
||||
deliveryMode: '',
|
||||
deliveryMode: 'pgc',
|
||||
birthOrder: '',
|
||||
maternalBloodCollectTime: '',
|
||||
consentFormUrls: '',
|
||||
remark: ''
|
||||
remark: '',
|
||||
freightId: '',
|
||||
freightTransportLabel: '',
|
||||
freightAmountLabel: ''
|
||||
} as unknown as ProtocolAuditFlatRow
|
||||
const [row] = buildResearchLedgerRows([flat])
|
||||
assert.equal(row[6], '已作废(属地废弃)')
|
||||
const { rows } = buildResearchLedgerRows([flat])
|
||||
const row = rows[0]
|
||||
assert.equal(row[6], '属地废弃')
|
||||
assert.equal(row[7], '属地废弃')
|
||||
assert.equal(row[20], '剖腹产')
|
||||
assert.equal(row[22], '无母血')
|
||||
})
|
||||
|
||||
it('merges transport and freight columns for the same freight batch', () => {
|
||||
const base = {
|
||||
protocol: { donationStatus: 'sxz', voidType: '', voidDesc: '', monthlyVerifyNo: '' },
|
||||
sampleCollectTime: '2025-09-11 18:13:00',
|
||||
motherName: '甲',
|
||||
sampleTypeName: 'NK',
|
||||
regionName: '常州',
|
||||
hospitalName: '溧阳市人民医院',
|
||||
labStorageCode: 'UBMC1',
|
||||
freightId: 'batch-a',
|
||||
freightTransportLabel: '专线车',
|
||||
freightAmountLabel: '100'
|
||||
}
|
||||
const { rows, merges } = buildResearchLedgerRows([
|
||||
{ ...base, sampleIndex: 0 } as unknown as ProtocolAuditFlatRow,
|
||||
{
|
||||
...base,
|
||||
sampleIndex: 1,
|
||||
motherName: '乙',
|
||||
labStorageCode: 'UBMC2'
|
||||
} as unknown as ProtocolAuditFlatRow
|
||||
])
|
||||
assert.equal(rows[0][16], '专线车')
|
||||
assert.equal(rows[0][17], '100')
|
||||
assert.equal(rows[1][16], '')
|
||||
assert.equal(rows[1][17], '')
|
||||
assert.deepEqual(merges, [
|
||||
{ startRow: 2, endRow: 3, startCol: 17, endCol: 17 },
|
||||
{ startRow: 2, endRow: 3, startCol: 18, endCol: 18 }
|
||||
])
|
||||
assert.deepEqual(buildFreightMergeRanges(['', 'x', 'x', 'y']), [
|
||||
{ startRow: 3, endRow: 4, startCol: 17, endCol: 17 },
|
||||
{ startRow: 3, endRow: 4, startCol: 18, endCol: 18 }
|
||||
])
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
Reference in new issue
Block a user