This commit is contained in:
2026-10-21 15:10:54 +08:00
parent 457a95941d
commit e6c864a2a6
23 changed files with 239 additions and 72 deletions
@@ -35,6 +35,20 @@ beforeEach(() => {
vi.mocked(api.listDispatchCandidates).mockImplementation(async query => ({ candidates: [candidate()], page: query.page || 1, size: query.size || 20, total: 1, pages: 1, complete: true, snapshotAt: '' }))
})
it('keeps both searches in one panel and the manifest inside the shared board column', async () => {
const wrapper = await open()
const search = wrapper.get('[aria-label="已有排车查询"]')
expect(search.find('[aria-label="选择已有排车"]').exists()).toBe(true)
expect(search.text()).not.toContain('查询排车')
expect(search.find('input[aria-label="查找可排货物"]').exists()).toBe(true)
expect(search.findAll('.existing-cargo-query > label')).toHaveLength(0)
const column = wrapper.get('[aria-label="车辆装载"]')
expect(column.get(':scope > .cargo-board-heading').text()).toContain('本车货物 · PC/1')
expect(column.find(':scope > .cargo-board-vehicle-content [aria-label="当前排车货物"]').exists()).toBe(true)
expect(wrapper.get('.dispatch-cargo-board').findAll(':scope > section > .cargo-board-heading')).toHaveLength(3)
expect(column.text()).not.toContain('添加车辆')
})
it('adds the complete hidden shared-pallet group through real board buttons, then reloads current versions', async () => {
const [first, second] = sharedPalletCandidates()
vi.mocked(api.listDispatchCandidates).mockImplementation(async query => ({ candidates: query.size === 100 ? [first!, second!] : [first!], page: query.page!, size: query.size!, total: 2, pages: 1, complete: true, snapshotAt: '' }))
@@ -177,15 +191,17 @@ it('does not let a late previous dispatch read overwrite the selected dispatch',
const wrapper = await open()
await wrapper.setProps({ dispatchNo: 'PC/2' }); await flushPromises()
resolve(current()); await flushPromises()
expect(wrapper.get('[aria-label="当前排车货物"]').text()).toContain('PC/2')
expect(wrapper.get('[aria-label="当前排车货物"]').text()).not.toContain('PC/1')
expect(wrapper.get('[aria-label="车辆装载"] > .cargo-board-heading').text()).toContain('PC/2')
expect(wrapper.get('[aria-label="车辆装载"] > .cargo-board-heading').text()).not.toContain('PC/1')
})
it('queries and paginates active before-loading dispatches using the entered business number', async () => {
const wrapper = await open(null)
vi.mocked(api.listDispatches).mockImplementation(async query => ({ ...page([listRow({ taskType: 'DELIVERY' })]), page: query.page, size: query.size, total: 22, pages: 3 }))
await wrapper.get('input[aria-label="查找已有排车"]').setValue('PC2026')
await button(wrapper, '查询排车').trigger('click'); await flushPromises()
await wrapper.get('[aria-label="已有排车分页"] button.btn-next').trigger('click'); await flushPromises()
const picker = wrapper.getComponent({ name: 'ElSelect' })
expect(picker.props('remote')).toBe(true)
await picker.get('.el-select__wrapper').trigger('click'); await flushPromises()
await picker.props('remoteMethod')('PC2026'); await flushPromises()
await wrapper.getComponent({ name: 'ElPagination' }).get('button.btn-next').trigger('click'); await flushPromises()
expect(api.listDispatches).toHaveBeenLastCalledWith({ page: 2, size: 10, status: 'ACTIVE', stage: 'BEFORE_LOADING', dispatchNo: 'PC2026' })
})