feat(admin): apply shared blue-white self-operated workbench style

This commit is contained in:
2026-10-20 19:16:47 +08:00
parent 9bfce44988
commit 464b72cff9
38 changed files with 1851 additions and 340 deletions
@@ -6,6 +6,7 @@ import { defineComponent } from 'vue'
vi.mock('vue-echarts', () => ({ default: defineComponent({ name: 'VChart', props: ['option', 'autoresize', 'initOptions'], template: '<div />' }) }))
import SkuTrend from './SkuTrend.vue'
import type { DailyResponse } from '../types'
import { adminWorkbenchChartTheme } from '@/styles/adminWorkbenchChartTheme'
function data(status = 'COMPLETE'): DailyResponse {
return {
@@ -24,6 +25,13 @@ describe('SKU daily trend axes', () => {
expect(option.yAxis).toMatchObject({ type: 'value', min: 0, name: '出库量(件)' })
expect(option.series[1].data).toEqual(Array(30).fill(1))
expect(option.tooltip.trigger).toBe('axis')
expect(option.tooltip).toMatchObject({ backgroundColor: adminWorkbenchChartTheme.colors.surface, borderColor: adminWorkbenchChartTheme.colors.border })
expect(option.series[0].itemStyle.color).toBe(adminWorkbenchChartTheme.colors.primary)
expect(option.yAxis.splitLine).toEqual(adminWorkbenchChartTheme.splitLine)
expect(w.get('section').classes()).toContain('admin-workbench')
expect(w.find('.workbench-panel .workbench-chart-title').text()).toContain('SKU · 每日出库趋势')
expect(w.find('.workbench-meta').text()).toContain('所属货主:OWNER')
expect(w.findAll('.workbench-note').some(note => note.text().includes('完整出库量:30 件'))).toBe(true)
expect(chart.props('initOptions')).toEqual({ renderer: 'canvas' })
expect(w.get('.sku-trend').find('svg').exists()).toBe(false)
w.unmount()
@@ -37,4 +45,27 @@ describe('SKU daily trend axes', () => {
expect(option.xAxis.data).toHaveLength(30)
w.unmount()
})
it('retains partial segments, real zero and the coverage evidence dialog after theming', async () => {
const response = data()
response.points = [
{ ...response.points[0]!, outboundQuantity: '0', observedQuantity: '0' },
{ ...response.points[1]!, outboundQuantity: null, observedQuantity: '3', dataStatus: 'PARTIAL', coveredUntil: '2026-09-02 12:00:00' },
{ ...response.points[2]!, outboundQuantity: null, observedQuantity: null, dataStatus: 'UNKNOWN' },
{ ...response.points[3]!, outboundQuantity: '8', observedQuantity: '8' },
]
const w = mount(SkuTrend, { props: { data: response }, global: { plugins: [ElementPlus] } })
const option = w.findComponent({ name: 'VChart' }).props('option')
expect(option.series[0].data.map((point: { value: number | null }) => point.value)).toEqual([0, 3, null, 8])
expect(option.series[1]).toMatchObject({ data: [0, 3, null, null], lineStyle: { type: 'dashed', color: adminWorkbenchChartTheme.colors.primary } })
expect(option.series).toHaveLength(2)
expect(w.find('table').exists()).toBe(false)
const evidence = w.findAll('button').find(button => button.text() === '每日数量、完整性及覆盖证据')!
await evidence.trigger('click')
expect(w.get('table').text()).toContain('北京时间日期')
expect(w.get('table').text()).toContain('2026-09-02 12:00:00')
expect(w.findAll('tbody tr')).toHaveLength(4)
await w.setProps({ data: data('UNKNOWN') })
expect(w.find('table').exists()).toBe(false)
w.unmount()
})
})