From 678bccd4d11521c73fe71cb847a4c3ae05597ea5 Mon Sep 17 00:00:00 2001 From: ouyangxq <775153912@qq.com> Date: Fri, 2 Oct 2026 13:39:15 +0800 Subject: [PATCH] fix(admin): distinguish linked bookings from missing channel names --- .../containerChannelLabel.test.ts | 17 +++++++++++++++++ .../container-loading/containerChannelLabel.ts | 5 +++++ .../pages/ContainerDetailView.vue | 3 ++- .../container-loading/pages/ContainersView.vue | 3 ++- 4 files changed, 26 insertions(+), 2 deletions(-) create mode 100644 src/modules/container-loading/containerChannelLabel.test.ts create mode 100644 src/modules/container-loading/containerChannelLabel.ts diff --git a/src/modules/container-loading/containerChannelLabel.test.ts b/src/modules/container-loading/containerChannelLabel.test.ts new file mode 100644 index 00000000..bfe0b7fc --- /dev/null +++ b/src/modules/container-loading/containerChannelLabel.test.ts @@ -0,0 +1,17 @@ +import { describe, expect, it } from 'vitest' +import { containerChannelLabel } from './containerChannelLabel' + +describe('container actual channel label', () => { + it('preserves the supplied channel name regardless of booking linkage', () => { + expect(containerChannelLabel({ channelName: '纽约海铁', oceanBookingId: '123' })).toBe('纽约海铁') + expect(containerChannelLabel({ channelName: '纽约海铁', oceanBookingId: null })).toBe('纽约海铁') + }) + it('does not describe a linked booking as unlinked when the channel is absent', () => { + expect(containerChannelLabel({ channelName: null, oceanBookingId: '123' })).toBe('—') + expect(containerChannelLabel({ channelName: '', oceanBookingId: '123' })).toBe('—') + }) + it('shows pending linkage only when both channel and booking are absent', () => { + expect(containerChannelLabel({ channelName: null, oceanBookingId: null })).toBe('待关联订舱') + expect(containerChannelLabel({ channelName: '', oceanBookingId: undefined })).toBe('待关联订舱') + }) +}) diff --git a/src/modules/container-loading/containerChannelLabel.ts b/src/modules/container-loading/containerChannelLabel.ts new file mode 100644 index 00000000..6edb678b --- /dev/null +++ b/src/modules/container-loading/containerChannelLabel.ts @@ -0,0 +1,5 @@ +import type { ContainerBookingResource } from './types' + +export function containerChannelLabel(container: Pick): string { + return container.channelName || (container.oceanBookingId ? '—' : '待关联订舱') +} diff --git a/src/modules/container-loading/pages/ContainerDetailView.vue b/src/modules/container-loading/pages/ContainerDetailView.vue index 82ccf5c7..2393b935 100644 --- a/src/modules/container-loading/pages/ContainerDetailView.vue +++ b/src/modules/container-loading/pages/ContainerDetailView.vue @@ -24,6 +24,7 @@ import ContainerLastLegFeesPanel from '../components/ContainerLastLegFeesPanel.v import ContainerOverviewPanel from '../components/ContainerOverviewPanel.vue' import OceanBookingLinkDialog from '../components/OceanBookingLinkDialog.vue' import { getSmartLoadingChannelGroup, isSeaRailChannel } from '../smartLoadingChannelGroups' +import { containerChannelLabel } from '../containerChannelLabel' import { cancelContainerException, completeContainerClearance, @@ -542,7 +543,7 @@ onMounted(async () => { await load(); if (isOverseas.value && route.query.action

货柜信息

-
真实订舱
{{ detail.oceanBookingId ? (detail.billOfLadingNo || '已关联') : '未关联' }}关联已放舱订舱
计划渠道
{{ plannedChannelName }}
实际渠道
{{ detail.channelName || '待关联订舱' }}
异常状态
{{ detail.exceptionActive ? '异常' : '正常' }}
目的仓
{{ overseasDestinationText }}
拖车公司
{{ detail.terminalTruckingCompany || workbenchDetail?.terminalDrayage?.fleetSupplierName || '—' }}
+
真实订舱
{{ detail.oceanBookingId ? (detail.billOfLadingNo || '已关联') : '未关联' }}关联已放舱订舱
计划渠道
{{ plannedChannelName }}
实际渠道
{{ containerChannelLabel(detail) }}
异常状态
{{ detail.exceptionActive ? '异常' : '正常' }}
目的仓
{{ overseasDestinationText }}
拖车公司
{{ detail.terminalTruckingCompany || workbenchDetail?.terminalDrayage?.fleetSupplierName || '—' }}
diff --git a/src/modules/container-loading/pages/ContainersView.vue b/src/modules/container-loading/pages/ContainersView.vue index d8270edb..216928b2 100644 --- a/src/modules/container-loading/pages/ContainersView.vue +++ b/src/modules/container-loading/pages/ContainersView.vue @@ -23,6 +23,7 @@ import { getApiErrorDetails, type ApiErrorDetails } from '@/shared/api/http' import { getContainer, listContainers, updateContainer } from '../api/platformContainerLoading' import OceanBookingLinkDialog from '../components/OceanBookingLinkDialog.vue' import { getSmartLoadingChannelGroup } from '../smartLoadingChannelGroups' +import { containerChannelLabel } from '../containerChannelLabel' import { getTerminalDrayageEmails, sendTerminalDrayageEmail, @@ -244,7 +245,7 @@ const allColumns: DataTableColumn[] = [ { key: 'oceanBooking', label: '真实订舱', minWidth: 170, slotName: 'oceanBooking' }, { key: 'warehouseName', prop: 'warehouseName', label: '装柜仓库', minWidth: 160 }, { key: 'channelGroupCode', label: '计划渠道', minWidth: 140, formatter: (row: ContainerBookingResource) => getSmartLoadingChannelGroup(row.channelGroupCode)?.name || '—' }, - { key: 'channelName', label: '实际渠道', minWidth: 160, formatter: (row: ContainerBookingResource) => row.channelName || '待关联订舱' }, + { key: 'channelName', label: '实际渠道', minWidth: 160, formatter: (row: ContainerBookingResource) => containerChannelLabel(row) }, { key: 'terminalTruckingCompany', label: '码头车队', width: 190, slotName: 'terminalTruckingCompany' }, { key: 'pickupAppointmentAt', label: '预计到仓', width: 210, slotName: 'pickupAppointmentAt' }, { key: 'actualPickupAt', label: '实际到仓', width: 165, slotName: 'actualPickupAt' },