diff --git a/vehicle-data-platform/apps/web/src/pages/History.tsx b/vehicle-data-platform/apps/web/src/pages/History.tsx index e4506e92..15ffeec9 100644 --- a/vehicle-data-platform/apps/web/src/pages/History.tsx +++ b/vehicle-data-platform/apps/web/src/pages/History.tsx @@ -1238,6 +1238,98 @@ export function History({ 当前来源:{currentProtocol || '全部来源'} {scopeDescription} + {mode === 'query' ? ( + +
+ + 客户数据导出 + {deliveryState} + + {activeTab === 'location' ? '位置历史' : activeTab === 'raw' ? '原始记录' : '字段明细'} + + + 先锁定车辆和时间窗,再选择交付物并导出 + + 面向客户的数据导出以车辆服务为中心:同一个筛选范围可以交付位置历史、RAW证据、字段明细、轨迹复盘和里程复核。 + + + + + + + +
+
+ {[ + { + step: '01', + title: '选择范围', + value: currentVehicleKeyword || '全部车辆', + detail: `${currentProtocol || '全部来源'} / ${filters.dateFrom || '-'} 至 ${filters.dateTo || '-'}`, + action: '调整筛选', + color: currentVehicleKeyword ? 'green' as const : 'blue' as const, + disabled: false, + onClick: () => document.querySelector('input[name="keyword"]')?.focus() + }, + { + step: '02', + title: '位置历史', + value: `${locations.total.toLocaleString()} 条`, + detail: `${validLocations.length.toLocaleString()} 个有效坐标,可用于定位复盘和轨迹回放。`, + action: '导出位置', + color: locations.total > 0 ? 'green' as const : 'grey' as const, + disabled: locations.items.length === 0, + onClick: exportLocations + }, + { + step: '03', + title: 'RAW证据', + value: `${(rawFrames.total ?? 0).toLocaleString()} 帧`, + detail: '保留原始接入记录,用于解释位置、里程和字段来源。', + action: '导出RAW', + color: (rawFrames.total ?? 0) > 0 ? 'blue' as const : 'grey' as const, + disabled: rawFrames.items.length === 0, + onClick: exportRawFrames + }, + { + step: '04', + title: '字段明细', + value: `${rawFieldRows.length.toLocaleString()} 个`, + detail: selectedFieldCount > 0 ? `已裁剪 ${selectedFieldCount.toLocaleString()} 个字段。` : '需要字段级交付时切换字段明细或填写字段裁剪。', + action: '字段明细', + color: rawFieldRows.length > 0 ? 'green' as const : 'orange' as const, + disabled: false, + onClick: () => openQueryTab('fields') + }, + { + step: '05', + title: '交付说明', + value: deliveryState, + detail: anomalyTotal > 0 ? `存在 ${anomalyTotal.toLocaleString()} 项质量提示,交付时需说明。` : '当前范围未发现明显轨迹质量提示。', + action: '复制交付', + color: deliveryStateColor, + disabled: false, + onClick: copyDeliveryPackage + } + ].map((item) => ( + + ))} +
+
+ ) : null} 客户轨迹决策台} diff --git a/vehicle-data-platform/apps/web/src/styles/global.css b/vehicle-data-platform/apps/web/src/styles/global.css index 9bd10e75..6bbaace6 100644 --- a/vehicle-data-platform/apps/web/src/styles/global.css +++ b/vehicle-data-platform/apps/web/src/styles/global.css @@ -3458,6 +3458,92 @@ button.vp-realtime-command-item:focus-visible { word-break: break-word; } +.vp-history-customer-export-board { + margin-top: 16px; + overflow: hidden; +} + +.vp-history-customer-export-board .semi-card-body { + display: grid; + grid-template-columns: minmax(280px, 0.58fr) minmax(0, 1fr); +} + +.vp-history-customer-export-summary { + padding: 18px; + border-right: 1px solid var(--vp-border); + background: #f8fbff; + display: grid; + gap: 12px; + align-content: start; +} + +.vp-history-customer-export-steps { + padding: 16px; + display: grid; + grid-template-columns: repeat(5, minmax(0, 1fr)); + gap: 10px; + background: #fff; +} + +.vp-history-customer-export-step { + min-height: 156px; + padding: 12px; + border: 1px solid var(--vp-border); + border-radius: 8px; + background: #fbfcff; + text-align: left; + cursor: pointer; + font: inherit; + display: grid; + gap: 8px; + align-content: start; +} + +.vp-history-customer-export-step:hover, +.vp-history-customer-export-step:focus-visible { + border-color: rgba(22, 100, 255, 0.45); + box-shadow: var(--vp-shadow-sm); + outline: none; +} + +.vp-history-customer-export-step:disabled { + cursor: not-allowed; + opacity: 0.62; +} + +.vp-history-customer-export-step > span { + width: 28px; + height: 28px; + border-radius: 50%; + background: #1664ff; + color: #fff; + font-size: 12px; + font-weight: 700; + display: inline-flex; + align-items: center; + justify-content: center; +} + +.vp-history-customer-export-step strong { + color: var(--vp-text); + font-size: 18px; + line-height: 24px; +} + +.vp-history-customer-export-step small { + color: var(--vp-text-muted); + font-size: 12px; + line-height: 18px; +} + +.vp-history-customer-export-step em { + color: #1664ff; + font-style: normal; + font-size: 12px; + font-weight: 600; + align-self: end; +} + .vp-history-query-workbench { display: grid; grid-template-columns: minmax(260px, 0.68fr) minmax(0, 1.32fr); @@ -4850,6 +4936,8 @@ button.vp-realtime-command-item:focus-visible { .vp-trajectory-anomaly-grid, .vp-trajectory-impact-board, .vp-trajectory-impact-grid, + .vp-history-customer-export-board .semi-card-body, + .vp-history-customer-export-steps, .vp-history-query-workbench, .vp-history-query-grid, .vp-history-package-board, 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 91fabc73..7e6e9bb2 100644 --- a/vehicle-data-platform/apps/web/src/test/App.test.tsx +++ b/vehicle-data-platform/apps/web/src/test/App.test.tsx @@ -6450,6 +6450,13 @@ test('shows parsed field history as a flattened evidence table', async () => { render(); expect(await screen.findByRole('heading', { name: '数据导出' })).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: '客户数据导出 RAW证据 导出RAW' })).toBeInTheDocument(); + expect(screen.getByRole('button', { name: '客户数据导出 字段明细 字段明细' })).toBeInTheDocument(); + expect(screen.getByRole('button', { name: '客户数据导出 交付说明 复制交付' })).toBeInTheDocument(); expect(screen.getByText('客户轨迹决策台')).toBeInTheDocument(); expect(screen.getAllByRole('button', { name: /复制决策说明/ }).length).toBeGreaterThanOrEqual(1); expect(screen.getByRole('button', { name: '客户轨迹决策 证据交付 RAW证据' })).toBeInTheDocument();