From 61c8cf13f7e5d57d1b6d588949e1f5aa1c6b6cc8 Mon Sep 17 00:00:00 2001 From: ouyangxq <775153912@qq.com> Date: Wed, 16 Sep 2026 16:17:41 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/OceanBookingLinkDialog.test.ts | 19 +++++++++++++++++++ .../components/OceanBookingLinkDialog.vue | 2 +- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/src/modules/container-loading/components/OceanBookingLinkDialog.test.ts b/src/modules/container-loading/components/OceanBookingLinkDialog.test.ts index 21ad88d8..2f04920a 100644 --- a/src/modules/container-loading/components/OceanBookingLinkDialog.test.ts +++ b/src/modules/container-loading/components/OceanBookingLinkDialog.test.ts @@ -57,4 +57,23 @@ describe('OceanBookingLinkDialog', () => { expect(wrapper.emitted('linked')).toHaveLength(1) wrapper.unmount() }) + + it('prefills and preserves a real container number recorded before booking linkage', async () => { + const existingContainer = { ...container, containerNo: 'MSCU6639870' } + const wrapper = mount(OceanBookingLinkDialog, { + props: { modelValue: true, container: existingContainer }, + global: { plugins: [ElementPlus] }, + }) + await flushPromises() + const vm = wrapper.vm as unknown as { candidateKey: string; containerNo: string; save: () => Promise } + expect(vm.containerNo).toBe('MSCU6639870') + + vm.candidateKey = '101:202' + await vm.save() + + expect(linkContainerOceanBooking).toHaveBeenCalledExactlyOnceWith('9001', { + oceanBookingId: '101', requirementId: '202', containerNo: 'MSCU6639870', expectedVersion: 7, + }) + wrapper.unmount() + }) }) diff --git a/src/modules/container-loading/components/OceanBookingLinkDialog.vue b/src/modules/container-loading/components/OceanBookingLinkDialog.vue index d4e9d600..91633f8b 100644 --- a/src/modules/container-loading/components/OceanBookingLinkDialog.vue +++ b/src/modules/container-loading/components/OceanBookingLinkDialog.vue @@ -31,7 +31,7 @@ function close() { emit('update:modelValue', false) } async function loadCandidates() { const target = props.container candidateKey.value = '' - containerNo.value = '' + containerNo.value = normalizeContainerNo(target?.containerNo) candidates.value = [] error.value = null if (!target) return