优化
This commit is contained in:
@@ -72,10 +72,14 @@ it('confirms cancelling pickup and linked transfers using the transport version'
|
||||
wrapper.unmount(); confirm.mockRestore()
|
||||
})
|
||||
it.each([['LOADING', '上传装货照片'], ['DELIVERING', '上传到仓照片']] as const)('opens pickup %s work from the list while detail stays separate', async (stage, label) => {
|
||||
vi.mocked(listDispatches).mockResolvedValue(page([listRow({ taskType: 'PICKUP', stage, reviewState: 'APPROVED', actions: {} })]))
|
||||
const allowed = { allowed: true, blockCode: null, blockReason: null }
|
||||
vi.mocked(listDispatches).mockResolvedValue(page([listRow({ taskType: 'PICKUP', stage, reviewState: 'APPROVED', actions: { EDIT: allowed, CANCEL: allowed } })]))
|
||||
const wrapper = mount(DispatchesView, options); await flushPromises()
|
||||
const row = wrapper.findAllComponents(RowActions).find(entry => entry.props('moreLabel') === '更多操作 · PC/1')!
|
||||
expect(row.props('actions')).toEqual([expect.objectContaining({ key: 'transport', label }), expect.objectContaining({ key: 'detail', label: '详情' })])
|
||||
row.vm.$emit('action', 'EDIT'); row.vm.$emit('action', 'CANCEL'); await flushPromises()
|
||||
expect(wrapper.findComponent({ name: 'TransportExecutionPanel' }).exists()).toBe(false)
|
||||
expect(cancelTransport).not.toHaveBeenCalled()
|
||||
row.vm.$emit('action', 'transport'); await flushPromises()
|
||||
expect(wrapper.getComponent({ name: 'TransportExecutionPanel' }).props()).toMatchObject({ dispatchNo: 'PC/1', pickupApproved: true, editResources: false })
|
||||
expect(push).not.toHaveBeenCalled()
|
||||
|
||||
@@ -140,7 +140,9 @@ function rowActions(row: DispatchListRow): RowActionItem[] {
|
||||
{ key: 'detail', label: '详情', priority: 500 },
|
||||
]
|
||||
}
|
||||
const available = rowActionOrder.filter(value => (value !== 'SUBMIT_REVIEW' || row.taskType === 'PICKUP') && canDispatchAction(row.actions, value, access.can))
|
||||
const available = rowActionOrder.filter(value => (value !== 'SUBMIT_REVIEW' || row.taskType === 'PICKUP')
|
||||
&& !(row.taskType === 'PICKUP' && ['EDIT', 'CANCEL'].includes(value) && (row.stage !== 'BEFORE_LOADING' || row.reviewState === 'APPROVED'))
|
||||
&& canDispatchAction(row.actions, value, access.can))
|
||||
const primaryAction = available.find(value => value === 'EDIT') ?? available[0]
|
||||
const execution = pickupExecutionLabel(row)
|
||||
return [...(execution ? [{ key: 'transport', label: execution, priority: 650 }] : []), ...(canManageDocuments(row) ? [{ key: 'documents', label: '管理资料', priority: 700 }] : []), ...available.map((value, index) => ({
|
||||
|
||||
@@ -270,6 +270,15 @@ describe('LastMileOrderDetailView domestic detail alignment', () => {
|
||||
settlementMode: payable ? 'ON_ACCOUNT' : undefined, chargeableQuantity: 2, quantityUnit: '托', unitPrice: 40,
|
||||
})
|
||||
})
|
||||
it.each(['BILL', 'WALLET'])('submits receivable settlement mode %s from the fee editor', async settlementMode => {
|
||||
const { dialog } = await openFeeEditor()
|
||||
await fillFee(dialog, 'RECEIVABLE')
|
||||
dialog.findAllComponents({ name: 'ElSelect' }).find(select => select.props('placeholder') === '按业务默认规则')!.vm.$emit('update:modelValue', settlementMode)
|
||||
await flushPromises()
|
||||
await dialog.findAll('button').find(button => button.text() === '保存费用')!.trigger('click')
|
||||
await flushPromises()
|
||||
expect(createLastMileOrderFee).toHaveBeenCalledWith('internal-order-id', expect.objectContaining({ direction: 'RECEIVABLE', settlementMode }))
|
||||
})
|
||||
it('keeps fee required-field validation before a request', async () => {
|
||||
const { dialog } = await openFeeEditor()
|
||||
await dialog.findAll('button').find(button => button.text() === '保存费用')!.trigger('click'); await flushPromises()
|
||||
|
||||
Reference in New Issue
Block a user