feat(platform): add source readiness handoff copy

This commit is contained in:
lingniu
2026-07-04 23:43:07 +08:00
parent 1780039722
commit 6888f1a598
2 changed files with 39 additions and 141 deletions

View File

@@ -765,6 +765,36 @@ export function Dashboard({
].filter(Boolean);
copyText(lines.join('\n'), '运营交接摘要');
};
const copySourceReadinessHandoff = () => {
const plan = sourceReadiness;
if (!plan?.sources?.length) {
Toast.warning('暂无数据源就绪度数据');
return;
}
const lines = [
'【三源接入到车辆服务交接摘要】',
`车辆规模:${formatCount(plan.onlineVehicles)} / ${formatCount(plan.totalVehicles)} 在线`,
`接入运行:连接 ${formatCount(plan.activeConnections)}Redis 在线 Key ${formatCount(plan.redisOnlineKeys)}Kafka Lag ${formatLag(plan.kafkaLag)}`,
`平台版本:${plan.platformRelease || '-'}`,
'',
...plan.sources.map((item, index) => [
`${index + 1}. ${item.protocol} - ${item.status}`,
` 角色:${item.role}`,
` 在线:${formatCount(item.online)} / ${formatCount(item.total)},在线率 ${item.onlineRate.toLocaleString(undefined, { maximumFractionDigits: 1 })}%`,
` 缺失车辆:${formatCount(item.missingVehicles)}`,
` 证据:${item.evidence}`,
` 动作:${item.action}`,
` 验收:${item.acceptance}`,
` 实时:${appURL(item.realtimeHash)}`,
` 车辆:${appURL(item.vehiclesHash)}`,
` RAW${appURL(item.historyHash)}`,
` 告警:${appURL(item.alertHash)}`
].join('\n')),
'',
`驾驶舱:${appURL(buildAppHash({ page: 'dashboard' }))}`
];
copyText(lines.join('\n'), '三源接入交接摘要');
};
const copyScenarioBlueprint = () => {
const lines = [
'【车辆数据中台功能蓝图】',
@@ -965,7 +995,11 @@ export function Dashboard({
<Button size="small" theme="light" type="primary" onClick={exportDashboardSnapshot}> CSV</Button>
</Space>
</Card>
<Card bordered title="数据源到车辆服务就绪度" style={{ marginBottom: 16 }}>
<Card
bordered
title={<Space wrap><span></span><Button size="small" theme="light" disabled={!sourceReadiness?.sources?.length} onClick={copySourceReadinessHandoff}></Button></Space>}
style={{ marginBottom: 16 }}
>
<div className="vp-source-readiness-grid">
{(sourceReadiness?.sources ?? []).map((item) => (
<div key={item.protocol} className="vp-source-readiness-item">