From e7b49df8ed8dd096a341a65dd5e2c38d4cedb498 Mon Sep 17 00:00:00 2001 From: lingniu Date: Sun, 19 Jul 2026 01:18:42 +0800 Subject: [PATCH] feat: guide history query start --- .../apps/web/src/v2/pages/HistoryPage.test.tsx | 8 ++++++-- .../apps/web/src/v2/pages/HistoryPage.tsx | 14 +++++++++----- .../apps/web/src/v2/styles/workspace.css | 9 ++++++++- 3 files changed, 23 insertions(+), 8 deletions(-) diff --git a/vehicle-data-platform/apps/web/src/v2/pages/HistoryPage.test.tsx b/vehicle-data-platform/apps/web/src/v2/pages/HistoryPage.test.tsx index 7e76eed5..ed16b1e1 100644 --- a/vehicle-data-platform/apps/web/src/v2/pages/HistoryPage.test.tsx +++ b/vehicle-data-platform/apps/web/src/v2/pages/HistoryPage.test.tsx @@ -202,10 +202,14 @@ test('uses one focused Semi bottom SideSheet for the complete mobile history que mocks.historyExports.mockResolvedValue([]); renderPage('/history'); - await screen.findByText('等待查询历史数据'); + await screen.findByText('选择车辆开始查询'); const trigger = screen.getByRole('button', { name: '修改查询范围:请选择车辆' }); expect(trigger).toHaveAttribute('aria-expanded', 'false'); - fireEvent.click(trigger); + expect(screen.queryByRole('button', { name: '展开趋势' })).not.toBeInTheDocument(); + expect(screen.queryByRole('button', { name: '打开历史数据工具' })).not.toBeInTheDocument(); + expect(screen.queryByRole('button', { name: 'Previous' })).not.toBeInTheDocument(); + fireEvent.click(screen.getByRole('button', { name: '选择车辆并查询' })); + expect(trigger).toHaveAttribute('aria-expanded', 'true'); const dialog = await screen.findByRole('dialog', { name: '历史查询范围' }); expect(document.querySelector('.v2-history-filter-sidesheet')).toHaveClass('semi-sidesheet-bottom'); diff --git a/vehicle-data-platform/apps/web/src/v2/pages/HistoryPage.tsx b/vehicle-data-platform/apps/web/src/v2/pages/HistoryPage.tsx index 61c6fd17..1c0e99ac 100644 --- a/vehicle-data-platform/apps/web/src/v2/pages/HistoryPage.tsx +++ b/vehicle-data-platform/apps/web/src/v2/pages/HistoryPage.tsx @@ -483,7 +483,7 @@ export default function HistoryPage() { description={keywords.length ? `${(result?.total ?? 0).toLocaleString('zh-CN')} 条记录 · ${resultSummary?.vehicleCount ?? 0} 辆车辆 · ${summarySources}` : '选择车辆和时间范围后查询'} meta={{visibleMetrics.length} / {allMetrics.length} 字段{resultSummary ? {resultSummary.queryDurationMs} ms : null}} actionsClassName={`v2-history-result-actions${mobileLayout ? ' is-mobile-actions' : ''}`} - actions={mobileLayout ? <> + actions={mobileLayout ? keywords.length ? <> - : <> + : null : <> {exportAllowed ? : null} @@ -516,14 +516,18 @@ export default function HistoryPage() { > {mobileLayout ?
{resultRows.map((row) => )}
- : } + : resultRows.length ? : null} {dataQuery.isPending && keywords.length ? : !resultRows.length - ? + ? } aria-label={keywords.length ? '调整查询范围' : '选择车辆并查询'} onClick={() => setFiltersCollapsed(false)}>{keywords.length ? '调整查询范围' : '选择车辆并查询'} : null} + /> : null} -
setOffset((next - 1) * limit)} pageSize={mobileLayout ? undefined : limit} onPageSizeChange={(next) => { setLimit(next); setOffset(0); }} pageSizeOptions={mobileLayout ? undefined : [{ value: 20, label: '20 条/页' }, { value: 50, label: '50 条/页' }, { value: 100, label: '100 条/页' }]} />
+ {keywords.length ?
setOffset((next - 1) * limit)} pageSize={mobileLayout ? undefined : limit} onPageSizeChange={(next) => { setLimit(next); setOffset(0); }} pageSizeOptions={mobileLayout ? undefined : [{ value: 20, label: '20 条/页' }, { value: 50, label: '50 条/页' }, { value: 100, label: '100 条/页' }]} />
: null} {!mobileLayout && selectedRow ? : null} diff --git a/vehicle-data-platform/apps/web/src/v2/styles/workspace.css b/vehicle-data-platform/apps/web/src/v2/styles/workspace.css index 610dd96c..ddbe6ab0 100644 --- a/vehicle-data-platform/apps/web/src/v2/styles/workspace.css +++ b/vehicle-data-platform/apps/web/src/v2/styles/workspace.css @@ -17133,10 +17133,17 @@ } .v2-history-mobile-discovery > .v2-mobile-filter-toggle.semi-button { - min-height: 58px; + min-height: 52px; margin: 0; } + .v2-history-empty .v2-history-empty-action.semi-button { + min-width: 156px; + min-height: 42px; + border-radius: 9px; + font-weight: 700; + } + .v2-history-filter-sidesheet .semi-sidesheet-inner { width: 100vw !important; max-width: 100%;