style(admin): unify dialog layouts and dense readonly presentation
This commit is contained in:
@@ -143,19 +143,17 @@ describe('MeasurementReviewPanel', () => {
|
||||
|
||||
const summary = wrapper.get('.review-data').text()
|
||||
expect(summary).toContain('审核数据总览')
|
||||
const comparisonRows = wrapper.findAll('.review-comparison__row')
|
||||
expect(comparisonRows).toHaveLength(2)
|
||||
expect(comparisonRows[0].text()).toContain('客户申报')
|
||||
expect(comparisonRows[0].text()).toContain('箱数9')
|
||||
expect(comparisonRows[0].text()).toContain('毛重118 kg')
|
||||
expect(comparisonRows[0].text()).not.toContain('实际品名')
|
||||
expect(comparisonRows[0].text()).not.toContain('原单据号码')
|
||||
expect(comparisonRows[1].text()).toContain('平台实测')
|
||||
expect(comparisonRows[1].text()).toContain('箱数10 差异 +1')
|
||||
expect(comparisonRows[1].text()).toContain('毛重120 kg · 差异 +2 kg')
|
||||
expect(comparisonRows[1].text()).toContain('货物净重110 kg')
|
||||
expect(comparisonRows[1].text()).toContain('体积2.2 m³ · 差异 +0.2 m³')
|
||||
expect(comparisonRows[1].text()).toContain('体积重367.4 kg')
|
||||
const comparisonRows = wrapper.findAll('.review-comparison tbody tr')
|
||||
expect(comparisonRows.map(row => row.findAll('th, td').map(cell => cell.text()))).toEqual([
|
||||
['箱数', '9', '10', '差异 +1'],
|
||||
['毛重(kg)', '118', '120', '差异 +2 kg'],
|
||||
['体积(m³)', '2', '2.2', '差异 +0.2 m³'],
|
||||
])
|
||||
expect(wrapper.get('.review-comparison').text()).not.toContain('实际品名')
|
||||
expect(wrapper.get('.review-comparison').text()).not.toContain('原单据号码')
|
||||
const extraFacts = wrapper.get('.review-extra-facts').text().replace(/\s/g, '')
|
||||
expect(extraFacts).toContain('货物净重110kg')
|
||||
expect(extraFacts).toContain('体积重367.4kg')
|
||||
|
||||
const items = wrapper.get('.review-items').text()
|
||||
expect(items).toContain('箱规测量明细')
|
||||
@@ -174,7 +172,7 @@ describe('MeasurementReviewPanel', () => {
|
||||
expect(source).toContain(':file-id="row.intelligentImageFileId"')
|
||||
expect(source).toContain('openImagePreview(row.intelligentImageFileId')
|
||||
expect(source).toContain('downloadInboundMeasurementImage')
|
||||
expect(source).toContain('.review-table :deep(.el-table__header .cell) { white-space: nowrap; }')
|
||||
expect(source).not.toContain('.review-table :deep(.el-table__header .cell) { white-space: nowrap; }')
|
||||
expect(source).toContain('.review-table :deep(.review-time-cell .cell) { white-space: nowrap; }')
|
||||
})
|
||||
|
||||
@@ -183,7 +181,10 @@ describe('MeasurementReviewPanel', () => {
|
||||
const wrapper = mount(MeasurementReviewPanel, { props: { customerId: '10001', inboundId: '90001' }, global: { plugins: [ElementPlus] } })
|
||||
await flushPromises()
|
||||
|
||||
expect(wrapper.get('.review-comparison').text()).not.toContain('差异')
|
||||
const rows = wrapper.findAll('.review-comparison tbody tr')
|
||||
expect(rows[0].findAll('td').at(-1)?.text()).toBe('一致')
|
||||
expect(rows[1].findAll('td').map(cell => cell.text())).toEqual(['—', '120', '—'])
|
||||
expect(rows[2].findAll('td').map(cell => cell.text())).toEqual(['—', '2.2', '—'])
|
||||
})
|
||||
|
||||
it('reuses WeightOcrPanel and enables only its review correction mode', async () => {
|
||||
@@ -216,6 +217,25 @@ describe('MeasurementReviewPanel', () => {
|
||||
expect(wrapper.emitted('changed')).toHaveLength(1)
|
||||
})
|
||||
|
||||
it('exposes the same guarded actions when a dialog owns the fixed footer', async () => {
|
||||
vi.spyOn(ElMessageBox, 'confirm').mockResolvedValue(undefined as never)
|
||||
vi.mocked(approveMeasurement).mockResolvedValue({ inboundId: '90001', measurementId: '70001', processStatus: 'WAIT_SPLIT', feeStatus: 'CALCULATED', initialPricingSucceeded: true, initialPricingMessage: null, initialFee: null })
|
||||
const wrapper = mount(MeasurementReviewPanel, {
|
||||
props: { customerId: '10001', inboundId: '90001', showActions: false },
|
||||
global: { plugins: [ElementPlus] },
|
||||
})
|
||||
await flushPromises()
|
||||
expect(wrapper.find('.review-toolbar__actions').exists()).toBe(false)
|
||||
expect(wrapper.get('.review-toolbar__context').text()).toContain('客户:柏悦客户')
|
||||
expect(wrapper.vm.approvalButtonLabel).toBe('通过并进入待分柜')
|
||||
wrapper.vm.enableWeightCorrection()
|
||||
await flushPromises()
|
||||
expect(wrapper.getComponent({ name: 'WeightOcrPanel' }).props('correctionMode')).toBe(true)
|
||||
await wrapper.vm.confirmApprove()
|
||||
expect(approveMeasurement).toHaveBeenCalledWith('10001', '90001', { measurementId: '70001', expectedVersion: 7 })
|
||||
expect(wrapper.emitted('changed')).toHaveLength(1)
|
||||
})
|
||||
|
||||
it('emits only after approval succeeds and blocks duplicate submissions', async () => {
|
||||
let finishApproval: (() => void) | undefined
|
||||
vi.mocked(approveMeasurement).mockImplementation(() => new Promise((resolve) => {
|
||||
|
||||
Reference in New Issue
Block a user