feat(platform): add customer history export board
This commit is contained in:
@@ -1238,6 +1238,98 @@ export function History({
|
|||||||
<Tag color={currentProtocol ? 'blue' : 'green'}>当前来源:{currentProtocol || '全部来源'}</Tag>
|
<Tag color={currentProtocol ? 'blue' : 'green'}>当前来源:{currentProtocol || '全部来源'}</Tag>
|
||||||
<Typography.Text type="tertiary">{scopeDescription}</Typography.Text>
|
<Typography.Text type="tertiary">{scopeDescription}</Typography.Text>
|
||||||
</div>
|
</div>
|
||||||
|
{mode === 'query' ? (
|
||||||
|
<Card bordered className="vp-history-customer-export-board" bodyStyle={{ padding: 0 }}>
|
||||||
|
<div className="vp-history-customer-export-summary">
|
||||||
|
<Space wrap>
|
||||||
|
<Tag color="blue">客户数据导出</Tag>
|
||||||
|
<Tag color={deliveryStateColor}>{deliveryState}</Tag>
|
||||||
|
<Tag color={activeTab === 'location' ? 'green' : activeTab === 'raw' ? 'blue' : 'orange'}>
|
||||||
|
{activeTab === 'location' ? '位置历史' : activeTab === 'raw' ? '原始记录' : '字段明细'}
|
||||||
|
</Tag>
|
||||||
|
</Space>
|
||||||
|
<Typography.Title heading={5} style={{ margin: 0 }}>先锁定车辆和时间窗,再选择交付物并导出</Typography.Title>
|
||||||
|
<Typography.Text type="secondary">
|
||||||
|
面向客户的数据导出以车辆服务为中心:同一个筛选范围可以交付位置历史、RAW证据、字段明细、轨迹复盘和里程复核。
|
||||||
|
</Typography.Text>
|
||||||
|
<Space wrap>
|
||||||
|
<Button size="small" theme="solid" type="primary" onClick={() => openQueryTab('location')}>查询位置</Button>
|
||||||
|
<Button size="small" theme="light" type="primary" onClick={() => openQueryTab('raw')}>查询RAW</Button>
|
||||||
|
<Button size="small" theme="light" type="primary" onClick={() => openQueryTab('fields')}>字段明细</Button>
|
||||||
|
<Button size="small" theme="light" onClick={copyDeliveryPackage}>复制交付包</Button>
|
||||||
|
</Space>
|
||||||
|
</div>
|
||||||
|
<div className="vp-history-customer-export-steps">
|
||||||
|
{[
|
||||||
|
{
|
||||||
|
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<HTMLInputElement>('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) => (
|
||||||
|
<button
|
||||||
|
key={item.step}
|
||||||
|
type="button"
|
||||||
|
className="vp-history-customer-export-step"
|
||||||
|
disabled={item.disabled}
|
||||||
|
onClick={item.onClick}
|
||||||
|
aria-label={`客户数据导出 ${item.title} ${item.action}`}
|
||||||
|
>
|
||||||
|
<span>{item.step}</span>
|
||||||
|
<Tag color={item.color}>{item.title}</Tag>
|
||||||
|
<strong>{item.value}</strong>
|
||||||
|
<small>{item.detail}</small>
|
||||||
|
<em>{item.action}</em>
|
||||||
|
</button>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
</Card>
|
||||||
|
) : null}
|
||||||
<Card
|
<Card
|
||||||
bordered
|
bordered
|
||||||
title={<Space><span>客户轨迹决策台</span><Button size="small" icon={<IconCopy />} onClick={copyTrajectoryDecision}>复制决策说明</Button></Space>}
|
title={<Space><span>客户轨迹决策台</span><Button size="small" icon={<IconCopy />} onClick={copyTrajectoryDecision}>复制决策说明</Button></Space>}
|
||||||
|
|||||||
@@ -3458,6 +3458,92 @@ button.vp-realtime-command-item:focus-visible {
|
|||||||
word-break: break-word;
|
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 {
|
.vp-history-query-workbench {
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: minmax(260px, 0.68fr) minmax(0, 1.32fr);
|
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-anomaly-grid,
|
||||||
.vp-trajectory-impact-board,
|
.vp-trajectory-impact-board,
|
||||||
.vp-trajectory-impact-grid,
|
.vp-trajectory-impact-grid,
|
||||||
|
.vp-history-customer-export-board .semi-card-body,
|
||||||
|
.vp-history-customer-export-steps,
|
||||||
.vp-history-query-workbench,
|
.vp-history-query-workbench,
|
||||||
.vp-history-query-grid,
|
.vp-history-query-grid,
|
||||||
.vp-history-package-board,
|
.vp-history-package-board,
|
||||||
|
|||||||
@@ -6450,6 +6450,13 @@ test('shows parsed field history as a flattened evidence table', async () => {
|
|||||||
render(<App />);
|
render(<App />);
|
||||||
|
|
||||||
expect(await screen.findByRole('heading', { name: '数据导出' })).toBeInTheDocument();
|
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.getByText('客户轨迹决策台')).toBeInTheDocument();
|
||||||
expect(screen.getAllByRole('button', { name: /复制决策说明/ }).length).toBeGreaterThanOrEqual(1);
|
expect(screen.getAllByRole('button', { name: /复制决策说明/ }).length).toBeGreaterThanOrEqual(1);
|
||||||
expect(screen.getByRole('button', { name: '客户轨迹决策 证据交付 RAW证据' })).toBeInTheDocument();
|
expect(screen.getByRole('button', { name: '客户轨迹决策 证据交付 RAW证据' })).toBeInTheDocument();
|
||||||
|
|||||||
Reference in New Issue
Block a user