修复订单货柜预约与排车维护界面

This commit is contained in:
2026-10-21 23:20:10 +08:00
parent 93a31b3872
commit 2e26477db5
68 changed files with 602 additions and 239 deletions
@@ -82,7 +82,7 @@ async function mountView() {
stubs: {
AdminPage: { template: '<main><slot /></main>' },
DetailPageLayout: { template: '<section><slot name="header" /><slot /></section>' },
PageToolbar: { template: '<header><slot name="actions" /></header>' },
PageToolbar: { props: ['description'], template: '<header><p class="toolbar-description">{{ description }}</p><slot name="actions" /></header>' },
CarrierScheduleQueryPanel: true,
},
},
@@ -135,6 +135,8 @@ describe('OceanBookingDetailView one-click release', () => {
expect(dialog.props('modelValue')).toBe(true)
expect(dialog.props('title')).toBe('确认放舱 · OB-123')
expect(wrapper.get('.release-summary').text()).toContain('EDITED-BL')
expect(wrapper.get('.release-summary').element.closest('section')?.hasAttribute('data-tone')).toBe(false)
expect(wrapper.find('.el-alert--warning').exists()).toBe(false)
expect(wrapper.text()).toContain('不能修改、不能删除')
expect(wrapper.text()).not.toContain('处理数据库')
expect(updateOceanBookingDraft).not.toHaveBeenCalled()
@@ -149,6 +151,37 @@ describe('OceanBookingDetailView one-click release', () => {
wrapper.unmount()
})
it('renders authoritative creation and release history timestamps from the response', async () => {
const value = booking('RELEASED')
value.histories = [
{ id: '61', fromStatus: null, toStatus: 'DRAFT', action: 'CREATE', operatorName: '创建人', createdAt: '2026-10-20T09:12:34' },
{ id: '62', fromStatus: 'DRAFT', toStatus: 'RELEASED', action: 'RELEASE', operatorName: '放舱人', createdAt: '2026-10-21T10:23:45' },
]
vi.mocked(getOceanBooking).mockResolvedValue(value)
const { wrapper } = await mountView()
const rows = wrapper.findAll('.booking-history-table tbody tr')
expect(rows[0]!.findAll('td')[0]!.text()).toBe('2026-10-20T09:12:34')
expect(rows[1]!.findAll('td')[0]!.text()).toBe('2026-10-21T10:23:45')
expect(rows[0]!.text()).toContain('创建人')
wrapper.unmount()
})
it('shows the route alone in the heading without a single customer and keeps an actual customer name', async () => {
const value = booking()
value.customerId = null; value.customerName = null
value.oceanBooking.customerId = null; value.oceanBooking.customerName = null
vi.mocked(getOceanBooking).mockResolvedValue(value)
const { wrapper } = await mountView()
expect(wrapper.get('.toolbar-description').text()).toBe('上海 → 洛杉矶')
expect(wrapper.text()).not.toContain('未关联客户')
wrapper.unmount()
vi.mocked(getOceanBooking).mockResolvedValue(booking())
const { wrapper: customerWrapper } = await mountView()
expect(customerWrapper.get('.toolbar-description').text()).toBe('测试客户 · 上海 → 洛杉矶')
customerWrapper.unmount()
})
it('saves dirty form data and releases with the returned latest version', async () => {
vi.mocked(updateOceanBookingDraft).mockResolvedValue(booking('DRAFT', 4, 'NEW-BL'))
vi.mocked(releaseOceanBooking).mockResolvedValue(booking('RELEASED', 5, 'NEW-BL'))