From 36ac5fe7c530072a5c3374518a5599313de78ec2 Mon Sep 17 00:00:00 2001 From: lingniu Date: Sun, 5 Jul 2026 20:21:51 +0800 Subject: [PATCH] feat(platform): add customer report purpose navigation --- .../apps/web/src/pages/History.tsx | 68 +++++++++++++++++ .../apps/web/src/styles/global.css | 73 +++++++++++++++++++ .../apps/web/src/test/App.test.tsx | 6 ++ 3 files changed, 147 insertions(+) diff --git a/vehicle-data-platform/apps/web/src/pages/History.tsx b/vehicle-data-platform/apps/web/src/pages/History.tsx index 0501ae6a..078b5703 100644 --- a/vehicle-data-platform/apps/web/src/pages/History.tsx +++ b/vehicle-data-platform/apps/web/src/pages/History.tsx @@ -1254,6 +1254,44 @@ export function History({ onClick: () => openQueryTab('fields') } ]; + const customerReportPurposeItems = [ + { + title: '日报复盘', + value: '运营早会', + detail: '每天快速交付车辆位置、轨迹覆盖、区间里程和质量提示。', + action: '生成日报', + color: locations.total > 0 ? 'green' as const : 'orange' as const, + disabled: locations.items.length === 0, + onClick: () => exportLocations() + }, + { + title: '周报对账', + value: '客户对账', + detail: '把固定车辆范围和时间窗沉淀为周报计划,给客户对账复核。', + action: '生成周报', + color: 'blue' as const, + disabled: false, + onClick: () => copyScheduledHistoryReportPlan() + }, + { + title: '临时解释', + value: '质量说明', + detail: '遇到定位、里程或断链质疑时,复制带证据链接的解释说明。', + action: '复制说明', + color: deliveryStateColor, + disabled: false, + onClick: () => copyDeliveryPackage() + }, + { + title: '字段模板', + value: '稳定字段', + detail: '按客户固定字段裁剪导出,减少体积并保证每次字段一致。', + action: '字段配置', + color: selectedFieldCount > 0 || rawFieldRows.length > 0 ? 'green' as const : 'orange' as const, + disabled: false, + onClick: () => openQueryTab('fields') + } + ]; const savedReportViewItems = [ { title: '当前筛选', @@ -1905,6 +1943,36 @@ export function History({ ) : null} {mode === 'query' ? ( +
+
+ + 客户报表用途导航 + {deliveryState} + {currentVehicleKeyword ? '单车范围' : '全部车辆'} + + 先选择客户要解决的问题,再决定导出位置、字段、统计或说明。 + + 报表入口按客户用途组织:日报复盘、周报对账、临时问题解释和字段模板复用,避免客户先面对 RAW 或字段明细。 + +
+
+ {customerReportPurposeItems.map((item) => ( + + ))} +
+
diff --git a/vehicle-data-platform/apps/web/src/styles/global.css b/vehicle-data-platform/apps/web/src/styles/global.css index 1e960619..24225766 100644 --- a/vehicle-data-platform/apps/web/src/styles/global.css +++ b/vehicle-data-platform/apps/web/src/styles/global.css @@ -7598,11 +7598,82 @@ button.vp-realtime-command-item:focus-visible { } .vp-history-report-cadence { + margin-top: 14px; display: grid; grid-template-columns: minmax(300px, 0.7fr) minmax(0, 1.3fr); gap: 14px; } +.vp-history-report-purpose { + display: grid; + grid-template-columns: minmax(300px, 0.7fr) minmax(0, 1.3fr); + gap: 14px; +} + +.vp-history-report-purpose-summary { + padding: 14px; + border: 1px solid rgba(10, 168, 107, 0.22); + border-radius: var(--vp-radius); + background: #f5fbf8; + display: grid; + gap: 10px; + align-content: start; +} + +.vp-history-report-purpose-grid { + display: grid; + grid-template-columns: repeat(4, minmax(0, 1fr)); + gap: 12px; +} + +.vp-history-report-purpose-item { + min-height: 158px; + padding: 12px; + border: 1px solid var(--vp-border); + border-radius: var(--vp-radius); + background: #fbfcff; + color: inherit; + text-align: left; + font: inherit; + cursor: pointer; + display: grid; + gap: 8px; + align-content: start; +} + +.vp-history-report-purpose-item:hover, +.vp-history-report-purpose-item:focus-visible { + border-color: rgba(22, 100, 255, 0.42); + box-shadow: 0 10px 24px rgba(24, 39, 75, 0.08); + outline: none; +} + +.vp-history-report-purpose-item:disabled { + cursor: not-allowed; + opacity: 0.62; +} + +.vp-history-report-purpose-item strong { + color: var(--vp-text); + font-size: 18px; + line-height: 24px; + font-weight: 700; + word-break: break-word; +} + +.vp-history-report-purpose-item span { + color: var(--vp-text-muted); + font-size: 12px; + line-height: 18px; +} + +.vp-history-report-purpose-item em { + color: var(--vp-primary); + font-size: 12px; + font-style: normal; + font-weight: 700; +} + .vp-history-report-cadence-summary { padding: 14px; border: 1px solid rgba(22, 100, 255, 0.18); @@ -9705,6 +9776,8 @@ button.vp-realtime-command-item:focus-visible { .vp-history-customer-export-steps, .vp-history-report-templates, .vp-history-report-template-grid, + .vp-history-report-purpose, + .vp-history-report-purpose-grid, .vp-history-report-cadence, .vp-history-report-cadence-grid, .vp-history-saved-report, diff --git a/vehicle-data-platform/apps/web/src/test/App.test.tsx b/vehicle-data-platform/apps/web/src/test/App.test.tsx index 3a5e381b..5e258310 100644 --- a/vehicle-data-platform/apps/web/src/test/App.test.tsx +++ b/vehicle-data-platform/apps/web/src/test/App.test.tsx @@ -7092,6 +7092,12 @@ test('shows parsed field history as a flattened evidence table', async () => { expect(screen.getByRole('button', { name: '报表交付模板 周期交付计划 复制计划' })).toBeInTheDocument(); expect(screen.getByText('客户报表交付节奏')).toBeInTheDocument(); expect(screen.getByText('参考 Fleetio、Samsara、Geotab 的报表能力,把导出从一次性下载升级为可复用的交付节奏。')).toBeInTheDocument(); + expect(screen.getByText('客户报表用途导航')).toBeInTheDocument(); + expect(screen.getByText('先选择客户要解决的问题,再决定导出位置、字段、统计或说明。')).toBeInTheDocument(); + expect(screen.getByRole('button', { name: '客户报表用途导航 日报复盘 运营早会 生成日报' })).toBeInTheDocument(); + expect(screen.getByRole('button', { name: '客户报表用途导航 周报对账 客户对账 生成周报' })).toBeInTheDocument(); + expect(screen.getByRole('button', { name: '客户报表用途导航 临时解释 质量说明 复制说明' })).toBeInTheDocument(); + expect(screen.getByRole('button', { name: '客户报表用途导航 字段模板 稳定字段 字段配置' })).toBeInTheDocument(); expect(screen.getByRole('button', { name: '客户报表交付节奏 每日运营复盘 日报导出' })).toBeInTheDocument(); expect(screen.getByRole('button', { name: '客户报表交付节奏 每周客户对账 周报计划' })).toBeInTheDocument(); expect(screen.getByRole('button', { name: '客户报表交付节奏 临时问题解释 复制说明' })).toBeInTheDocument();