优化优化

This commit is contained in:
2026-08-11 18:06:35 +08:00
parent 8a8c5a3faa
commit 03e1cd0c80
40 changed files with 2092 additions and 354 deletions
@@ -101,9 +101,14 @@ describe('InboundOrdersView', () => {
expect(vi.mocked(listPlatformInbounds).mock.calls).toHaveLength(requestsBeforeSearch + 1)
expect(listPlatformInbounds).toHaveBeenLastCalledWith(undefined, expect.objectContaining({ page: 1, size: 20 }))
const requestsBeforeCustomerChange = vi.mocked(listPlatformInbounds).mock.calls.length
await selectCustomer(wrapper)
expect(listPlatformInbounds).toHaveBeenCalledWith('10001', expect.objectContaining({ page: 1, size: 20 }))
expect(vi.mocked(listPlatformInbounds).mock.calls).toHaveLength(requestsBeforeCustomerChange)
expect(listPlatformWarehouses).toHaveBeenCalledWith(1, 200)
toolbar.vm.$emit('search')
await flushPromises()
expect(vi.mocked(listPlatformInbounds).mock.calls).toHaveLength(requestsBeforeCustomerChange + 1)
expect(listPlatformInbounds).toHaveBeenLastCalledWith('10001', expect.objectContaining({ page: 1, size: 20 }))
expect(listPlatformTenants).toHaveBeenCalledWith({ page: 1, size: 200 })
expect(document.body.textContent).toContain('RK-001')
expect(document.body.textContent).toContain('查看')
@@ -150,9 +155,14 @@ describe('InboundOrdersView', () => {
destinationCode: 'ONT8',
})
await flushPromises()
const requestsBeforeCollapse = vi.mocked(listPlatformInbounds).mock.calls.length
await advancedButton()?.trigger('click')
await flushPromises()
expect(fieldKeys()).not.toContain('feeReviewStatus')
expect(vi.mocked(listPlatformInbounds).mock.calls).toHaveLength(requestsBeforeCollapse)
toolbar.vm.$emit('search')
await flushPromises()
expect(vi.mocked(listPlatformInbounds).mock.calls).toHaveLength(requestsBeforeCollapse + 1)
expect(listPlatformInbounds).toHaveBeenLastCalledWith('10001', expect.objectContaining({
feeReviewStatus: undefined,
destinationCode: undefined,
@@ -161,9 +171,13 @@ describe('InboundOrdersView', () => {
it('passes the selected backend tab and opens an aggregate read-only detail', async () => {
const wrapper = mountPage()
await selectCustomer(wrapper)
const toolbar = await selectCustomer(wrapper)
toolbar.vm.$emit('search')
await flushPromises()
const requestsBeforeTab = vi.mocked(listPlatformInbounds).mock.calls.length
;[...document.querySelectorAll<HTMLButtonElement>('.inbound-tab')].find((button) => button.textContent?.includes('待审核'))?.click()
await flushPromises()
expect(vi.mocked(listPlatformInbounds).mock.calls).toHaveLength(requestsBeforeTab + 1)
expect(listPlatformInbounds).toHaveBeenLastCalledWith('10001', expect.objectContaining({ tab: 'WAIT_REVIEW', page: 1 }))
;[...document.querySelectorAll<HTMLButtonElement>('button')].filter((button) => button.textContent?.trim() === '查看').at(-1)?.click()
await flushPromises()
@@ -233,11 +247,18 @@ describe('InboundOrdersView', () => {
expect(document.body.textContent).toContain('RK-001')
})
it('clears the selected list and detail when the selected customer changes', async () => {
it('updates customer-dependent options without querying until search', async () => {
const wrapper = mountPage()
const toolbar = await selectCustomer(wrapper)
toolbar.vm.$emit('search')
await flushPromises()
const requestsBeforeCustomerChange = vi.mocked(listPlatformInbounds).mock.calls.length
toolbar.vm.$emit('update:modelValue', { ...toolbar.props('modelValue'), customerId: '10002' })
await flushPromises()
expect(vi.mocked(listPlatformInbounds).mock.calls).toHaveLength(requestsBeforeCustomerChange)
toolbar.vm.$emit('search')
await flushPromises()
expect(vi.mocked(listPlatformInbounds).mock.calls).toHaveLength(requestsBeforeCustomerChange + 1)
expect(listPlatformInbounds).toHaveBeenLastCalledWith('10002', expect.objectContaining({ page: 1 }))
expect(listPlatformWarehouses).toHaveBeenLastCalledWith(1, 200)
})
@@ -260,8 +281,10 @@ describe('InboundOrdersView', () => {
vi.mocked(listPlatformInbounds).mockResolvedValue({ records: [summary], page: 1, size: 20, total: 60, pages: 3 })
const wrapper = mountPage()
await flushPromises()
const requestsBeforePage = vi.mocked(listPlatformInbounds).mock.calls.length
wrapper.findComponent(DataTable).vm.$emit('update:page', 2)
await flushPromises()
expect(vi.mocked(listPlatformInbounds).mock.calls).toHaveLength(requestsBeforePage + 1)
expect(listPlatformInbounds).toHaveBeenLastCalledWith(undefined, expect.objectContaining({ page: 2, size: 20 }))
})