feat(platform): surface dashboard action queue
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { Button, Card, Col, Form, Row, Select, Space, Spin, Table, Tag, Toast, Typography } from '@douyinfe/semi-ui';
|
||||
import { IconSearch } from '@douyinfe/semi-icons';
|
||||
import { useEffect, useState } from 'react';
|
||||
import { useEffect, useMemo, useState } from 'react';
|
||||
import { api } from '../api/client';
|
||||
import type { DashboardSummary, LinkHealth, ProtocolStat, QualityIssueRow, ServiceStatusStat, VehicleCoverageRow, VehicleRealtimeRow, VehicleServiceSummary } from '../api/types';
|
||||
import { PageHeader } from '../components/PageHeader';
|
||||
@@ -163,6 +163,35 @@ export function Dashboard({ onOpenVehicle, onOpenQuality, onOpenVehicles }: { on
|
||||
{ label: '身份未绑定', value: formatCount(serviceSummary?.identityRequiredVehicles), filters: { serviceStatus: 'identity_required' } }
|
||||
];
|
||||
const missingSourceCounts = new Map((serviceSummary?.missingSources ?? []).map((item) => [item.protocol, item.count]));
|
||||
const serviceActionQueue = useMemo<Array<{ label: string; count: number; filters: Record<string, string>; detail: string }>>(() => {
|
||||
const items: Array<{ label: string; count: number; filters: Record<string, string>; detail: string }> = [];
|
||||
if ((serviceSummary?.noDataVehicles ?? 0) > 0) {
|
||||
items.push({
|
||||
label: '确认平台转发',
|
||||
count: serviceSummary?.noDataVehicles ?? 0,
|
||||
filters: { serviceStatus: 'no_data' },
|
||||
detail: '车辆没有形成任何来源证据,优先确认上游平台是否持续转发。'
|
||||
});
|
||||
}
|
||||
if ((serviceSummary?.identityRequiredVehicles ?? 0) > 0) {
|
||||
items.push({
|
||||
label: '维护身份绑定',
|
||||
count: serviceSummary?.identityRequiredVehicles ?? 0,
|
||||
filters: { serviceStatus: 'identity_required' },
|
||||
detail: '已有数据但无法稳定归并到 VIN,会影响车辆服务聚合。'
|
||||
});
|
||||
}
|
||||
for (const source of serviceSummary?.missingSources ?? []) {
|
||||
if (source.count <= 0) continue;
|
||||
items.push({
|
||||
label: `补齐 ${source.protocol} 来源`,
|
||||
count: source.count,
|
||||
filters: { serviceStatus: 'degraded', missingProtocol: source.protocol },
|
||||
detail: `${source.protocol} 来源缺失会降低跨来源定位、里程和实时判断可信度。`
|
||||
});
|
||||
}
|
||||
return items;
|
||||
}, [serviceSummary]);
|
||||
|
||||
return (
|
||||
<div className="vp-page">
|
||||
@@ -191,6 +220,23 @@ export function Dashboard({ onOpenVehicle, onOpenQuality, onOpenVehicles }: { on
|
||||
<Tag color={(summary?.kafkaLag ?? 0) > 0 ? 'orange' : 'green'}>Kafka Lag {formatLag(summary?.kafkaLag)}</Tag>
|
||||
</Space>
|
||||
</Card>
|
||||
{serviceActionQueue.length > 0 ? (
|
||||
<Card bordered title="车辆服务处置队列" style={{ marginBottom: 16 }}>
|
||||
<div className="vp-action-grid">
|
||||
{serviceActionQueue.map((item) => (
|
||||
<div key={`${item.label}-${item.count}`} className="vp-action-item">
|
||||
<div>
|
||||
<Tag color="orange">{item.label} {item.count.toLocaleString()}</Tag>
|
||||
<Typography.Text type="secondary" style={{ display: 'block', marginTop: 8 }}>{item.detail}</Typography.Text>
|
||||
</div>
|
||||
<Button size="small" theme="light" type="warning" onClick={() => onOpenVehicles(item.filters)}>
|
||||
{item.label} {item.count.toLocaleString()}
|
||||
</Button>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</Card>
|
||||
) : null}
|
||||
<Row gutter={16}>
|
||||
<Col span={8}>
|
||||
<Card title="车辆服务状态" bordered>
|
||||
|
||||
Reference in New Issue
Block a user