fix(admin): simplify booking documents and refine measurement review

This commit is contained in:
2026-10-23 10:56:35 +08:00
parent 52045e5df2
commit 75bb0bf78e
19 changed files with 179 additions and 108 deletions
@@ -23,8 +23,8 @@ const model: SaveTruckAppointmentRequest = {
plannedLoadingAt: null,
}
const candidates = [
{ oceanBookingId: 'booking-1', oceanBookingNo: 'OB-1', billOfLadingNo: 'BL-1', warehouseId: 'WH-1', warehouseName: '义乌仓', channelCode: 'SEA', channelName: '海运', bookingDocumentReady: true },
{ oceanBookingId: 'booking-2', oceanBookingNo: 'OB-2', billOfLadingNo: 'BL-2', warehouseId: 'WH-2', warehouseName: '东莞仓', channelCode: 'SEA', channelName: '海运', bookingDocumentReady: true },
{ oceanBookingId: 'booking-1', oceanBookingNo: 'OB-1', billOfLadingNo: 'BL-1', warehouseId: 'WH-1', warehouseName: '义乌仓', channelCode: 'SEA', channelName: '海运' },
{ oceanBookingId: 'booking-2', oceanBookingNo: 'OB-2', billOfLadingNo: 'BL-2', warehouseId: 'WH-2', warehouseName: '东莞仓', channelCode: 'SEA', channelName: '海运' },
]
function detail(id: string) {
const candidate = candidates.find((item) => item.oceanBookingId === id)!
@@ -46,6 +46,21 @@ describe('TruckAppointmentForm booking-only behavior', () => {
vi.mocked(getOceanBooking).mockImplementation(async (id) => detail(id) as never)
})
it.each([false, true])('validates a booking without documents when editing is %s', async (editing) => {
vi.mocked(getOceanBooking).mockResolvedValue({ ...detail('booking-1'), documents: [] } as never)
const wrapper = mount(TruckAppointmentForm, {
props: {
modelValue: { ...model, oceanBookingId: 'booking-1', carrierId: 'carrier-1', plannedLoadingAt: '2026-10-25T10:00:00' },
resource: editing ? resource('appointment-1', 'booking-1') : null,
},
global: { plugins: [ElementPlus] },
})
await flushPromises()
expect(await wrapper.vm.validate()).toBe(true)
expect(wrapper.text()).not.toContain('所选订舱缺少有效的订舱确认文件或提单文件')
wrapper.unmount()
})
it('selects only server-approved released bookings and never exposes container identity', async () => {
const wrapper = mount(TruckAppointmentForm, { props: { modelValue: { ...model } }, global: { plugins: [ElementPlus] } })
await flushPromises()