This commit is contained in:
2026-08-14 19:59:32 +08:00
parent f7594ebd39
commit 1540b80c89
29 changed files with 780 additions and 587 deletions
@@ -149,13 +149,13 @@ describe('InboundMeasurementPanel', () => {
const wrapper = await mountPanel()
expect(getInboundMeasurement).toHaveBeenCalledWith('10001', '7001')
expect((wrapper.find('input[readonly]').element as HTMLInputElement).value).toBe('RK202608040001')
expect(wrapper.text()).toContain('RK202608040001')
expect(wrapper.text()).toContain('周长(cm)')
expect(wrapper.find('.measurement-table').text()).toContain('190')
expect(wrapper.find('.measurement-table').text()).toContain('0.6')
expect(wrapper.find('.measurement-table').text()).not.toContain('周长')
await wrapper.find('.el-table__expand-icon').trigger('click')
await flushPromises()
expect(wrapper.text()).toContain('箱规周长')
expect(wrapper.text()).toContain('190 cm')
expect(wrapper.text()).toContain('MJ20210327')
expect(wrapper.text()).toContain('2026-08-04 10:30:00+08:00')
expect(wrapper.find('button[aria-label="预览测量图片"]').exists()).toBe(true)
@@ -189,27 +189,29 @@ describe('InboundMeasurementPanel', () => {
const wrapper = await mountPanel()
expect(wrapper.findAll('input[readonly]').some((input) => (input.element as HTMLInputElement).value === '未知来源')).toBe(true)
expect(wrapper.text()).toContain('未知来源')
expect(wrapper.text()).not.toContain('LEGACY_DEVICE')
})
it('follows the prototype grouping, labels, and editable field order', async () => {
it('keeps the first view focused on key totals and moves secondary fields behind disclosure', async () => {
const wrapper = await mountPanel()
const text = wrapper.text()
expect(text).toContain('原单数据与测量汇总')
expect(text).toContain('扫描箱测量数据明细')
expect(text).toContain('订单总箱数')
expect(text).toContain('确认箱数合计')
expect(text).toContain('货物总重量')
expect(text).toContain('实测总体积')
expect(text).toContain('实测总材积重')
expect(text).toContain('实测箱数')
expect(text).toContain('货物重量')
expect(text).toContain('总体积')
expect(text).toContain('材积重')
expect(text).toContain('申报信息')
expect(text).toContain('箱规明细')
expect(text).not.toContain('租户')
expect(text).not.toContain('数据版本')
expect(wrapper.find('.measurement-table').exists()).toBe(true)
expect(wrapper.find('.measurement-item').exists()).toBe(false)
expect(wrapper.find('.measurement-table').text()).toContain('周长(cm)')
expect(wrapper.find('.measurement-table').text()).not.toContain('周长')
const source = await import('./InboundMeasurementPanel.vue?raw').then((module) => module.default)
expect(source).toContain('<el-collapse-item name="declaration" title="申报信息">')
expect(source).toContain('grid-template-columns: repeat(4, minmax(0, 1fr))')
expect(source).toContain('.measurement-form-grid, .measurement-data-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));')
expect(source).toContain('.measurement-table { width: 100%; font-size: 12px; }')
expect(source).toContain('.measurement-data-grid :deep(.el-input__wrapper)')
@@ -224,7 +226,7 @@ describe('InboundMeasurementPanel', () => {
wrapper.vm.updateActualGrossWeight(125.75)
await flushPromises()
expect(wrapper.findAll('input[readonly]').some((input) => (input.element as HTMLInputElement).value === '125.75')).toBe(true)
expect(wrapper.find('.measurement-metrics').text()).toContain('125.75')
expect((countInput.element as HTMLInputElement).value).toBe('9')
})
@@ -232,8 +234,8 @@ describe('InboundMeasurementPanel', () => {
const wrapper = await mountPanel()
expect(wrapper.classes()).toContain('surface-panel')
expect(wrapper.find('.measurement-panel__heading').exists()).toBe(true)
expect(wrapper.findAll('input[readonly]').some((input) => (input.element as HTMLInputElement).value === '测量中')).toBe(true)
expect(wrapper.find('.measurement-summary-header').exists()).toBe(true)
expect(wrapper.find('.measurement-summary-status').text()).toContain('测量中')
})
it('saves only the changed confirmed package count with the current measurement version', async () => {
@@ -343,8 +345,9 @@ describe('InboundMeasurementPanel', () => {
await flushPromises()
expect(getInboundMeasurement).toHaveBeenLastCalledWith('10002', '7002')
expect(wrapper.findAll('input[readonly]').some((input) => (input.element as HTMLInputElement).value === 'RK202608040002')).toBe(true)
expect(wrapper.findAll('input[readonly]').some((input) => (input.element as HTMLInputElement).value === '测试企业')).toBe(false)
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('测试企业')
})
it('renders a permission-specific read-only state without requesting data', async () => {