From f1721b2780c5563a77bfb762019d4bc5fdce7fcb Mon Sep 17 00:00:00 2001 From: ouyangxq <775153912@qq.com> Date: Fri, 14 Aug 2026 12:50:50 +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 --- .../container-loading/pages/ContainersView.test.ts | 1 + .../pages/GlobalSmartLoadingView.test.ts | 3 +++ src/modules/customs/pages/CustomsCasesView.test.ts | 7 +++++++ .../ocean-bookings/pages/OceanBookingsView.test.ts | 11 +++++++++++ .../trucking/pages/TruckAppointmentsView.test.ts | 12 +++++++++++- 5 files changed, 33 insertions(+), 1 deletion(-) diff --git a/src/modules/container-loading/pages/ContainersView.test.ts b/src/modules/container-loading/pages/ContainersView.test.ts index 8b32937d..7e8d5f8b 100644 --- a/src/modules/container-loading/pages/ContainersView.test.ts +++ b/src/modules/container-loading/pages/ContainersView.test.ts @@ -14,6 +14,7 @@ import { getContainer, getContainerOverview, listContainers } from '../api/platf vi.mock('@/modules/warehouses', () => ({ listAllPlatformWarehouses: vi.fn() })) vi.mock('@/modules/master-data', () => ({ listPlatformPartners: vi.fn() })) vi.mock('@/modules/ocean-bookings', () => ({ listOceanBookings: vi.fn() })) +vi.mock('@/modules/iam', () => ({ listPlatformTenants: vi.fn().mockResolvedValue({ records: [], page: 1, size: 200, total: 0, pages: 0 }) })) const accessCan = vi.hoisted(() => vi.fn()) vi.mock('@/core/access/accessPreview', () => ({ useAccessPreviewStore: () => ({ can: accessCan }) })) vi.mock('../api/platformContainerLoading', () => ({ listContainers: vi.fn(), getContainer: vi.fn(), getContainerOverview: vi.fn(), getContainerClearance: vi.fn(), uploadContainerClearance: vi.fn(), completeContainerClearance: vi.fn(), uploadContainerDocument: vi.fn(), downloadContainerDocument: vi.fn(), downloadContainerPdaPhoto: vi.fn(), markContainerException: vi.fn(), cancelContainerException: vi.fn(), createContainer: vi.fn(), updateContainer: vi.fn(), updateContainerTransport: vi.fn() })) diff --git a/src/modules/container-loading/pages/GlobalSmartLoadingView.test.ts b/src/modules/container-loading/pages/GlobalSmartLoadingView.test.ts index cc25338e..58a02296 100644 --- a/src/modules/container-loading/pages/GlobalSmartLoadingView.test.ts +++ b/src/modules/container-loading/pages/GlobalSmartLoadingView.test.ts @@ -24,6 +24,9 @@ vi.mock('vue-router', () => ({ vi.mock('@/core/access/accessPreview', () => ({ useAccessPreviewStore: () => ({ can: () => true }), })) +vi.mock('@/modules/iam', () => ({ + listPlatformTenants: vi.fn().mockResolvedValue({ records: [], page: 1, size: 200, total: 0, pages: 0 }), +})) vi.mock('../api/platformContainerLoading', () => ({ listContainers: vi.fn(), getSmartLoadingPlanByBooking: vi.fn(), diff --git a/src/modules/customs/pages/CustomsCasesView.test.ts b/src/modules/customs/pages/CustomsCasesView.test.ts index 50e7b0ef..a300bf83 100644 --- a/src/modules/customs/pages/CustomsCasesView.test.ts +++ b/src/modules/customs/pages/CustomsCasesView.test.ts @@ -38,4 +38,11 @@ describe('CustomsCasesView', () => { expect(source).not.toContain("customs:view')\" link") expect(source).toContain(':total="total" stripe row-key="id"') }) + it('uses an active name-only customer selector backed by customerId', () => { + expect(source).toContain("listPlatformTenants({ page: 1, size: 200, status: 'ACTIVE' })") + expect(source).toContain("customer.status === 'ACTIVE'") + expect(source).toContain("customer.legalName?.trim() || customer.tenantName") + expect(source).toContain("customerId: String(filters.value.customerId || '') || undefined") + expect(source).not.toContain('customer.tenantCode') + }) }) diff --git a/src/modules/ocean-bookings/pages/OceanBookingsView.test.ts b/src/modules/ocean-bookings/pages/OceanBookingsView.test.ts index 5c57e88d..dfe31c21 100644 --- a/src/modules/ocean-bookings/pages/OceanBookingsView.test.ts +++ b/src/modules/ocean-bookings/pages/OceanBookingsView.test.ts @@ -35,3 +35,14 @@ describe('OceanBookingsView visual action contract', () => { expect(source).toContain(':total="total" stripe preference-key="ocean-bookings"') }) }) + +describe('OceanBookingsView customer filter contract', () => { + const source = readFileSync(resolve(process.cwd(), 'src/modules/ocean-bookings/pages/OceanBookingsView.vue'), 'utf8') + it('loads active customers, displays names only and submits customerId', () => { + expect(source).toContain("listPlatformTenants({ page: 1, size: 200, status: 'ACTIVE' })") + expect(source).toContain("customer.status === 'ACTIVE'") + expect(source).toContain("customer.legalName?.trim() || customer.tenantName") + expect(source).toContain("customerId: String(query.customerId || '') || undefined") + expect(source).not.toContain('customer.tenantCode') + }) +}) diff --git a/src/modules/trucking/pages/TruckAppointmentsView.test.ts b/src/modules/trucking/pages/TruckAppointmentsView.test.ts index b43aebe4..325daa76 100644 --- a/src/modules/trucking/pages/TruckAppointmentsView.test.ts +++ b/src/modules/trucking/pages/TruckAppointmentsView.test.ts @@ -14,6 +14,9 @@ const source = readFileSync(resolve(process.cwd(), 'src/modules/trucking/pages/T vi.mock('../api/platformTrucking', () => ({ listTruckAppointments: vi.fn(), })) +vi.mock('@/modules/iam', () => ({ + listPlatformTenants: vi.fn().mockResolvedValue({ records: [], page: 1, size: 200, total: 0, pages: 0 }), +})) const row: TruckAppointmentResource = { id: '9001', appointmentNo: 'TA-9001', status: 'DISPATCHED', customerName: '示例企业', orderNo: 'ORD-1', containerBookingId: '77', @@ -34,7 +37,7 @@ describe('TruckAppointmentsView', () => { it('loads the real list and renders relationship snapshots', async () => { const wrapper = mount(TruckAppointmentsView, { global: { plugins: [ElementPlus] } }) await flushPromises() - expect(listTruckAppointments).toHaveBeenCalledWith({ page: 1, size: 20, keyword: '', status: '', containerBookingId: '', containerType: '' }) + expect(listTruckAppointments).toHaveBeenCalledWith({ page: 1, size: 20, customerId: '', keyword: '', status: '', containerBookingId: '', containerType: '' }) expect(wrapper.text()).toContain('TA-9001') expect(wrapper.text()).toContain('CONT-1') expect(wrapper.text()).not.toContain('77') @@ -119,6 +122,13 @@ describe('TruckAppointmentsView', () => { expect(source).not.toContain("key: 'payableAmount'") expect(source).not.toContain("key: 'receivableAmount'") }) + it('filters with an active name-only customer selector and stable customerId', () => { + expect(source).toContain("listPlatformTenants({ page: 1, size: 200, status: 'ACTIVE' })") + expect(source).toContain("customer.status === 'ACTIVE'") + expect(source).toContain("customer.legalName?.trim() || customer.tenantName") + expect(source).toContain("customerId: String(model.customerId || '')") + expect(source).not.toContain('customer.tenantCode') + }) it('uses bordered list actions instead of text links', () => { expect(source).toContain('size="small" type="primary" plain') expect(source).toContain('size="small" :aria-label="appointmentActionLabel(\'编辑\'')