fix(appointments): handle synchronization and transport continuation

This commit is contained in:
2026-10-18 22:29:06 +08:00
parent a5a1976924
commit 67d917010d
9 changed files with 226 additions and 11 deletions
@@ -21,6 +21,21 @@ function render(detail: WorkDetail, initialAction?: WorkAction) {
} } })
}
beforeEach(() => vi.clearAllMocks())
it('navigates the server-selected transport next step outside the delivery write permissions', async () => {
const transport: WorkAction = { code: 'ARRANGE_TRANSPORT', label: '继续安排本批车辆', targetWorkItemKey: 'transport-current', target: { kind: 'FLEET_TRIP', tripId: null, batchKeys: ['FBA_APPOINTMENT:1'] } }
const wrapper = render(workDetail({ item: workItem({ nextAction: transport, allowedActions: [followAction] }) }))
await flushPromises()
await wrapper.get('.primary-next-action').trigger('click'); await flushPromises()
expect(wrapper.emitted('open')).toEqual([['transport-current', transport]])
expect(wrapper.text()).not.toContain('操作资格已变化')
expect(wrapper.find('[data-dispatch]').exists()).toBe(false)
wrapper.unmount()
const target = render(workDetail({ item: workItem({ workItemKey: 'transport-current', type: 'TRANSPORT', allowedActions: [], nextAction: null }) }), transport)
await flushPromises()
expect(target.find('[data-dispatch]').exists()).toBe(false)
expect(target.emitted('open')).toBeUndefined()
target.unmount()
})
it('stays on the saved item and offers only the newly fetched primary next step', async () => {
const wrapper = render(workDetail(), followAction); await flushPromises()
const transport: WorkAction = { code: 'ARRANGE_TRANSPORT', label: '继续安排本批车辆', targetWorkItemKey: 'transport-current', target: { kind: 'FLEET_TRIP', tripId: null, batchKeys: ['FBA_APPOINTMENT:1'] } }