diff --git a/src/modules/inbounds/measurement/InboundMeasurementPanel.test.ts b/src/modules/inbounds/measurement/InboundMeasurementPanel.test.ts index 6a1eb8f8..89db8840 100644 --- a/src/modules/inbounds/measurement/InboundMeasurementPanel.test.ts +++ b/src/modules/inbounds/measurement/InboundMeasurementPanel.test.ts @@ -149,13 +149,14 @@ describe('InboundMeasurementPanel', () => { expect(getInboundMeasurement).toHaveBeenCalledWith('10001', '7001') expect(wrapper.text()).toContain('第三方设备') expect(wrapper.text()).toContain('RK202608040001') - expect(wrapper.text()).toContain('箱规周长') - expect(wrapper.text()).toContain('190 cm') - expect(wrapper.text()).toContain('0.6 CBM') + expect(wrapper.text()).toContain('周长(cm)') + expect(wrapper.find('.measurement-table').text()).toContain('190') + expect(wrapper.find('.measurement-table').text()).toContain('0.6') + await wrapper.find('.el-table__expand-icon').trigger('click') + await flushPromises() expect(wrapper.text()).toContain('MJ20210327') - const measuredAtInput = wrapper.findAll('label').find((label) => label.text().includes('测量时间'))?.find('input') - expect((measuredAtInput?.element as HTMLInputElement).value).toBe('2026-08-04 10:30:00+08:00') - expect(wrapper.text()).toContain('预览图片') + expect(wrapper.text()).toContain('2026-08-04 10:30:00+08:00') + expect(wrapper.find('button[aria-label="预览测量图片"]').exists()).toBe(true) }) it('opens the manual carton entry form in an editable measurement state', async () => { @@ -203,21 +204,13 @@ describe('InboundMeasurementPanel', () => { expect(text).toContain('实测总材积重') expect(text).not.toContain('租户') - const labels = wrapper.findAll('.measurement-item__grid label > span').map((label) => label.text()) - expect(labels.slice(0, 8)).toEqual([ - '箱号', - '测量长(cm)', - '测量宽(cm)', - '测量高(cm)', - '确认箱数 *', - '每箱毛重(kg)', - '机器编号', - '测量时间', - ]) + expect(wrapper.find('.measurement-table').exists()).toBe(true) + expect(wrapper.find('.measurement-item').exists()).toBe(false) + expect(wrapper.find('.measurement-table').text()).toContain('周长(cm)') const source = await import('./InboundMeasurementPanel.vue?raw').then((module) => module.default) expect(source).toContain('.measurement-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));') - expect(source).toContain('.measurement-item__grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));') - expect(source).toContain('.measurement-form-grid, .measurement-item__grid, .measurement-item__advanced .measurement-item__grid { grid-template-columns: 1fr; }') + expect(source).toContain('.measurement-table { width: 100%; font-size: 12px; }') + expect(source).toContain('.measurement-order-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));') expect(source).toContain('defineExpose({ saveDraft, submitForReview, mayMaintain, maySubmit, saving, submitting, canEdit, canSubmit })') }) @@ -235,7 +228,7 @@ describe('InboundMeasurementPanel', () => { boxCode: 'RK202608040001#10-1', confirmedPackageCount: 9, }) const wrapper = await mountPanel() - const countInput = wrapper.findAll('label').find((label) => label.text().includes('确认箱数'))?.find('input') + const countInput = wrapper.find('.measurement-count-editor input') await countInput?.setValue('9') const save = wrapper.findAll('button').find((button) => button.text().includes('保存确认箱数')) await save?.trigger('click') @@ -252,7 +245,7 @@ describe('InboundMeasurementPanel', () => { new ApiResponseError('数据版本已变化,请刷新后重试', 'A0409', 200, null, 'req-conflict', 'trace-conflict'), ) const wrapper = await mountPanel() - const countInput = wrapper.findAll('label').find((label) => label.text().includes('确认箱数'))?.find('input') + const countInput = wrapper.find('.measurement-count-editor input') await countInput?.setValue('9') const save = wrapper.findAll('button').find((button) => button.text().includes('保存确认箱数')) await save?.trigger('click') @@ -266,7 +259,7 @@ describe('InboundMeasurementPanel', () => { it('requires the dirty draft to be saved before submitting for review', async () => { const wrapper = await mountPanel() - const countInput = wrapper.findAll('label').find((label) => label.text().includes('确认箱数'))?.find('input') + const countInput = wrapper.find('.measurement-count-editor input') await countInput?.setValue('9') const submit = wrapper.findAll('button').find((button) => button.text().includes('提交审核')) await submit?.trigger('click') @@ -305,7 +298,7 @@ describe('InboundMeasurementPanel', () => { it('keeps device facts read-only but allows manual count correction after submission', async () => { vi.mocked(getInboundMeasurement).mockResolvedValueOnce(measurement({ processStatus: 'MEASURE_PENDING' })) const wrapper = await mountPanel() - const countInput = wrapper.findAll('label').find((label) => label.text().includes('确认箱数'))?.find('input') + const countInput = wrapper.find('.measurement-count-editor input') expect((countInput?.element as HTMLInputElement).matches(':disabled')).toBe(false) expect(wrapper.findAll('button').find((button) => button.text().includes('保存确认箱数'))?.attributes('disabled')).toBeUndefined() diff --git a/src/modules/inbounds/measurement/InboundMeasurementPanel.vue b/src/modules/inbounds/measurement/InboundMeasurementPanel.vue index 4fedaba5..93a51c13 100644 --- a/src/modules/inbounds/measurement/InboundMeasurementPanel.vue +++ b/src/modules/inbounds/measurement/InboundMeasurementPanel.vue @@ -612,6 +612,9 @@ defineExpose({ saveDraft, submitForReview, mayMaintain, maySubmit, saving, submi + + +