完善预约确认与排车表单并统一计费和筛选展示

This commit is contained in:
2026-10-28 12:01:43 +08:00
parent 0c3f4ece2a
commit 39b9a6a1a0
27 changed files with 277 additions and 77 deletions
@@ -65,7 +65,7 @@ function mountView() {
AdminPage: { template: '<main><slot /></main>' },
InboundTaskList: false,
ListPageLayout: { template: '<section><slot name="toolbar" /><slot name="state" /><slot /></section>' },
QueryToolbar: { name: 'QueryToolbar', props: ['modelValue'], emits: ['update:modelValue', 'search', 'reset'], template: '<div data-testid="query-toolbar" />' },
QueryToolbar: { name: 'QueryToolbar', props: ['modelValue', 'fields', 'maxVisible'], emits: ['update:modelValue', 'search', 'reset'], template: '<div data-testid="query-toolbar"><slot name="actions" /></div>' },
DataTable: { name: 'DataTable', props: ['page', 'pageSize', 'data'], emits: ['update:page', 'update:pageSize', 'selection-change'], template: '<div data-testid="data-table"><slot name="toolbar-start" /><slot name="toolbar-actions" /><slot name="filters" /><slot name="notices" /><div v-for="row in data" :key="row.orderId" class="test-row"><slot name="estimatedVolume" :row="row" /><slot name="expectedArrival" :row="row" /></div></div>' },
'el-button': { template: '<button><slot /></button>' },
'el-input-number': { name: 'ElInputNumber', props: ['modelValue', 'disabled'], emits: ['update:modelValue', 'change'], template: '<input class="number-input" :value="modelValue" :disabled="disabled" @change="$emit(\'change\')" />' },
@@ -101,7 +101,8 @@ describe('UnifiedOrdersView list request coordination', () => {
const reviewToolbar = wrapper.getComponent({ name: 'QueryToolbar' })
expect(reviewToolbar.props('modelValue')).toMatchObject(model)
expect(reviewToolbar.attributes('preference-key')).toBe('unified-orders-query-v2')
expect(reviewToolbar.attributes('available-fields')).toBeDefined()
expect(reviewToolbar.props('maxVisible')).toBe(3)
expect(reviewToolbar.props('fields').map((field: { key: string }) => field.key)).toEqual(expect.arrayContaining(['createdRange', 'tenantId', 'inboundCode']))
reviewToolbar.vm.$emit('reset')
await flushPromises()
expect(listPlatformUnifiedOrders).toHaveBeenLastCalledWith(expect.objectContaining({ mainStatus: 'MEASUREMENT_REVIEW', receivingWarehouseId: undefined, inboundCode: undefined, channelName: undefined, tenantId: undefined }))
@@ -116,6 +117,32 @@ describe('UnifiedOrdersView list request coordination', () => {
expect(listPlatformUnifiedOrders).toHaveBeenLastCalledWith(expect.objectContaining({ mainStatus: 'PENDING_REVIEW', inboundCode: 'IN-REVIEW' }))
})
it.each(['全部', '测量数据审核'])('limits fields after saved ordering without changing filters or querying when %s is expanded and collapsed', async (tabLabel) => {
const wrapper = mountView()
await flushPromises()
if (tabLabel !== '全部') {
await wrapper.findAll('[role="tab"]').find(tab => tab.text().startsWith(tabLabel))!.trigger('click')
await flushPromises()
}
const toolbar = wrapper.getComponent({ name: 'QueryToolbar' })
const fieldKeys = toolbar.props('fields').map((field: { key: string }) => field.key)
expect(fieldKeys).toHaveLength(15)
expect(fieldKeys).toEqual(expect.arrayContaining(['createdRange', 'tenantId', 'inboundCode']))
expect(toolbar.props('maxVisible')).toBe(3)
const model = { ...toolbar.props('modelValue'), tenantId: 'customer-1', inboundCode: 'IN-KEEP', createdRange: ['2026-10-01', '2026-10-28'] }
toolbar.vm.$emit('update:modelValue', model)
await flushPromises()
const requestCount = vi.mocked(listPlatformUnifiedOrders).mock.calls.length
await wrapper.get('[aria-controls="unified-orders-advanced-filters"]').trigger('click')
expect(toolbar.props('maxVisible')).toBeUndefined()
await wrapper.get('[aria-controls="unified-orders-advanced-filters"]').trigger('click')
expect(toolbar.props('maxVisible')).toBe(3)
expect(toolbar.props('fields').map((field: { key: string }) => field.key)).toEqual(fieldKeys)
expect(toolbar.props('modelValue')).toEqual(model)
expect(listPlatformUnifiedOrders).toHaveBeenCalledTimes(requestCount)
wrapper.unmount()
})
it('shows only supported counts, keeps all text-only and never scopes counts by status or pagination', async () => {
vi.mocked(getPlatformUnifiedOrderStatusCounts).mockResolvedValue({ counts: { PENDING_REVIEW: 12, WAIT_MEASURE: 0, SIGNED: 3 } })
const wrapper = mountView()