diff --git a/src/shared/components/InboundCodeRelationshipDrawer.test.ts b/src/shared/components/InboundCodeRelationshipDrawer.test.ts index a0321eab..fcf998db 100644 --- a/src/shared/components/InboundCodeRelationshipDrawer.test.ts +++ b/src/shared/components/InboundCodeRelationshipDrawer.test.ts @@ -113,6 +113,31 @@ describe('InboundCodeRelationshipDrawer contract', () => { expect(wrapper.text()).toContain('LP-260830-0016') }) + it('distinguishes an unassigned overseas warehouse from a missing warehouse name', async () => { + vi.mocked(getOverseasInboundCodeRelationship).mockResolvedValueOnce({ + inboundCode: 'NYEXX2608300027', found: true, + customer: { customerId: '90071992547409932', customerName: '纽约客户' }, overseasWarehouse: null, + overseasReceivingStatus: 'PENDING_ASSIGNMENT', taillegOrders: [], inboundPlans: [], palletCodes: [], inventory: [], + }) + const unassigned = mountDrawer() + await flushPromises() + expect(unassigned.text()).toContain('尚未分配海外仓') + expect(unassigned.text()).not.toContain('仓库名称待补充') + unassigned.unmount() + + vi.mocked(getOverseasInboundCodeRelationship).mockResolvedValueOnce({ + inboundCode: 'NYEXX2608300027', found: true, + customer: { customerId: '90071992547409932', customerName: '纽约客户' }, + overseasWarehouse: { warehouseId: '90071992547409939', warehouseCode: 'LAX', warehouseName: '' }, + overseasReceivingStatus: 'PENDING_ASSIGNMENT', taillegOrders: [], inboundPlans: [], palletCodes: [], inventory: [], + }) + const missingName = mountDrawer() + await flushPromises() + expect(missingName.text()).toContain('仓库名称待补充') + expect(missingName.text()).not.toContain('尚未分配海外仓') + missingName.unmount() + }) + it('loads only permission-authorized server read models and keeps failures isolated', () => { expect(source).toContain('props.canReadBase') expect(source).toContain('props.canReadLoading') diff --git a/src/shared/components/InboundCodeRelationshipDrawer.vue b/src/shared/components/InboundCodeRelationshipDrawer.vue index bce1f6c4..93fece82 100644 --- a/src/shared/components/InboundCodeRelationshipDrawer.vue +++ b/src/shared/components/InboundCodeRelationshipDrawer.vue @@ -24,6 +24,9 @@ const canReadOverseas = computed(() => props.canReadOverseas) const normalizedCode = computed(() => props.inboundCode.trim()) function display(value: unknown, fallback = '—') { return String(value ?? '').trim() || fallback } +function overseasWarehouseName(value: OverseasInboundCodeRelationship['overseasWarehouse']) { + return value ? display(value.warehouseName, '仓库名称待补充') : '尚未分配海外仓' +} function close(value: boolean) { emit('update:modelValue', value) } async function load() { @@ -77,7 +80,7 @@ watch(() => [props.modelValue, props.inboundCode, props.canReadBase, props.canRe