|
|
@@ -1,10 +1,11 @@
|
|
|
-const SOURCE_LABELS = Object.freeze({ cell_storage: '细胞存储', research_donation: '科研捐赠' })
|
|
|
+import { resolveStatusTag, receptionSource, transportType } from '../status-tag-registry.js'
|
|
|
|
|
|
-function dictionaryLabel(map, code, providedLabel) {
|
|
|
- const label = String(providedLabel || '').trim()
|
|
|
+function transportDisplay(code, providedLabel) {
|
|
|
const key = String(code || '').trim()
|
|
|
+ const label = String(providedLabel || '').trim()
|
|
|
if (label && label !== key) return label
|
|
|
- return map[key] || (key ? '未知' : '—')
|
|
|
+ if (!key) return '—'
|
|
|
+ return resolveStatusTag(transportType, key).label
|
|
|
}
|
|
|
|
|
|
function person(name, id) {
|
|
|
@@ -24,29 +25,39 @@ export default {
|
|
|
key: 'freight',
|
|
|
resource: 'freights',
|
|
|
actions: {
|
|
|
- specialist: ['view', 'create', 'edit', 'link', 'unlink'],
|
|
|
- manager: ['view', 'create', 'edit', 'link', 'unlink']
|
|
|
+ specialist: ['view', 'create', 'edit', 'delete', 'link', 'unlink'],
|
|
|
+ manager: ['view', 'create', 'edit', 'delete', 'link', 'unlink']
|
|
|
},
|
|
|
listParams: ({ status } = {}) => ({ transportMode: status || '', includeItems: true }),
|
|
|
statusOptions: [{ text: '全部运输方式', value: '' }],
|
|
|
- filterFields: [
|
|
|
- { key: 'transportMode', label: '运输方式', type: 'select', optionKey: 'transportModes' },
|
|
|
+ // 运费列表用搜索下方 van-dropdown-menu(对齐预签约),不走筛选弹层
|
|
|
+ filterFields: [],
|
|
|
+ inlineDropdownFilters: [
|
|
|
+ { key: 'transportMode', allText: '全部运输方式', optionKey: 'transportModes' },
|
|
|
{
|
|
|
- key: 'sampleSource', label: '样本来源', type: 'select', options: [
|
|
|
+ key: 'sampleSource',
|
|
|
+ allText: '全部样本来源',
|
|
|
+ options: [
|
|
|
{ text: '细胞存储', value: 'cell_storage' },
|
|
|
{ text: '科研捐赠', value: 'research_donation' }
|
|
|
]
|
|
|
- },
|
|
|
- { key: 'createTimeRange', label: '创建时间', type: 'date-range' }
|
|
|
+ }
|
|
|
],
|
|
|
detailSections(detail) {
|
|
|
+ const transportCode = String(detail?.transportMode || '').trim()
|
|
|
+ const transportTag = resolveStatusTag(transportType, transportCode)
|
|
|
return [
|
|
|
{
|
|
|
key: 'base',
|
|
|
title: '运费信息',
|
|
|
fields: [
|
|
|
{ label: '批次号', value: detail?.freightNo || '—' },
|
|
|
- { label: '运输方式', value: dictionaryLabel({}, detail?.transportMode, detail?.transportModeLabel), tag: true, tagType: 'primary' },
|
|
|
+ {
|
|
|
+ label: '运输方式',
|
|
|
+ value: transportDisplay(transportCode, detail?.transportModeLabel),
|
|
|
+ tag: true,
|
|
|
+ tagType: transportTag.tagType
|
|
|
+ },
|
|
|
{ label: '运费金额', value: money(detail?.freightAmount) },
|
|
|
{ label: '关联数', value: String(detail?.visibleItemCount ?? detail?.items?.length ?? 0) },
|
|
|
{ label: '创建人', value: person(detail?.creatorName || detail?.createByName, detail?.createBy) },
|
|
|
@@ -60,19 +71,23 @@ export default {
|
|
|
key: 'items',
|
|
|
title: '关联样本',
|
|
|
fields: [],
|
|
|
- cards: (detail?.items || []).map((item, index) => ({
|
|
|
- key: String(item?.id || `item-${index}`),
|
|
|
- title: item?.sampleCode || `样本 ${index + 1}`,
|
|
|
- statusText: dictionaryLabel(SOURCE_LABELS, item?.sampleSource),
|
|
|
- fields: [
|
|
|
- { label: '来源', value: dictionaryLabel(SOURCE_LABELS, item?.sampleSource) },
|
|
|
- { label: '协议单号', value: item?.protocolNo || '—' },
|
|
|
- { label: '样本编码', value: item?.sampleCode || '—' },
|
|
|
- { label: '样本类型', value: item?.sampleTypeName || '—' },
|
|
|
- { label: '母亲姓名', value: item?.motherName || '—' },
|
|
|
- { label: '子女姓名', value: item?.newbornName || '—' }
|
|
|
- ]
|
|
|
- }))
|
|
|
+ cards: (detail?.items || []).map((item, index) => {
|
|
|
+ const source = resolveStatusTag(receptionSource, item?.sampleSource)
|
|
|
+ return {
|
|
|
+ key: String(item?.id || `item-${index}`),
|
|
|
+ title: item?.sampleCode || `样本 ${index + 1}`,
|
|
|
+ statusText: source.label,
|
|
|
+ statusTone: source.tagType,
|
|
|
+ fields: [
|
|
|
+ { label: '来源', value: source.label, tag: true, tagType: source.tagType },
|
|
|
+ { label: '协议单号', value: item?.protocolNo || '—' },
|
|
|
+ { label: '样本编码', value: item?.sampleCode || '—' },
|
|
|
+ { label: '样本类型', value: item?.sampleTypeName || '—' },
|
|
|
+ { label: '母亲姓名', value: item?.motherName || '—' },
|
|
|
+ { label: '子女姓名', value: item?.newbornName || '—' }
|
|
|
+ ]
|
|
|
+ }
|
|
|
+ })
|
|
|
}
|
|
|
]
|
|
|
},
|
|
|
@@ -83,8 +98,13 @@ export default {
|
|
|
if (action === 'unlink') return Array.isArray(detailItems) ? detailItems : []
|
|
|
return Array.isArray(optionRows) ? optionRows : []
|
|
|
},
|
|
|
- formSections: [{ key: 'base', title: '运费批次', fields: [
|
|
|
- { key: 'transportMode', label: '运输方式', type: 'select', optionKey: 'transportModes', required: true },
|
|
|
- { key: 'freightAmount', label: '运费金额', type: 'number', required: true }
|
|
|
- ] }]
|
|
|
+ formSections: [{
|
|
|
+ key: 'base',
|
|
|
+ title: '运费批次',
|
|
|
+ fieldsLayout: 'grid-2',
|
|
|
+ fields: [
|
|
|
+ { key: 'transportMode', label: '运输方式', type: 'select', optionKey: 'transportModes', required: true },
|
|
|
+ { key: 'freightAmount', label: '运费金额', type: 'number', required: true }
|
|
|
+ ]
|
|
|
+ }]
|
|
|
}
|