统一履约状态和节点日志展示并整理装柜与尾程界面

This commit is contained in:
2026-10-28 16:56:32 +08:00
parent a52a6620fc
commit d990637b38
20 changed files with 270 additions and 43 deletions
@@ -10,6 +10,8 @@ import { ApiResponseError } from '@/shared/api/http'
import DataTable from '@/shared/components/DataTable.vue'
import AppDialog from '@/shared/components/AppDialog.vue'
import QueryToolbar from '@/shared/components/QueryToolbar.vue'
import LayoutPreferenceList from '@/shared/components/LayoutPreferenceList.vue'
import { preferenceStorageKey } from '@/shared/utils/uiLayoutPreference'
import { listAllPlatformWarehouses } from '@/modules/warehouses'
import { listContainerArrivalTimes } from '@/modules/container-loading'
import {
@@ -322,10 +324,46 @@ describe('LastMileOrdersView pending order and container conversion', () => {
expect(toolbar.props('availableFields')?.some((field) => field.key === 'orderType')).toBe(true)
})
it('uses the saved first three filters when collapsed and keeps reordered fields after remounting', async () => {
localStorage.setItem(preferenceStorageKey('query', 'anonymous', 'overseas-last-mile-orders-query'), JSON.stringify({
version: 1, order: ['orderNo', 'containerNo', 'inboundCode'], hidden: [],
}))
const wrapper = await mountView()
const toolbar = wrapper.findComponent(QueryToolbar)
const placeholders = () => toolbar.findAll('.query-toolbar__field').map(field => field.get('input').attributes('placeholder'))
expect(placeholders()).toEqual(['请输入尾程单号', '请输入集装箱号', '请输入入仓码'])
const initialCalls = vi.mocked(listLastMileOrders).mock.calls.length
toolbar.vm.$emit('update:modelValue', { ...toolbar.props('modelValue'), containerNo: 'CONT-15' })
await wrapper.vm.$nextTick()
await button(wrapper, '高级筛选')!.trigger('click')
expect(placeholders()).toHaveLength(16)
expect(placeholders().slice(0, 3)).toEqual(['请输入尾程单号', '请输入集装箱号', '请输入入仓码'])
await toolbar.get('button[aria-label="调整筛选布局"]').trigger('click')
await flushPromises()
toolbar.findComponent(LayoutPreferenceList).vm.$emit('move', 'externalBookingNo', 0)
await wrapper.vm.$nextTick()
await button(wrapper, '收起筛选')!.trigger('click')
expect(placeholders()).toEqual(['请输入外接预订号', '请输入尾程单号', '请输入集装箱号'])
expect(toolbar.props('modelValue').containerNo).toBe('CONT-15')
expect(vi.mocked(listLastMileOrders)).toHaveBeenCalledTimes(initialCalls)
wrapper.unmount()
const restored = await mountView()
const restoredToolbar = restored.findComponent(QueryToolbar)
const restoredPlaceholders = () => restoredToolbar.findAll('.query-toolbar__field').map(field => field.get('input').attributes('placeholder'))
expect(restoredPlaceholders()).toEqual(['请输入外接预订号', '请输入尾程单号', '请输入集装箱号'])
await restoredToolbar.get('button[aria-label="调整筛选布局"]').trigger('click')
await flushPromises()
restoredToolbar.findComponent(LayoutPreferenceList).vm.$emit('reset')
await restored.vm.$nextTick()
expect(restoredPlaceholders()).toEqual(['请输入尾程单号', '请输入入仓码', '请输入仓库名称或编码'])
})
it('preserves advanced conditions when collapsed and clears them on reset', async () => {
const wrapper = await mountView()
const toolbar = wrapper.findComponent(QueryToolbar)
expect(toolbar.props('fields').map((field) => field.key)).toEqual(['orderNo', 'inboundCode', 'warehouse'])
expect(toolbar.findAll('.query-toolbar__field input').map(input => input.attributes('placeholder')))
.toEqual(['请输入尾程单号', '请输入入仓码', '请输入仓库名称或编码'])
const initialCalls = vi.mocked(listLastMileOrders).mock.calls.length
await button(wrapper, '高级筛选')!.trigger('click')
expect(toolbar.props('fields')).toHaveLength(16)