From 296a8246ada55047e2ed920a22009ec2f2253943 Mon Sep 17 00:00:00 2001 From: ouyangxq <775153912@qq.com> Date: Tue, 8 Sep 2026 18:16:33 +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 --- .../InventoryCustomerName.behavior.test.ts | 18 ++++++++---------- .../pages/InventoryDetailView.vue | 9 +++++++-- 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/src/modules/overseas-warehouse/pages/InventoryCustomerName.behavior.test.ts b/src/modules/overseas-warehouse/pages/InventoryCustomerName.behavior.test.ts index e400b141..8cfe45f6 100644 --- a/src/modules/overseas-warehouse/pages/InventoryCustomerName.behavior.test.ts +++ b/src/modules/overseas-warehouse/pages/InventoryCustomerName.behavior.test.ts @@ -64,8 +64,7 @@ describe('inventory customer-name snapshots', () => { await flushPromises() expect(wrapper.text()).toContain('华远贸易') expect(wrapper.text()).toContain('洛杉矶仓') - expect(wrapper.text()).toContain('入库单号') - expect(wrapper.text()).toContain(balance.inboundOrderNo) + expect(wrapper.find('.overseas-detail-title p').text()).toBe(`入库单号 / 入仓码 / SKU ${balance.inboundOrderNo} / ${balance.inboundCode} / ${balance.skuCode}`) expect(wrapper.text()).toContain('美本土散板') expect(wrapper.text()).not.toContain('美本土散版') expect(wrapper.text()).not.toContain('ONT8目的仓') @@ -73,22 +72,21 @@ describe('inventory customer-name snapshots', () => { expect(wrapper.text()).not.toContain(balance.id) }) - it('falls back to the inbound code and then an explicit empty business reference without exposing the inventory id', async () => { - vi.mocked(listInventoryBalances).mockResolvedValueOnce({ records: [{ ...balance, inboundOrderNo: '' }], page: 1, size: 10, total: 1, pages: 1 }) + it('combines the available references and then shows an explicit empty business reference without exposing the inventory id', async () => { + vi.mocked(listInventoryBalances).mockResolvedValueOnce({ records: [{ ...balance, inboundOrderNo: '', skuCode: '' }], page: 1, size: 10, total: 1, pages: 1 }) routing.route.params = { inventoryId: balance.id } - routing.route.query = { inboundCode: balance.inboundCode, skuCode: balance.skuCode } + routing.route.query = { inboundCode: balance.inboundCode } const inboundCodeWrapper = mount(InventoryDetailView, { attachTo: document.body, global: { plugins: [createPinia(), ElementPlus] } }) await flushPromises() - expect(inboundCodeWrapper.text()).toContain('入仓码') - expect(inboundCodeWrapper.text()).toContain(balance.inboundCode) + expect(inboundCodeWrapper.find('.overseas-detail-title p').text()).toBe(`入仓码 ${balance.inboundCode}`) expect(inboundCodeWrapper.text()).not.toContain(balance.id) inboundCodeWrapper.unmount() - vi.mocked(listInventoryBalances).mockResolvedValueOnce({ records: [{ ...balance, inboundOrderNo: '', inboundCode: '' }], page: 1, size: 10, total: 1, pages: 1 }) - routing.route.query = { skuCode: balance.skuCode } + vi.mocked(listInventoryBalances).mockResolvedValueOnce({ records: [{ ...balance, inboundOrderNo: '', inboundCode: '', skuCode: '' }], page: 1, size: 10, total: 1, pages: 1 }) + routing.route.query = {} const emptyWrapper = mount(InventoryDetailView, { attachTo: document.body, global: { plugins: [createPinia(), ElementPlus] } }) await flushPromises() - expect(emptyWrapper.text()).toContain('业务标识') + expect(emptyWrapper.find('.overseas-detail-title p').text()).toBe('业务标识 —') expect(emptyWrapper.text()).not.toContain(balance.id) }) }) diff --git a/src/modules/overseas-warehouse/pages/InventoryDetailView.vue b/src/modules/overseas-warehouse/pages/InventoryDetailView.vue index a13990bf..89d55869 100644 --- a/src/modules/overseas-warehouse/pages/InventoryDetailView.vue +++ b/src/modules/overseas-warehouse/pages/InventoryDetailView.vue @@ -8,8 +8,13 @@ import { listInventoryBalances, listInventoryLedger, listInventoryPositions, typ const route = useRoute(); const router = useRouter(); const inventoryId = computed(() => String(route.params.inventoryId || '')) const balance = ref(null); const positions = ref([]); const ledger = ref([]); const loading = ref(false); const loadError = ref(null) function text(value: unknown) { return String(value ?? '').trim() || '—' } -const referenceLabel = computed(() => String(balance.value?.inboundOrderNo || route.query.inboundOrderNo || '').trim() ? '入库单号' : String(balance.value?.inboundCode || route.query.inboundCode || '').trim() ? '入仓码' : '业务标识') -const referenceValue = computed(() => text(balance.value?.inboundOrderNo || route.query.inboundOrderNo || balance.value?.inboundCode || route.query.inboundCode)) +const businessReferences = computed(() => [ + ['入库单号', balance.value?.inboundOrderNo || route.query.inboundOrderNo], + ['入仓码', balance.value?.inboundCode || route.query.inboundCode], + ['SKU', balance.value?.skuCode || route.query.skuCode], +].map(([label, value]) => [String(label), String(value ?? '').trim()] as const).filter(([, value]) => value)) +const referenceLabel = computed(() => businessReferences.value.map(([label]) => label).join(' / ') || '业务标识') +const referenceValue = computed(() => businessReferences.value.map(([, value]) => value).join(' / ') || '—') const productValues = computed(() => ({ 客户: text(balance.value?.customerName), 海外仓: text(balance.value?.overseasWarehouseName), SKU编码: text(balance.value?.skuCode), 产品名称: balance.value ? inventoryProductName(balance.value) : '—', 更新时间: formatOverseasDateTime(balance.value?.updatedAt) })) const stockValues = computed(() => ({ 在库总量: Number(balance.value?.totalPackages || 0), 可用库存: Number(balance.value?.availablePackages || 0), 暂扣库存: Number(balance.value?.holdPackages || 0), 美本土散板: '—', 在途库存: Number(balance.value?.inTransitPackages || 0), 采购库存: Number(balance.value?.procurementPackages || 0), 预计总量: Number(balance.value?.totalPackages || 0) + Number(balance.value?.inTransitPackages || 0) + Number(balance.value?.procurementPackages || 0) })) const productFields = ['客户', '海外仓', 'SKU编码', '产品名称', '更新时间']; const stockFields = ['在库总量', '可用库存', '暂扣库存', '美本土散板', '在途库存', '采购库存', '预计总量']