feat(platform): add mileage definition delivery strip

This commit is contained in:
lingniu
2026-07-06 03:14:39 +08:00
parent 311a29a1dc
commit 89214a6b7f
3 changed files with 225 additions and 3 deletions

View File

@@ -1446,6 +1446,66 @@ export function Mileage({
onClick: exportMileage
}
];
const mileageDefinitionMetrics = [
{
label: '区间总值',
value: `${formatKm(summary.totalMileageKm)} km`,
detail: `来自汇总口径,覆盖 ${summary.vehicleCount.toLocaleString()} 辆车。`,
color: 'blue' as const,
onClick: copyStatisticsSummary
},
{
label: '明细合计',
value: `${formatKm(pageMileageTotal)} km`,
detail: `${rows.length.toLocaleString()} / ${summary.recordCount.toLocaleString()} 条明细,覆盖 ${formatPercent(pageCoverageRate)}`,
color: hasFullMileagePage ? 'green' as const : 'orange' as const,
onClick: copyPublishAudit
},
{
label: '闭合差值',
value: closureDeltaKm == null ? '需全量' : `${formatKm(Math.abs(closureDeltaKm))} km`,
detail: closureDeltaKm == null ? '当前为分页抽样,交付前需要拉齐全量明细。' : closureActionText,
color: closureStatusColor,
onClick: copyPublishAudit
},
{
label: '异常记录',
value: `${anomalyRows.length.toLocaleString()}`,
detail: anomalyRows[0] ? `${anomalyRows[0].plate || anomalyRows[0].vin} / ${anomalyRows[0].date} 优先复核。` : '当前页没有异常日里程。',
color: anomalyRows.length > 0 ? 'orange' as const : 'green' as const,
onClick: () => anomalyRows[0] ? copyMileageEvidence(anomalyRows[0]) : copyMileageDecision()
}
];
const mileageDefinitionActions = [
{
label: '复制口径',
action: '决策说明',
color: 'blue' as const,
disabled: false,
onClick: copyMileageDecision
},
{
label: '复制交付',
action: '交付包',
color: mileageDeliveryColor,
disabled: false,
onClick: copyMileageDeliveryPackage
},
{
label: '轨迹复核',
action: '轨迹',
color: currentVehicleKeyword ? 'blue' as const : 'grey' as const,
disabled: !currentVehicleKeyword || !onOpenHistory,
onClick: () => onOpenHistory?.({ keyword: currentVehicleKeyword, protocol: currentProtocol, dateFrom: filters.dateFrom ?? '', dateTo: filters.dateTo ?? '' })
},
{
label: '导出明细',
action: 'CSV',
color: rows.length > 0 ? 'blue' as const : 'grey' as const,
disabled: rows.length === 0,
onClick: exportMileage
}
];
const mileageServiceTasks = [
{
title: '发布判断',
@@ -1655,6 +1715,51 @@ export function Mileage({
))}
</div>
</section>
<section className="vp-mileage-definition-strip" aria-label="客户里程口径交付条">
<div className="vp-mileage-definition-copy">
<Space wrap>
<Tag color="blue"></Tag>
<Tag color={closureStatusColor}>{closureStatus}</Tag>
<Tag color={publishAuditColor}>{publishAuditConclusion}</Tag>
</Space>
<Typography.Title heading={5} style={{ margin: 0 }}>
</Typography.Title>
<Typography.Text type="secondary">
BI
</Typography.Text>
</div>
<div className="vp-mileage-definition-metrics">
{mileageDefinitionMetrics.map((item) => (
<button
key={item.label}
type="button"
className="vp-mileage-definition-metric"
onClick={item.onClick}
aria-label={`客户里程口径交付 ${item.label} ${item.value}`}
>
<Tag color={item.color}>{item.label}</Tag>
<strong>{item.value}</strong>
<span>{item.detail}</span>
</button>
))}
</div>
<div className="vp-mileage-definition-actions">
{mileageDefinitionActions.map((item) => (
<button
key={item.label}
type="button"
className="vp-mileage-definition-action"
disabled={item.disabled}
onClick={item.onClick}
aria-label={`客户里程口径动作 ${item.label} ${item.action}`}
>
<Tag color={item.color}>{item.label}</Tag>
<span>{item.action}</span>
</button>
))}
</div>
</section>
<section className="vp-mileage-customer-workbench" aria-label="客户里程统计工作台">
<div className="vp-mileage-customer-workbench-main">
<Space wrap>

View File

@@ -8932,6 +8932,109 @@ button.vp-realtime-command-item:focus-visible {
white-space: nowrap;
}
.vp-mileage-definition-strip {
margin-top: 12px;
border: 1px solid rgba(11, 159, 119, 0.18);
border-radius: var(--vp-radius);
background: #fff;
display: grid;
grid-template-columns: minmax(300px, 0.92fr) minmax(0, 1.28fr) minmax(190px, 0.5fr);
overflow: hidden;
}
.vp-mileage-definition-copy {
padding: 18px;
border-right: 1px solid var(--vp-border);
background: #f6fbf9;
display: grid;
gap: 10px;
align-content: start;
}
.vp-mileage-definition-metrics {
padding: 14px;
display: grid;
grid-template-columns: repeat(4, minmax(0, 1fr));
gap: 10px;
}
.vp-mileage-definition-metric {
min-height: 112px;
padding: 12px;
border: 1px solid rgba(11, 159, 119, 0.14);
border-radius: 8px;
background: #fbfefc;
color: inherit;
cursor: pointer;
font: inherit;
text-align: left;
display: grid;
gap: 8px;
align-content: start;
}
.vp-mileage-definition-metric:hover,
.vp-mileage-definition-metric:focus-visible,
.vp-mileage-definition-action:hover,
.vp-mileage-definition-action:focus-visible {
border-color: rgba(11, 159, 119, 0.4);
background: #f5fbf8;
box-shadow: var(--vp-shadow-sm);
outline: none;
}
.vp-mileage-definition-metric strong {
color: var(--vp-text);
font-size: 19px;
line-height: 24px;
word-break: break-word;
}
.vp-mileage-definition-metric span {
color: var(--vp-text-muted);
font-size: 12px;
line-height: 18px;
word-break: break-word;
}
.vp-mileage-definition-actions {
padding: 14px;
border-left: 1px solid var(--vp-border);
background: #fbfefc;
display: grid;
grid-template-columns: 1fr;
gap: 8px;
}
.vp-mileage-definition-action {
min-height: 46px;
padding: 8px 10px;
border: 1px solid rgba(11, 159, 119, 0.14);
border-radius: 8px;
background: #fff;
color: inherit;
cursor: pointer;
font: inherit;
text-align: left;
display: flex;
align-items: center;
justify-content: space-between;
gap: 8px;
}
.vp-mileage-definition-action:disabled {
cursor: not-allowed;
opacity: 0.62;
}
.vp-mileage-definition-action span {
color: var(--vp-success);
font-size: 12px;
font-weight: 700;
line-height: 18px;
white-space: nowrap;
}
.vp-mileage-customer-workbench {
margin-top: 16px;
border: 1px solid rgba(22, 100, 255, 0.18);
@@ -13699,6 +13802,8 @@ button.vp-realtime-command-item:focus-visible {
.vp-stat-insight-grid,
.vp-mileage-conclusion-strip,
.vp-mileage-conclusion-metrics,
.vp-mileage-definition-strip,
.vp-mileage-definition-metrics,
.vp-mileage-customer-workbench,
.vp-mileage-customer-workbench-grid,
.vp-mileage-reconciliation-conclusion,
@@ -13836,7 +13941,9 @@ button.vp-realtime-command-item:focus-visible {
}
.vp-mileage-conclusion-copy,
.vp-mileage-conclusion-actions {
.vp-mileage-conclusion-actions,
.vp-mileage-definition-copy,
.vp-mileage-definition-actions {
border-left: 0;
border-right: 0;
border-bottom: 1px solid var(--vp-border);

View File

@@ -9157,8 +9157,8 @@ test('shows mileage statistics workspace with trend source and definition', asyn
expect(screen.getAllByText('140 km').length).toBeGreaterThanOrEqual(1);
expect(screen.getByText('统计闭合工作台')).toBeInTheDocument();
expect(screen.getByText('汇总总里程')).toBeInTheDocument();
expect(screen.getByText('明细合计')).toBeInTheDocument();
expect(screen.getByText('闭合差值')).toBeInTheDocument();
expect(screen.getAllByText('明细合计').length).toBeGreaterThanOrEqual(1);
expect(screen.getAllByText('闭合差值').length).toBeGreaterThanOrEqual(1);
expect(screen.getByText('记录覆盖率')).toBeInTheDocument();
expect(screen.getAllByText('闭合通过').length).toBeGreaterThanOrEqual(1);
expect(screen.getAllByText('当前筛选范围汇总总里程与明细合计一致,可作为统计证据。').length).toBeGreaterThanOrEqual(1);
@@ -9312,6 +9312,16 @@ test('shows vehicle-first statistics domains for one vehicle service', async ()
expect(screen.getByRole('button', { name: '客户里程动作 轨迹复核 轨迹回放' })).toBeInTheDocument();
expect(screen.getByRole('button', { name: '客户里程动作 导出明细 导出CSV' })).toBeInTheDocument();
expect(screen.getByRole('button', { name: '客户里程动作 告警通知 在线态势' })).toBeInTheDocument();
expect(screen.getByText('客户里程口径交付条')).toBeInTheDocument();
expect(screen.getByText('日里程按当天首末总里程差值计算;区间总值必须等于每日里程之和,异常日进入轨迹和历史明细复核。')).toBeInTheDocument();
expect(screen.getByRole('button', { name: '客户里程口径交付 区间总值 210 km' })).toBeInTheDocument();
expect(screen.getByRole('button', { name: '客户里程口径交付 明细合计 170 km' })).toBeInTheDocument();
expect(screen.getByRole('button', { name: '客户里程口径交付 闭合差值 需全量' })).toBeInTheDocument();
expect(screen.getByRole('button', { name: '客户里程口径交付 异常记录 1 条' })).toBeInTheDocument();
expect(screen.getByRole('button', { name: '客户里程口径动作 复制口径 决策说明' })).toBeInTheDocument();
expect(screen.getByRole('button', { name: '客户里程口径动作 复制交付 交付包' })).toBeInTheDocument();
expect(screen.getByRole('button', { name: '客户里程口径动作 轨迹复核 轨迹' })).toBeInTheDocument();
expect(screen.getByRole('button', { name: '客户里程口径动作 导出明细 CSV' })).toBeInTheDocument();
expect(screen.getByText('客户里程统计工作台')).toBeInTheDocument();
expect(screen.getByText('统计页先回答客户这段时间跑了多少、每日是否闭合、异常在哪里、能否导出。')).toBeInTheDocument();
expect(screen.getByText('来源证据只用于统计可信度JT808')).toBeInTheDocument();