feat(platform): add customer export workbench
This commit is contained in:
@@ -2002,6 +2002,41 @@ export function Dashboard({
|
||||
onClick: openTimeMonitorRaw
|
||||
}
|
||||
];
|
||||
const deliveryScopeText = `${timeMonitorScopeValue.keyword || '全部车辆'} / ${timeMonitorScopeValue.protocol || '全部数据通道'} / ${timeMonitorScopeValue.dateFrom || '-'} 至 ${timeMonitorScopeValue.dateTo || '-'}`;
|
||||
const customerDeliveryWorkbenchItems = [
|
||||
{
|
||||
label: '轨迹回放',
|
||||
value: `${formatCount(summary?.activeToday)} 活跃`,
|
||||
detail: '回放同一时间窗内的路线、速度、停驶和里程断点。',
|
||||
action: '回放轨迹',
|
||||
color: 'blue' as const,
|
||||
onClick: openTimeMonitorHistory
|
||||
},
|
||||
{
|
||||
label: '里程统计',
|
||||
value: `${formatCount(serviceSummary?.totalVehicles)} 车辆`,
|
||||
detail: '核对区间里程、每日统计和 BI 展示口径。',
|
||||
action: '统计查询',
|
||||
color: 'green' as const,
|
||||
onClick: openTimeMonitorMileage
|
||||
},
|
||||
{
|
||||
label: '历史明细',
|
||||
value: `${formatCount(summary?.frameToday)} 帧`,
|
||||
detail: '查询位置历史、原始记录和解析字段,作为客户证据。',
|
||||
action: '历史导出',
|
||||
color: 'blue' as const,
|
||||
onClick: openTimeMonitorRaw
|
||||
},
|
||||
{
|
||||
label: '告警说明',
|
||||
value: `${formatCount(summary?.issueVehicles)} 告警`,
|
||||
detail: highPriorityIssue ? `${qualityIssueLabel(highPriorityIssue.issueType)} / ${priorityIssueVehicleLabel(highPriorityIssue)}` : '当前没有高优先级告警,可作为无异常说明。',
|
||||
action: '告警通知',
|
||||
color: (summary?.issueVehicles ?? 0) > 0 ? 'orange' as const : 'green' as const,
|
||||
onClick: openTimeMonitorAlerts
|
||||
}
|
||||
];
|
||||
|
||||
return (
|
||||
<div className="vp-page">
|
||||
@@ -2091,6 +2126,38 @@ export function Dashboard({
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<section className="vp-customer-delivery-workbench" aria-label="客户查询导出交付台">
|
||||
<div className="vp-customer-delivery-workbench-copy">
|
||||
<Space wrap>
|
||||
<Tag color="blue">客户查询导出交付台</Tag>
|
||||
<Tag color={timeMonitorHasRange ? 'green' : 'orange'}>{dayRangeText(timeMonitorScopeValue.dateFrom, timeMonitorScopeValue.dateTo)}</Tag>
|
||||
<Tag color={timeMonitorDeliveryStatus.color}>{timeMonitorDeliveryStatus.label}</Tag>
|
||||
</Space>
|
||||
<Typography.Title heading={5} style={{ margin: 0 }}>
|
||||
先锁定车辆和时间窗,再选择轨迹、里程、历史明细或告警说明,最终交付一份客户能看懂的数据包。
|
||||
</Typography.Title>
|
||||
<div className="vp-customer-delivery-scope">
|
||||
<span>当前交付范围</span>
|
||||
<strong>{deliveryScopeText}</strong>
|
||||
</div>
|
||||
</div>
|
||||
<div className="vp-customer-delivery-workbench-grid">
|
||||
{customerDeliveryWorkbenchItems.map((item) => (
|
||||
<button
|
||||
key={item.label}
|
||||
type="button"
|
||||
className="vp-customer-delivery-workbench-item"
|
||||
onClick={item.onClick}
|
||||
aria-label={`客户查询导出交付台 ${item.label} ${item.value} ${item.action}`}
|
||||
>
|
||||
<Tag color={item.color}>{item.label}</Tag>
|
||||
<strong>{item.value}</strong>
|
||||
<span>{item.detail}</span>
|
||||
<em>{item.action}</em>
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
</section>
|
||||
<section className="vp-customer-map-situation" aria-label="车辆地图态势">
|
||||
<div className="vp-customer-map-situation-map">
|
||||
<VehicleMap
|
||||
|
||||
@@ -1375,6 +1375,110 @@ body {
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.vp-customer-delivery-workbench {
|
||||
margin-bottom: 16px;
|
||||
padding: 14px;
|
||||
border: 1px solid rgba(22, 100, 255, 0.18);
|
||||
border-radius: 8px;
|
||||
background: #ffffff;
|
||||
display: grid;
|
||||
grid-template-columns: minmax(280px, 0.48fr) minmax(0, 1.52fr);
|
||||
gap: 14px;
|
||||
align-items: stretch;
|
||||
}
|
||||
|
||||
.vp-customer-delivery-workbench-copy {
|
||||
min-width: 0;
|
||||
padding: 14px;
|
||||
border: 1px solid var(--vp-border);
|
||||
border-radius: 8px;
|
||||
background: #f8fbff;
|
||||
display: grid;
|
||||
gap: 12px;
|
||||
align-content: start;
|
||||
}
|
||||
|
||||
.vp-customer-delivery-workbench-copy .semi-typography {
|
||||
color: var(--vp-text);
|
||||
line-height: 24px;
|
||||
}
|
||||
|
||||
.vp-customer-delivery-scope {
|
||||
padding: 12px;
|
||||
border: 1px solid rgba(22, 100, 255, 0.18);
|
||||
border-radius: 8px;
|
||||
background: #ffffff;
|
||||
display: grid;
|
||||
gap: 6px;
|
||||
}
|
||||
|
||||
.vp-customer-delivery-scope span {
|
||||
color: var(--vp-text-muted);
|
||||
font-size: 12px;
|
||||
line-height: 18px;
|
||||
}
|
||||
|
||||
.vp-customer-delivery-scope strong {
|
||||
color: var(--vp-text);
|
||||
font-size: 15px;
|
||||
line-height: 22px;
|
||||
word-break: break-word;
|
||||
}
|
||||
|
||||
.vp-customer-delivery-workbench-grid {
|
||||
min-width: 0;
|
||||
display: grid;
|
||||
grid-template-columns: repeat(4, minmax(0, 1fr));
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.vp-customer-delivery-workbench-item {
|
||||
min-width: 0;
|
||||
min-height: 164px;
|
||||
padding: 13px;
|
||||
border: 1px solid var(--vp-border);
|
||||
border-radius: 8px;
|
||||
background: #ffffff;
|
||||
color: inherit;
|
||||
cursor: pointer;
|
||||
font: inherit;
|
||||
text-align: left;
|
||||
display: grid;
|
||||
gap: 8px;
|
||||
align-content: start;
|
||||
transition: border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
|
||||
}
|
||||
|
||||
.vp-customer-delivery-workbench-item:hover,
|
||||
.vp-customer-delivery-workbench-item:focus-visible {
|
||||
border-color: rgba(22, 100, 255, 0.42);
|
||||
background: #f7fbff;
|
||||
box-shadow: 0 0 0 3px rgba(22, 100, 255, 0.08);
|
||||
outline: none;
|
||||
}
|
||||
|
||||
.vp-customer-delivery-workbench-item strong {
|
||||
color: var(--vp-text);
|
||||
font-size: 19px;
|
||||
line-height: 25px;
|
||||
word-break: break-word;
|
||||
}
|
||||
|
||||
.vp-customer-delivery-workbench-item span {
|
||||
color: var(--vp-text-muted);
|
||||
font-size: 12px;
|
||||
line-height: 18px;
|
||||
word-break: break-word;
|
||||
}
|
||||
|
||||
.vp-customer-delivery-workbench-item em {
|
||||
color: var(--vp-primary);
|
||||
font-size: 12px;
|
||||
font-style: normal;
|
||||
font-weight: 700;
|
||||
line-height: 18px;
|
||||
}
|
||||
|
||||
.vp-customer-map-situation {
|
||||
margin-bottom: 16px;
|
||||
padding: 14px;
|
||||
@@ -10660,6 +10764,8 @@ button.vp-realtime-command-item:focus-visible {
|
||||
.vp-vehicle-task-grid,
|
||||
.vp-dispatch-operations-home,
|
||||
.vp-dispatch-operations-highlights,
|
||||
.vp-customer-delivery-workbench,
|
||||
.vp-customer-delivery-workbench-grid,
|
||||
.vp-source-readiness-grid,
|
||||
.vp-source-readiness-metrics,
|
||||
.vp-map-ops-board,
|
||||
|
||||
@@ -825,6 +825,97 @@ test('dashboard presents a customer dispatch operations home', async () => {
|
||||
expect(screen.getByRole('button', { name: '调度运营任务 导出客户证据 1,286,320 帧 历史导出' })).toBeInTheDocument();
|
||||
});
|
||||
|
||||
test('dashboard frames history query and export as a customer delivery workbench', async () => {
|
||||
window.history.replaceState(null, '', '/#/dashboard');
|
||||
vi.spyOn(globalThis, 'fetch').mockImplementation(async (input) => {
|
||||
const path = String(input);
|
||||
if (path.includes('/api/ops/health')) {
|
||||
return {
|
||||
ok: true,
|
||||
json: async () => ({
|
||||
data: {
|
||||
linkHealth: [],
|
||||
kafkaLag: 0,
|
||||
activeConnections: 0,
|
||||
capacityFindings: [],
|
||||
redisOnlineKeys: 0,
|
||||
tdengineWritable: true,
|
||||
mysqlWritable: true,
|
||||
runtime: {
|
||||
requestTimeoutMs: 5000,
|
||||
amapWebJsConfigured: true,
|
||||
amapApiConfigured: true,
|
||||
amapSecurityProxyEnabled: true,
|
||||
amapSecurityCodeExposed: false
|
||||
}
|
||||
},
|
||||
traceId: 'trace-test',
|
||||
timestamp: 1783094400000
|
||||
})
|
||||
} as Response;
|
||||
}
|
||||
if (path.includes('/api/dashboard/summary')) {
|
||||
return {
|
||||
ok: true,
|
||||
json: async () => ({
|
||||
data: {
|
||||
onlineVehicles: 3,
|
||||
activeToday: 4,
|
||||
frameToday: 1286320,
|
||||
issueVehicles: 7,
|
||||
kafkaLag: 0,
|
||||
protocols: [],
|
||||
serviceStatuses: [],
|
||||
linkHealth: []
|
||||
},
|
||||
traceId: 'trace-test',
|
||||
timestamp: 1783094400000
|
||||
})
|
||||
} as Response;
|
||||
}
|
||||
if (path.includes('/api/vehicle-service/summary')) {
|
||||
return {
|
||||
ok: true,
|
||||
json: async () => ({
|
||||
data: {
|
||||
totalVehicles: 1033,
|
||||
boundVehicles: 1024,
|
||||
onlineVehicles: 208,
|
||||
singleSourceVehicles: 391,
|
||||
multiSourceVehicles: 181,
|
||||
noDataVehicles: 461,
|
||||
identityRequiredVehicles: 9,
|
||||
serviceStatuses: [],
|
||||
protocols: [],
|
||||
missingSources: []
|
||||
},
|
||||
traceId: 'trace-test',
|
||||
timestamp: 1783094400000
|
||||
})
|
||||
} as Response;
|
||||
}
|
||||
return {
|
||||
ok: true,
|
||||
json: async () => ({
|
||||
data: { items: [], total: 0, limit: 8, offset: 0 },
|
||||
traceId: 'trace-test',
|
||||
timestamp: 1783094400000
|
||||
})
|
||||
} as Response;
|
||||
});
|
||||
|
||||
render(<App />);
|
||||
|
||||
expect(await screen.findByText('客户查询导出交付台')).toBeInTheDocument();
|
||||
expect(screen.getByText('先锁定车辆和时间窗,再选择轨迹、里程、历史明细或告警说明,最终交付一份客户能看懂的数据包。')).toBeInTheDocument();
|
||||
expect(screen.getByText('当前交付范围')).toBeInTheDocument();
|
||||
expect(screen.getAllByText('全部车辆 / 全部数据通道 / 2026-07-04 至 2026-07-05').length).toBeGreaterThan(0);
|
||||
expect(screen.getByRole('button', { name: '客户查询导出交付台 轨迹回放 4 活跃 回放轨迹' })).toBeInTheDocument();
|
||||
expect(screen.getByRole('button', { name: '客户查询导出交付台 里程统计 1,033 车辆 统计查询' })).toBeInTheDocument();
|
||||
expect(screen.getByRole('button', { name: '客户查询导出交付台 历史明细 1,286,320 帧 历史导出' })).toBeInTheDocument();
|
||||
expect(screen.getByRole('button', { name: '客户查询导出交付台 告警说明 7 告警 告警通知' })).toBeInTheDocument();
|
||||
});
|
||||
|
||||
test('dashboard guides customer custom time window service path', async () => {
|
||||
window.history.replaceState(null, '', '/#/dashboard');
|
||||
vi.spyOn(globalThis, 'fetch').mockImplementation(async (input) => {
|
||||
|
||||
Reference in New Issue
Block a user