feat(platform): separate customer service flow
This commit is contained in:
@@ -2079,6 +2079,66 @@ export function Dashboard({
|
||||
onClick: openTimeMonitorAlerts
|
||||
}
|
||||
];
|
||||
const customerPrimaryFlowItems = [
|
||||
{
|
||||
label: '实时地图',
|
||||
value: `${formatCount(serviceSummary?.onlineVehicles ?? summary?.onlineVehicles)} 在线`,
|
||||
detail: '先确认车辆在哪里、是否在线、是否有有效坐标。',
|
||||
action: '打开地图',
|
||||
color: 'green' as const,
|
||||
onClick: () => onOpenMap({ online: 'online' })
|
||||
},
|
||||
{
|
||||
label: '时间窗复盘',
|
||||
value: dayRangeText(timeMonitorScopeValue.dateFrom, timeMonitorScopeValue.dateTo),
|
||||
detail: '用同一时间范围串起轨迹、位置、里程、历史明细和导出。',
|
||||
action: '查询导出',
|
||||
color: 'blue' as const,
|
||||
onClick: openTimeMonitorHistory
|
||||
},
|
||||
{
|
||||
label: '里程统计',
|
||||
value: `${formatCount(serviceSummary?.totalVehicles)} 车辆`,
|
||||
detail: '以车辆为对象核对区间里程、每日统计和 BI 口径。',
|
||||
action: '统计查询',
|
||||
color: 'blue' as const,
|
||||
onClick: openTimeMonitorMileage
|
||||
},
|
||||
{
|
||||
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
|
||||
}
|
||||
];
|
||||
const operationsEvidenceItems = [
|
||||
{
|
||||
label: '链路健康',
|
||||
value: unhealthyLinkCount > 0 ? `${formatCount(unhealthyLinkCount)} 异常` : '正常',
|
||||
detail: '解释车辆实时、轨迹、统计或导出不可用时的链路证据。',
|
||||
action: '查看告警',
|
||||
color: unhealthyLinkCount > 0 ? 'orange' as const : 'green' as const,
|
||||
onClick: () => onOpenQuality(highPriorityIssue?.issueType ? { issueType: highPriorityIssue.issueType } : {})
|
||||
},
|
||||
{
|
||||
label: '消息积压',
|
||||
value: formatLag(summary?.kafkaLag),
|
||||
detail: '判断接收、解析和历史落地是否存在排队。',
|
||||
action: '查看运维',
|
||||
color: (summary?.kafkaLag ?? 0) > 0 ? 'orange' as const : 'green' as const,
|
||||
onClick: () => onOpenQuality()
|
||||
},
|
||||
{
|
||||
label: '缓存在线',
|
||||
value: formatCount(opsHealth?.redisOnlineKeys),
|
||||
detail: '辅助解释在线车辆数和实时状态是否可信。',
|
||||
action: '缓存证据',
|
||||
color: (opsHealth?.redisOnlineKeys ?? 0) > 0 ? 'blue' as const : 'orange' as const,
|
||||
onClick: () => onOpenRealtime({ online: 'online' })
|
||||
}
|
||||
];
|
||||
|
||||
return (
|
||||
<div className="vp-page">
|
||||
@@ -2216,6 +2276,60 @@ export function Dashboard({
|
||||
))}
|
||||
</div>
|
||||
</section>
|
||||
<section className="vp-customer-service-separation" aria-label="客户主流程与运维证据层">
|
||||
<div className="vp-customer-primary-flow">
|
||||
<div className="vp-customer-primary-flow-copy">
|
||||
<Space wrap>
|
||||
<Tag color="blue">客户主流程</Tag>
|
||||
<Tag color="green">一个车辆服务</Tag>
|
||||
</Space>
|
||||
<Typography.Title heading={5} style={{ margin: 0 }}>默认展示车辆地图、时间窗、里程、导出和告警;三类数据源只作为二级证据。</Typography.Title>
|
||||
</div>
|
||||
<div className="vp-customer-primary-flow-grid">
|
||||
{customerPrimaryFlowItems.map((item) => (
|
||||
<button
|
||||
key={item.label}
|
||||
type="button"
|
||||
className="vp-customer-primary-flow-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>
|
||||
</div>
|
||||
<div className="vp-operations-evidence-layer">
|
||||
<div className="vp-operations-evidence-layer-copy">
|
||||
<Space wrap>
|
||||
<Tag color="grey">运维证据层</Tag>
|
||||
<Tag color={unhealthyLinkCount > 0 ? 'orange' : 'green'}>{unhealthyLinkCount > 0 ? `${formatCount(unhealthyLinkCount)} 异常` : '链路正常'}</Tag>
|
||||
</Space>
|
||||
<Typography.Text type="secondary">
|
||||
用于解释车辆服务不可用的链路、队列、缓存、存储和来源证据,不作为客户默认入口。
|
||||
</Typography.Text>
|
||||
</div>
|
||||
<div className="vp-operations-evidence-layer-grid">
|
||||
{operationsEvidenceItems.map((item) => (
|
||||
<button
|
||||
key={item.label}
|
||||
type="button"
|
||||
className="vp-operations-evidence-layer-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>
|
||||
</div>
|
||||
</section>
|
||||
<section className="vp-customer-map-situation" aria-label="车辆地图态势">
|
||||
<div className="vp-customer-map-situation-map">
|
||||
<VehicleMap
|
||||
|
||||
@@ -1532,6 +1532,133 @@ body {
|
||||
line-height: 18px;
|
||||
}
|
||||
|
||||
.vp-customer-service-separation {
|
||||
margin-bottom: 16px;
|
||||
display: grid;
|
||||
grid-template-columns: minmax(0, 1.45fr) minmax(300px, 0.55fr);
|
||||
gap: 14px;
|
||||
align-items: stretch;
|
||||
}
|
||||
|
||||
.vp-customer-primary-flow,
|
||||
.vp-operations-evidence-layer {
|
||||
min-width: 0;
|
||||
padding: 14px;
|
||||
border-radius: 8px;
|
||||
display: grid;
|
||||
gap: 12px;
|
||||
align-content: start;
|
||||
}
|
||||
|
||||
.vp-customer-primary-flow {
|
||||
border: 1px solid rgba(22, 100, 255, 0.18);
|
||||
background: #ffffff;
|
||||
}
|
||||
|
||||
.vp-operations-evidence-layer {
|
||||
border: 1px solid rgba(71, 85, 105, 0.16);
|
||||
background: #f8fafc;
|
||||
}
|
||||
|
||||
.vp-customer-primary-flow-copy,
|
||||
.vp-operations-evidence-layer-copy {
|
||||
min-width: 0;
|
||||
display: grid;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.vp-customer-primary-flow-copy .semi-typography {
|
||||
color: var(--vp-text);
|
||||
line-height: 24px;
|
||||
}
|
||||
|
||||
.vp-operations-evidence-layer-copy .semi-typography {
|
||||
color: var(--vp-text-muted);
|
||||
line-height: 22px;
|
||||
}
|
||||
|
||||
.vp-customer-primary-flow-grid,
|
||||
.vp-operations-evidence-layer-grid {
|
||||
min-width: 0;
|
||||
display: grid;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.vp-customer-primary-flow-grid {
|
||||
grid-template-columns: repeat(4, minmax(0, 1fr));
|
||||
}
|
||||
|
||||
.vp-operations-evidence-layer-grid {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
|
||||
.vp-customer-primary-flow-item,
|
||||
.vp-operations-evidence-layer-item {
|
||||
min-width: 0;
|
||||
border: 1px solid var(--vp-border);
|
||||
border-radius: 8px;
|
||||
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-primary-flow-item {
|
||||
min-height: 154px;
|
||||
padding: 13px;
|
||||
background: #ffffff;
|
||||
}
|
||||
|
||||
.vp-operations-evidence-layer-item {
|
||||
min-height: 112px;
|
||||
padding: 12px;
|
||||
background: rgba(255, 255, 255, 0.72);
|
||||
}
|
||||
|
||||
.vp-customer-primary-flow-item:hover,
|
||||
.vp-customer-primary-flow-item:focus-visible,
|
||||
.vp-operations-evidence-layer-item:hover,
|
||||
.vp-operations-evidence-layer-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-primary-flow-item strong,
|
||||
.vp-operations-evidence-layer-item strong {
|
||||
color: var(--vp-text);
|
||||
font-size: 19px;
|
||||
line-height: 25px;
|
||||
word-break: break-word;
|
||||
}
|
||||
|
||||
.vp-operations-evidence-layer-item strong {
|
||||
font-size: 17px;
|
||||
line-height: 23px;
|
||||
}
|
||||
|
||||
.vp-customer-primary-flow-item span,
|
||||
.vp-operations-evidence-layer-item span {
|
||||
color: var(--vp-text-muted);
|
||||
font-size: 12px;
|
||||
line-height: 18px;
|
||||
word-break: break-word;
|
||||
}
|
||||
|
||||
.vp-customer-primary-flow-item em,
|
||||
.vp-operations-evidence-layer-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;
|
||||
@@ -10819,6 +10946,8 @@ button.vp-realtime-command-item:focus-visible {
|
||||
.vp-dispatch-operations-highlights,
|
||||
.vp-customer-delivery-workbench,
|
||||
.vp-customer-delivery-workbench-grid,
|
||||
.vp-customer-service-separation,
|
||||
.vp-customer-primary-flow-grid,
|
||||
.vp-source-readiness-grid,
|
||||
.vp-source-readiness-metrics,
|
||||
.vp-map-ops-board,
|
||||
|
||||
@@ -921,6 +921,100 @@ test('dashboard frames history query and export as a customer delivery workbench
|
||||
expect(screen.getByRole('button', { name: '客户查询导出交付台 告警说明 7 告警 告警通知' })).toBeInTheDocument();
|
||||
});
|
||||
|
||||
test('dashboard separates customer vehicle service from operations evidence', 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: 281,
|
||||
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: 73,
|
||||
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.getByRole('button', { name: '客户主流程 实时地图 208 在线 打开地图' })).toBeInTheDocument();
|
||||
expect(screen.getByRole('button', { name: '客户主流程 时间窗复盘 1 天窗口 查询导出' })).toBeInTheDocument();
|
||||
expect(screen.getByRole('button', { name: '客户主流程 里程统计 1,033 车辆 统计查询' })).toBeInTheDocument();
|
||||
expect(screen.getByRole('button', { name: '客户主流程 告警通知 7 告警 通知处理' })).toBeInTheDocument();
|
||||
expect(screen.getByText('运维证据层')).toBeInTheDocument();
|
||||
expect(screen.getByText('用于解释车辆服务不可用的链路、队列、缓存、存储和来源证据,不作为客户默认入口。')).toBeInTheDocument();
|
||||
expect(screen.getByRole('button', { name: '运维证据层 链路健康 正常 查看告警' })).toBeInTheDocument();
|
||||
expect(screen.getByRole('button', { name: '运维证据层 消息积压 0 查看运维' })).toBeInTheDocument();
|
||||
expect(screen.getByRole('button', { name: '运维证据层 缓存在线 281 缓存证据' })).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