From 115461683bcda5744821a91b9e4204c95727a306 Mon Sep 17 00:00:00 2001 From: liuyihe <2513762445@qq.com> Date: Thu, 8 Oct 2026 20:16:19 +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 --- .../pages/ReturnInventoryManagementView.test.ts | 16 +++++++++++++++- .../pages/ReturnInventoryManagementView.vue | 16 ++++++++++++---- 2 files changed, 27 insertions(+), 5 deletions(-) diff --git a/src/modules/overseas-warehouse/pages/ReturnInventoryManagementView.test.ts b/src/modules/overseas-warehouse/pages/ReturnInventoryManagementView.test.ts index 28851d13..d317cca9 100644 --- a/src/modules/overseas-warehouse/pages/ReturnInventoryManagementView.test.ts +++ b/src/modules/overseas-warehouse/pages/ReturnInventoryManagementView.test.ts @@ -7,9 +7,10 @@ import { UI_PREFERENCE_SCOPE, preferenceStorageKey } from '@/shared/utils/uiLayo import { getReturnCarton, listReturnCartons, listReturnInventoryMovements, listReturnStock, listReturnPackingSources } from '../api/returnInventory' import { listReturnPackingPlans } from '../api/relabelOrders' import ReturnInventoryManagementView from './ReturnInventoryManagementView.vue' +import { listPlatformTenants } from '@/modules/iam' vi.mock('@/modules/iam', () => ({ - listPlatformTenants: vi.fn().mockResolvedValue({ records: [{ id: 'customer-1', tenantName: '测试客户', status: 'ACTIVE' }] }), + listPlatformTenants: vi.fn().mockResolvedValue({ records: [{ id: 'customer-1', tenantName: '测试客户', status: 'ACTIVE' }], page: 1, size: 200, total: 1, pages: 1 }), listSharedReceivingOverseasWarehouseOptions: vi.fn().mockResolvedValue([{ id: 'warehouse-1', warehouseName: '测试仓库' }]), })) vi.mock('../api/returnInventory', () => ({ @@ -52,6 +53,19 @@ afterEach(() => { }) describe('ReturnInventoryManagementView shared list', () => { + it('includes customers from later server pages in the packing customer selector', async () => { + vi.mocked(listPlatformTenants) + .mockResolvedValueOnce({ records: [{ id: 'customer-1', tenantName: '柏悦物流demo2', status: 'ACTIVE' }], page: 1, size: 200, total: 201, pages: 2 } as Awaited>) + .mockResolvedValueOnce({ records: [{ id: 'customer-2', tenantName: '柏悦物流', status: 'ACTIVE' }], page: 2, size: 200, total: 201, pages: 2 } as Awaited>) + const wrapper = await mountView('inventory') + expect(listPlatformTenants).toHaveBeenNthCalledWith(1, { page: 1, size: 200, status: 'ACTIVE' }) + expect(listPlatformTenants).toHaveBeenNthCalledWith(2, { page: 2, size: 200, status: 'ACTIVE' }) + await wrapper.findAll('button').find(button => button.text().includes('创建合箱计划'))!.trigger('click') + await flushPromises() + const form = wrapper.findAllComponents({ name: 'ElForm' }).find(form => form.classes().includes('packing-form'))! + const options = form.getComponent({ name: 'ElSelect' }).findAllComponents({ name: 'ElOption' }) + expect(options.map(option => option.props('label'))).toEqual(['柏悦物流demo2', '柏悦物流']) + }) it('finds boxes by contained SKU while retaining mixed-box contents and selected cartons', async () => { vi.mocked(listReturnPackingSources).mockResolvedValue({records:[ {cartonMark:'BOX-A',sourceUnitType:'BOX',items:[{skuCode:'SKU-APPLE',quantity:2},{skuCode:'SKU-OTHER',quantity:3}]}, diff --git a/src/modules/overseas-warehouse/pages/ReturnInventoryManagementView.vue b/src/modules/overseas-warehouse/pages/ReturnInventoryManagementView.vue index b5662a29..3e53d40c 100644 --- a/src/modules/overseas-warehouse/pages/ReturnInventoryManagementView.vue +++ b/src/modules/overseas-warehouse/pages/ReturnInventoryManagementView.vue @@ -206,17 +206,25 @@ function warehouseName(warehouseId?: string) { function statusLabel(status?: string) { return status === "AVAILABLE" ? "可用" : status === "MERGED" ? "已合箱" : "—"; } +async function loadCustomerOptions() { + const records: PlatformTenantResource[] = []; + let page = 1; + while (true) { + const result = await listPlatformTenants({ page, size: 200, status: "ACTIVE" }); + records.push(...result.records); + if (page >= result.pages || !result.records.length) return records; + page += 1; + } +} async function loadOptions() { optionsLoading.value = true; try { const [customerResult, warehouseResult] = await Promise.allSettled([ - // 客户规模上限约 1,000,退货库存的客户下拉需要一次拿全量, - // 否则只取第一页会漏掉较早创建的启用客户。 - listPlatformTenants({ page: 1, size: 1000, status: "ACTIVE" }), + loadCustomerOptions(), listSharedReceivingOverseasWarehouseOptions(), ]); if (customerResult.status === "fulfilled") - customers.value = customerResult.value.records; + customers.value = customerResult.value; else customers.value = []; if (warehouseResult.status === "fulfilled") warehouses.value = warehouseResult.value;