fix(admin): consolidate container exception history
This commit is contained in:
@@ -62,6 +62,48 @@ describe('ContainerOverviewPanel', () => {
|
||||
expect(deliveryRow.find('.document-file-name').attributes('title')).toBe('do.pdf')
|
||||
})
|
||||
|
||||
it('renders one compact normal exception section with a single-line empty history', () => {
|
||||
const normal = { ...overview, exception: { active: false, reason: null, markedBy: null, markedByName: null, markedAt: null }, exceptionHistory: [] }
|
||||
const wrapper = mount(ContainerOverviewPanel, { props: { overview: normal, canManageDocuments: true, canManageCustoms: true, canManageException: true }, global: { plugins: [ElementPlus] } })
|
||||
const section = wrapper.find('.exception-management')
|
||||
expect(section.text()).toContain('异常管理')
|
||||
expect(section.text()).toContain('正常')
|
||||
expect(section.text()).toContain('标记异常')
|
||||
expect(section.text()).toContain('暂无异常处理记录')
|
||||
expect(section.find('.el-empty').exists()).toBe(false)
|
||||
expect(wrapper.findAll('[aria-label="异常管理"]')).toHaveLength(1)
|
||||
})
|
||||
|
||||
it('keeps current exception summary and multiple history rows together without mixing transport logs', () => {
|
||||
const histories = [
|
||||
...overview.exceptionHistory,
|
||||
{ id: '15', action: 'CANCEL', reason: '查验解除', operatorId: '16', operatorName: '复核员', occurredAt: '2026-08-13T11:30:00' },
|
||||
]
|
||||
const wrapper = mount(ContainerOverviewPanel, { props: { overview: { ...overview, exceptionHistory: histories }, canManageDocuments: true, canManageCustoms: true, canManageException: true }, global: { plugins: [ElementPlus] } })
|
||||
const section = wrapper.find('.exception-management')
|
||||
expect(section.text()).toContain('异常')
|
||||
expect(section.text()).toContain('码头查验')
|
||||
expect(section.text()).toContain('操作员 · 2026-08-13 11:00')
|
||||
expect(section.findAll('.exception-history li')).toHaveLength(2)
|
||||
expect(section.text()).toContain('取消异常')
|
||||
expect(section.text()).toContain('复核员')
|
||||
expect(section.text()).toContain('查验解除')
|
||||
expect(section.text()).not.toContain('更新预计到港时间')
|
||||
expect(wrapper.find('[aria-label="运输轨迹和操作日志"]').text()).toContain('更新预计到港时间')
|
||||
})
|
||||
|
||||
it('emits the unchanged manage action for mark and cancel buttons', async () => {
|
||||
let wrapper = mount(ContainerOverviewPanel, { props: { overview: { ...overview, exception: { active: false, reason: null, markedBy: null, markedByName: null, markedAt: null } }, canManageDocuments: true, canManageCustoms: true, canManageException: true }, global: { plugins: [ElementPlus] } })
|
||||
await wrapper.find('.exception-management button').trigger('click')
|
||||
expect(wrapper.emitted('manageException')).toHaveLength(1)
|
||||
wrapper.unmount()
|
||||
wrapper = mount(ContainerOverviewPanel, { props: { overview, canManageDocuments: true, canManageCustoms: true, canManageException: true }, global: { plugins: [ElementPlus] } })
|
||||
await wrapper.find('.exception-management button').trigger('click')
|
||||
expect(wrapper.emitted('manageException')).toHaveLength(1)
|
||||
expect(wrapper.find('.exception-management button').text()).toContain('取消异常')
|
||||
wrapper.unmount()
|
||||
})
|
||||
|
||||
it('loads protected photos into direct thumbnails, opens them and revokes object URLs', async () => {
|
||||
const open = vi.spyOn(window, 'open').mockImplementation(() => null)
|
||||
const wrapper = mount(ContainerOverviewPanel, { props: { overview, canManageDocuments: true, canManageCustoms: true, canManageException: true }, global: { plugins: [ElementPlus] } })
|
||||
|
||||
Reference in New Issue
Block a user