This commit is contained in:
2026-10-30 11:19:57 +08:00
parent a2ef3542f4
commit 8cc8b4fb94
13 changed files with 218 additions and 74 deletions
@@ -212,7 +212,7 @@ describe('ContainerCustomsPanel', () => {
wrapper = await render('DECLARING', true, true)
expect(wrapper.text()).toContain('发送报关行执行')
expect(wrapper.text()).toContain('覆盖预录单')
expect(wrapper.text()).toContain('选择预录单')
expect(wrapper.text()).toContain('报关行回执.pdf')
expect(wrapper.text()).toContain('真实报关完税文件.pdf')
expect(wrapper.text()).not.toContain('确认 · 2026/8/29 11:15:00 · 客户一')
@@ -262,12 +262,35 @@ describe('ContainerCustomsPanel', () => {
const onChange = wrapper.findAllComponents({ name: 'ElUpload' })[0]!.props('onChange') as (upload: { raw: File }) => void
onChange({ raw: selected })
await flushPromises()
await wrapper.findAll('button').find(button => button.text() === '提交')!.trigger('click')
await wrapper.findAll('button').find(button => button.text() === '提交预录单')!.trigger('click')
await flushPromises()
expect(api.upload).toHaveBeenCalledWith(document.documentId, selected, 7)
wrapper.unmount()
})
it('一次选择的预录单会关联柜内全部客户资料', async () => {
const value = customs('DECLARING', false)
value.documents.push({ ...value.documents[0]!, documentId: '2092438843630391414', source: { ...value.documents[0]!.source, fileId: '2092438843630391415', fileName: '另一份客户资料.pdf', version: 1 }, receipt: null, confirmationHistory: [] })
value.brokerSubmission = { id: '2092438843630391412', customsContainerId: value.aggregateId, loadingPlanId: value.loadingPlanId, batchNo: 'BS-20260829-001', status: 'SENT', sourceVersion: 3, sentByName: '平台员', sentAt: '2026-08-29T10:45:00', version: 1 }
api.get.mockResolvedValue(value)
const wrapper = mount(ContainerCustomsPanel, {
props: { loadingPlanId: value.loadingPlanId, canList: true, canManage: true, departureState: 'WAITING_OTHER_GATES' },
global: { plugins: [ElementPlus] },
})
await flushPromises()
const selected = new File(['receipt'], '整柜预录单.pdf', { type: 'application/pdf' })
const onChange = wrapper.findAllComponents({ name: 'ElUpload' })[0]!.props('onChange') as (upload: { raw: File }) => void
onChange({ raw: selected })
await flushPromises()
await wrapper.findAll('button').find(button => button.text() === '提交预录单')!.trigger('click')
await flushPromises()
expect(api.upload).toHaveBeenCalledTimes(2)
expect(api.upload).toHaveBeenNthCalledWith(1, value.documents[0]!.documentId, selected, 0)
expect(api.upload).toHaveBeenNthCalledWith(2, value.documents[1]!.documentId, selected, 0)
wrapper.unmount()
})
it('keeps COMPLETED strictly read-only with both files visible and downloadable', async () => {
const wrapper = await render('COMPLETED', true, true)
expect(wrapper.text()).toContain('客户退税资料.pdf')
@@ -341,7 +364,7 @@ describe('ContainerCustomsPanel', () => {
const onChange = wrapper.findAllComponents({ name: 'ElUpload' })[0]!.props('onChange') as (upload: { raw: File }) => void
onChange({ raw: selected })
await flushPromises()
const submit = wrapper.findAll('button').find(button => button.text() === '提交')!
const submit = wrapper.findAll('button').find(button => button.text() === '提交预录单')!
await submit.trigger('click')
await flushPromises()