修复财务页面竞态并整理采购与运输展示
This commit is contained in:
@@ -310,6 +310,16 @@ describe('dispatch workflow native layout', () => {
|
||||
})
|
||||
it.each(['CANCEL', 'RETURN_TO_REVIEW', 'SUBMIT_REVIEW'] as const)('preserves the %s confirmation branch and its exact reason or remark', async action => {
|
||||
const { dialog } = await render(action)
|
||||
if (action === 'CANCEL') {
|
||||
expect(dialog.props('confirmText')).toBe('确认取消排车')
|
||||
expect(dialog.props('confirmType')).toBe('danger')
|
||||
expect(dialog.props('cancelText')).toBe('暂不取消')
|
||||
expect(dialog.props('width')).toBe('560px')
|
||||
expect(field(dialog, '取消原因').props()).toMatchObject({ labelPosition: 'top', required: true })
|
||||
expect(dialog.get('textarea').attributes('placeholder')).toBe('请填写取消原因')
|
||||
expect(dialog.find('[aria-label="操作原因与意见"]').exists()).toBe(false)
|
||||
expect(dialog.text()).toContain('取消本次排车,不会自动回库。')
|
||||
}
|
||||
const needsReason = action === 'CANCEL' || action === 'RETURN_TO_REVIEW'
|
||||
const send = action === 'CANCEL' ? api.cancelDispatch : action === 'RETURN_TO_REVIEW' ? api.returnDispatchToReview : api.submitDispatchReview
|
||||
if (needsReason) { dialog.vm.$emit('confirm'); await flushPromises(); expect(send).not.toHaveBeenCalled() }
|
||||
@@ -318,6 +328,20 @@ describe('dispatch workflow native layout', () => {
|
||||
dialog.vm.$emit('confirm'); await flushPromises()
|
||||
expect(send).toHaveBeenCalledExactlyOnceWith('PC/1', { recordVersion: 0, idempotencyKey: expect.any(String), ...(needsReason ? { reason: '现场原因' } : { remark: null }) })
|
||||
})
|
||||
it('preserves the cancellation reason after failure and refreshing current facts', async () => {
|
||||
const { dialog } = await render('CANCEL')
|
||||
await dialog.get('textarea').setValue(' 客户调整送货安排 ')
|
||||
vi.mocked(api.cancelDispatch).mockRejectedValueOnce(new ApiResponseError('排车资料已更新,请核对后重试', 'A0409', 409))
|
||||
dialog.vm.$emit('confirm'); await flushPromises()
|
||||
expect((dialog.get('textarea').element as HTMLTextAreaElement).value).toBe(' 客户调整送货安排 ')
|
||||
expect(dialog.get('textarea').attributes('disabled')).toBeUndefined()
|
||||
expect(dialog.props('confirmLoading')).toBe(false)
|
||||
dialog.getComponent(LoadErrorState).vm.$emit('retry'); await flushPromises()
|
||||
expect((dialog.get('textarea').element as HTMLTextAreaElement).value).toBe(' 客户调整送货安排 ')
|
||||
dialog.vm.$emit('confirm'); await flushPromises()
|
||||
expect(api.cancelDispatch).toHaveBeenCalledTimes(2)
|
||||
expect(vi.mocked(api.cancelDispatch).mock.calls[1]![1]).toMatchObject({ recordVersion: 1, reason: '客户调整送货安排' })
|
||||
})
|
||||
it('reorders only real unload stops and preserves the external stop and zero route version', async () => {
|
||||
const { dialog } = await render('EDIT', 'ROUTE')
|
||||
const rows = dialog.get('[aria-label="本车卸货顺序"]').findAll('tbody tr').filter(row => row.findAll('button').length)
|
||||
|
||||
Reference in New Issue
Block a user