优化
This commit is contained in:
@@ -66,6 +66,7 @@ function measurement(overrides: Partial<InboundMeasurementDetail> = {}): Inbound
|
||||
originalPackageCount: 10,
|
||||
actualPackageCount: 10,
|
||||
actualGrossWeightKg: 120,
|
||||
actualNetWeightKg: 110,
|
||||
actualVolumeCbm: 0.6,
|
||||
volumeWeightKg: 100.2,
|
||||
actualGoodsName: '蓝牙音箱',
|
||||
@@ -216,7 +217,53 @@ describe('InboundMeasurementPanel', () => {
|
||||
expect(source).toContain('.measurement-data-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr));')
|
||||
expect(source).toContain('.measurement-table { width: 100%; font-size: 12px; }')
|
||||
expect(source).toContain('.measurement-data-grid :deep(.el-input__wrapper)')
|
||||
expect(source).toContain('defineExpose({ saveDraft, submitForReview, updateActualGrossWeight, mayMaintain, maySubmit, saving, submitting, canEdit, canSubmit, isDirty })')
|
||||
expect(source).toContain('defineExpose({ saveDraft, submitForReview, updateActualWeights, mayMaintain, maySubmit, saving, submitting, canEdit, canSubmit, isDirty })')
|
||||
})
|
||||
|
||||
it('renders customer declaration facts as plain read-only values', async () => {
|
||||
const wrapper = await mountPanel()
|
||||
const declaration = wrapper.find('.measurement-declaration')
|
||||
|
||||
expect(declaration.text()).toContain('申报箱数')
|
||||
expect(declaration.text()).toContain('10')
|
||||
expect(declaration.text()).toContain('申报毛重(kg)')
|
||||
expect(declaration.text()).toContain('118.5')
|
||||
expect(declaration.text()).toContain('申报体积(m³)')
|
||||
expect(declaration.text()).toContain('0.8')
|
||||
expect(declaration.text()).toContain('原单据号码')
|
||||
expect(declaration.text()).toContain('DOC-001')
|
||||
expect(declaration.findAll('.measurement-readonly-field')).toHaveLength(4)
|
||||
expect(declaration.findAll('input')).toHaveLength(1)
|
||||
expect(declaration.find('.measurement-goods-name input').exists()).toBe(true)
|
||||
})
|
||||
|
||||
it('shows all declaration fields as plain text when measurement is not editable', async () => {
|
||||
vi.mocked(getInboundMeasurement).mockResolvedValueOnce(measurement({ processStatus: 'WAIT_SPLIT' }))
|
||||
const wrapper = await mountPanel()
|
||||
const declaration = wrapper.find('.measurement-declaration')
|
||||
|
||||
expect(declaration.find('input').exists()).toBe(false)
|
||||
expect(declaration.text()).toContain('蓝牙音箱')
|
||||
expect(declaration.findAll('.measurement-readonly-field')).toHaveLength(5)
|
||||
})
|
||||
|
||||
it('saves the corrected actual goods name without overriding declaration facts', async () => {
|
||||
const wrapper = await mountPanel()
|
||||
await wrapper.find('.measurement-goods-name input').setValue('修正后的蓝牙音箱')
|
||||
const save = wrapper.findAll('button').find((button) => button.text().includes('保存测量数据'))
|
||||
await save?.trigger('click')
|
||||
await flushPromises()
|
||||
|
||||
expect(saveInboundMeasurementDraft).toHaveBeenCalledWith('10001', '7001', expect.objectContaining({
|
||||
measurementId: '9001',
|
||||
version: 2,
|
||||
actualGoodsName: '修正后的蓝牙音箱',
|
||||
items: expect.any(Array),
|
||||
}))
|
||||
const payload = vi.mocked(saveInboundMeasurementDraft).mock.calls[0]?.[2]
|
||||
expect(payload).not.toHaveProperty('originalDocumentNo')
|
||||
expect(payload).not.toHaveProperty('originalGrossWeightKg')
|
||||
expect(payload).not.toHaveProperty('originalVolumeCbm')
|
||||
})
|
||||
|
||||
it('updates the server weight summary without discarding unsaved measurement edits', async () => {
|
||||
@@ -224,10 +271,11 @@ describe('InboundMeasurementPanel', () => {
|
||||
const countInput = wrapper.find('.measurement-count-editor input')
|
||||
await countInput.setValue('9')
|
||||
|
||||
wrapper.vm.updateActualGrossWeight(125.75)
|
||||
wrapper.vm.updateActualWeights(125.75, 115.75)
|
||||
await flushPromises()
|
||||
|
||||
expect(wrapper.find('.measurement-metrics').text()).toContain('125.75')
|
||||
expect(wrapper.find('.measurement-metrics').text()).toContain('115.75')
|
||||
expect((countInput.element as HTMLInputElement).value).toBe('9')
|
||||
})
|
||||
|
||||
@@ -237,6 +285,9 @@ describe('InboundMeasurementPanel', () => {
|
||||
expect(wrapper.classes()).toContain('surface-panel')
|
||||
expect(wrapper.find('.measurement-summary-header').exists()).toBe(true)
|
||||
expect(wrapper.find('.measurement-summary-status').text()).toContain('测量中')
|
||||
expect(wrapper.find('.measurement-summary-header').text()).not.toContain('RK202608040001')
|
||||
expect(wrapper.find('.measurement-summary-header').text()).toContain('测试企业')
|
||||
expect(wrapper.find('.measurement-summary-header').text()).toContain('美西海运')
|
||||
})
|
||||
|
||||
it('saves only the changed confirmed package count with the current measurement version', async () => {
|
||||
@@ -374,7 +425,6 @@ describe('InboundMeasurementPanel', () => {
|
||||
await flushPromises()
|
||||
|
||||
expect(getInboundMeasurement).toHaveBeenLastCalledWith('10002', '7002')
|
||||
expect(wrapper.find('.measurement-summary-header').text()).toContain('RK202608040002')
|
||||
expect(wrapper.find('.measurement-summary-header').text()).toContain('第二企业')
|
||||
expect(wrapper.find('.measurement-summary-header').text()).not.toContain('测试企业')
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user