72 lines
2.3 KiB
TypeScript
72 lines
2.3 KiB
TypeScript
import type { ViewSection } from '@/components/business/system-view-dialog/index.vue'
|
|
import { acceptConclusionLabel } from '@/utils/qc-labels'
|
|
import {
|
|
formatProductionFieldValue,
|
|
resolveProductionReceptionFields,
|
|
type ProductionReceptionRecord
|
|
} from '@/utils/sample-production-reception-fields'
|
|
|
|
export function buildQcReceptionViewFields(
|
|
r: Record<string, unknown>,
|
|
d?: Record<string, unknown>
|
|
): ViewSection['fields'] {
|
|
const accept = String(r.acceptConclusion || d?.acceptConclusion || '')
|
|
return [
|
|
{ label: '接收时间', value: String(r.receptionTime || d?.receptionTime || '—') },
|
|
{ label: '接收经手人', value: String(r.handlerName || d?.handlerName || '—') },
|
|
...(accept === 'js'
|
|
? [
|
|
{
|
|
label: '实验室入库编码',
|
|
value: String(r.labStorageCode || d?.labStorageCode || '—')
|
|
}
|
|
]
|
|
: []),
|
|
{
|
|
label: '接收温度(℃)',
|
|
value: r.receiveTemperature ? `${r.receiveTemperature}℃` : '—'
|
|
},
|
|
{
|
|
label: '结论',
|
|
value:
|
|
String(r.acceptConclusionLabel || '') ||
|
|
acceptConclusionLabel(accept) ||
|
|
'—',
|
|
tagType: accept === 'js' ? 'success' : accept === 'bj' ? 'danger' : 'info'
|
|
},
|
|
{
|
|
label: '检查项',
|
|
checkItems: (r.checkResults as ViewSection['fields'][0]['checkItems']) ?? [],
|
|
span: true
|
|
},
|
|
{ label: '备注', value: String(r.remark || '—'), span: true }
|
|
]
|
|
}
|
|
|
|
export function buildProductionReceptionViewSection(
|
|
productionReception: ProductionReceptionRecord | null | undefined,
|
|
sourceType: string,
|
|
sampleTypeName: string
|
|
): ViewSection {
|
|
if (!productionReception) {
|
|
return {
|
|
title: '生产接收',
|
|
fields: [{ label: '状态', value: '生产尚未登记', span: true }]
|
|
}
|
|
}
|
|
const fields: ViewSection['fields'] = [
|
|
{ label: '处理时间', value: productionReception.processTime || '—' },
|
|
{ label: '处理人', value: productionReception.handlerName || '—' }
|
|
]
|
|
for (const def of resolveProductionReceptionFields(sourceType, sampleTypeName)) {
|
|
fields.push({
|
|
label: def.label,
|
|
value: formatProductionFieldValue(def, productionReception)
|
|
})
|
|
}
|
|
if (productionReception.remark) {
|
|
fields.push({ label: '备注', value: productionReception.remark, span: true })
|
|
}
|
|
return { title: '生产接收', fields }
|
|
}
|