This commit is contained in:
wujinliang
2026-09-18 11:41:27 +08:00
parent f2d5b2d8e4
commit 451663b6ff
24 changed files with 156 additions and 30 deletions
@@ -52,6 +52,7 @@ function measurement(overrides: Partial<InboundMeasurementDetail> = {}): Inbound
channelName: '美西海运',
processStatus: 'MEASURING',
measureReviewStatus: null,
customerFeeConfirmed: false,
recommendedPalletType: 'STANDARD',
reviewReason: null,
reviewerId: null,
@@ -135,7 +136,7 @@ async function mountPanel(permissions = [
'platform:firstleg:inbound:measure:edit',
'platform:firstleg:inbound:measure:manual-entry',
'platform:firstleg:inbound:measure:submit',
]) {
], props: Partial<{ customerId: string; inboundId: string; customerName: string }> = {}) {
const pinia = createPinia()
setActivePinia(pinia)
const auth = useAuthStore()
@@ -143,7 +144,7 @@ async function mountPanel(permissions = [
auth.permissions = permissions
useAccessPreviewStore().initializeAfterLogin()
const wrapper = mount(InboundMeasurementPanel, {
props: { customerId: '10001', inboundId: '7001' },
props: { customerId: '10001', inboundId: '7001', ...props },
attachTo: document.body,
global: { plugins: [pinia, ElementPlus] },
})
@@ -195,6 +196,13 @@ describe('InboundMeasurementPanel', () => {
expect(wrapper.find('button[aria-label="预览测量图片"]').exists()).toBe(true)
})
it('uses the list customer name when a legacy measurement detail has no customer snapshot', async () => {
vi.mocked(getInboundMeasurement).mockResolvedValueOnce(measurement({ companyName: '' }))
const wrapper = await mountPanel(undefined, { customerName: '柏悦物流' })
expect(wrapper.find('.measurement-summary-context').text()).toContain('柏悦物流')
})
it('warns when declared dimensions or gross weight differ from measurements by at least ten percent', async () => {
vi.mocked(getInboundMeasurement).mockResolvedValueOnce(measurement({
actualGrossWeightKg: 132,
@@ -499,7 +507,7 @@ describe('InboundMeasurementPanel', () => {
await flushPromises()
expect(ElMessageBox.confirm).toHaveBeenCalledWith(
expect.stringContaining('准备托盘与库位占用'),
expect.stringContaining('提交成功后本批次不能继续编辑'),
'提交测量审核',
expect.objectContaining({ confirmButtonText: '确认提交' }),
)