优化
This commit is contained in:
@@ -129,6 +129,14 @@ describe('ContainersView', () => {
|
||||
expect(push).toHaveBeenNthCalledWith(3, { name: 'loading-lists', query: { planId: '9103', warehouseId: '8' } })
|
||||
})
|
||||
|
||||
it('uses active customer names and sends the stable customerId filter', () => {
|
||||
const source = readFileSync(resolve(process.cwd(), 'src/modules/container-loading/pages/ContainersView.vue'), 'utf8')
|
||||
expect(source).toContain("listPlatformTenants({ page: 1, size: 200, status: 'ACTIVE' })")
|
||||
expect(source).toContain("customer.legalName?.trim() || customer.tenantName")
|
||||
expect(source).toContain('customerId: applied.value.customerId || undefined')
|
||||
expect(source).not.toContain('customer.tenantCode')
|
||||
})
|
||||
|
||||
it('uses the list permission for detail while keeping edit independent', async () => {
|
||||
accessCan.mockImplementation((permission: string) => permission === 'platform:firstleg:container:list')
|
||||
const router = createTestRouter()
|
||||
|
||||
@@ -76,6 +76,14 @@ describe('GlobalSmartLoadingView', () => {
|
||||
expect(wrapper.text()).toContain('ORD-1')
|
||||
})
|
||||
|
||||
it('filters candidates by an active name-only customer selector and accountId', () => {
|
||||
const source = readFileSync(resolve(process.cwd(), 'src/modules/container-loading/pages/GlobalSmartLoadingView.vue'), 'utf8')
|
||||
expect(source).toContain("listPlatformTenants({ page: 1, size: 200, status: 'ACTIVE' })")
|
||||
expect(source).toContain("customer.legalName?.trim() || customer.tenantName")
|
||||
expect(source).toContain('item.accountId !== customerId')
|
||||
expect(source).not.toContain('customer.tenantCode')
|
||||
})
|
||||
|
||||
it('rounds capacity percentages and hides column settings in embedded tables', async () => {
|
||||
vi.mocked(listContainers).mockResolvedValue({ records: [{ ...container, capacityCbm: 100, maxWeightKg: 100000 }], page: 1, size: 100, total: 1, pages: 1 })
|
||||
vi.mocked(getSmartLoadingPlanByBooking).mockResolvedValue({
|
||||
|
||||
@@ -7,6 +7,12 @@ const detailSource = readFileSync(resolve(process.cwd(), 'src/modules/loading-li
|
||||
const preloadDetailSource = readFileSync(resolve(process.cwd(), 'src/modules/loading-lists/pages/PreloadPlanDetailView.vue'), 'utf8')
|
||||
|
||||
describe('LoadingListsView', () => {
|
||||
it('filters both list modes by an active name-only customer selector', () => {
|
||||
expect(source).toContain("listPlatformTenants({ page: 1, size: 200, status: 'ACTIVE' })")
|
||||
expect(source).toContain("customer.legalName?.trim() || customer.tenantName")
|
||||
expect(source).toContain("customerId: String(query.customerId || '').trim() || undefined")
|
||||
expect(source).not.toContain('customer.tenantCode')
|
||||
})
|
||||
it('keeps the operation column first and fixed left in both lists', () => {
|
||||
const actionColumns = [...source.matchAll(/key: 'actions', label: '操作', fixed: 'left'/g)]
|
||||
expect(actionColumns).toHaveLength(2)
|
||||
|
||||
@@ -17,6 +17,9 @@ describe('OceanBookingDetailView interaction contract', () => {
|
||||
})
|
||||
|
||||
it('hides unavailable customers instead of filling the selector with disabled options', () => {
|
||||
expect(source).toContain("listPlatformTenants({ page: 1, size: 200, status: 'ACTIVE' })")
|
||||
expect(source).toContain('customer.legalName?.trim() || customer.tenantName')
|
||||
expect(source).not.toContain('customer.tenantCode')
|
||||
expect(source).toContain("customer.status === 'ACTIVE' || String(customer.id) === String(form.data.customerId)")
|
||||
expect(source).toContain('v-for="customer in selectableCustomers"')
|
||||
expect(source).not.toContain(':disabled="customer.status !== \'ACTIVE\'"')
|
||||
|
||||
@@ -72,6 +72,14 @@ describe('OutboundDispatchesView', () => {
|
||||
expect(wrapper.text()).not.toContain('READY_FOR_DISPATCH')
|
||||
})
|
||||
|
||||
it('loads only active customer names for the filter', () => {
|
||||
const source = readFileSync(resolve(process.cwd(), 'src/modules/outbound-dispatch/pages/OutboundDispatchesView.vue'), 'utf8')
|
||||
expect(source).toContain("listPlatformTenants({ page: 1, size: 200, status: 'ACTIVE' })")
|
||||
expect(source).toContain("records.filter((customer) => customer.status === 'ACTIVE')")
|
||||
expect(source).toContain("item.legalName?.trim() || item.tenantName")
|
||||
expect(source).not.toContain('item.tenantCode')
|
||||
})
|
||||
|
||||
it('does not issue a search when reset returns to the initial state', async () => {
|
||||
const wrapper = mountPage()
|
||||
await flushPromises()
|
||||
|
||||
@@ -28,6 +28,9 @@ describe('PortSchedulesView', () => {
|
||||
expect(source).toContain("from '@/modules/ocean-bookings'")
|
||||
expect(source).toContain("listPlatformTenants({ page: 1, size: 200, status: 'ACTIVE' })")
|
||||
expect(source).toContain('listOceanBookings({ page: 1, size: 200, customerId })')
|
||||
expect(source).toContain("customerId: String(query.customerId || '') || undefined")
|
||||
expect(source).toContain('customer.legalName?.trim() || customer.tenantName')
|
||||
expect(source).not.toContain('customer.tenantCode')
|
||||
expect(source).toContain("form.oceanBookingId = ''")
|
||||
expect(source).not.toContain('label="客户 ID"')
|
||||
expect(source).not.toContain('label="订舱 ID"')
|
||||
|
||||
@@ -13,6 +13,9 @@ describe('TruckAppointmentForm interaction contract', () => {
|
||||
expect(source).toContain('listAllPlatformWarehouses')
|
||||
expect(source).not.toContain('label="承运商 ID"')
|
||||
expect(source).not.toContain('label="客户关联 ID"')
|
||||
expect(source).toContain("listPlatformTenants({ page: 1, size: 200, status: 'ACTIVE' })")
|
||||
expect(source).toContain('customer.legalName?.trim() || customer.tenantName')
|
||||
expect(source).not.toContain('customer.tenantCode')
|
||||
})
|
||||
|
||||
it('synchronizes ids and names and recovers failed option loading', () => {
|
||||
|
||||
Reference in New Issue
Block a user