更新计费预览与测量精度并精简作业界面

This commit is contained in:
2026-10-28 11:06:42 +08:00
parent e41e9e6d3f
commit 6f8dc920ca
21 changed files with 522 additions and 150 deletions
@@ -4,7 +4,7 @@ import { flushPromises, mount } from '@vue/test-utils'
import { beforeEach, expect, it, vi } from 'vitest'
import DispatchDocumentsDialog from './DispatchDocumentsDialog.vue'
import DeliveryDocumentsDialog from './DeliveryDocumentsDialog.vue'
import { detail } from '../dispatchTestFixtures'
import { destination, detail } from '../dispatchTestFixtures'
import { getDispatch } from '../api/dispatches'
import { deliveryDocumentCategories, getDeliveryDocuments, saveDeliveryDocuments, type DeliveryDocuments } from '../api/deliveryDocuments'
const can = vi.hoisted(() => vi.fn(() => true))
@@ -37,8 +37,13 @@ it.each(['LOADING', 'AFTER_LOADING'] as const)('opens loading documents in %s be
expect(wrapper.findAll('[role="tab"]').find(tab => tab.text() === '装车资料')!.attributes('aria-selected')).toBe('true')
expect(getDeliveryDocuments).not.toHaveBeenCalled(); wrapper.unmount()
})
it('reads existing delivery files in one dialog and saves receipt without requiring loading or BOL files', async () => {
it('hides the single delivery selector and saves receipt files to that delivery without requiring loading or BOL files', async () => {
const value = detail({ stage: 'DELIVERING' })
value.documents.deliveries = [{ deliveryNo: 'DL-1', customerId: '101', customerName: '客户甲', groupKey: 'A', outboundNo: 'OB-1', destination: destination(), status: 'DELIVERING', packageCount: 1, palletCount: 1 }]
vi.mocked(getDispatch).mockResolvedValueOnce(value)
const wrapper = setup(); await flushPromises()
expect(wrapper.findComponent({ name: 'ElSelect' }).exists()).toBe(false)
expect(wrapper.find('[aria-label="选择派送单"]').exists()).toBe(false)
expect(getDeliveryDocuments).toHaveBeenCalledWith('DL-1', '101')
expect(wrapper.text()).toContain('existing-pod.pdf')
expect(wrapper.text()).not.toContain('资料核对')
@@ -52,6 +57,7 @@ it('reads existing delivery files in one dialog and saves receipt without requir
})
it('switches customer scope exactly and keeps unsaved delivery edits when switching tabs', async () => {
const wrapper = setup(); await flushPromises()
expect(wrapper.findComponent({ name: 'ElSelect' }).exists()).toBe(true)
const receipt = wrapper.getComponent(DeliveryDocumentsDialog)
await receipt.findAll('button').find(button => button.text() === '删除')!.trigger('click')
expect(receipt.text()).not.toContain('existing-pod.pdf')