feat(platform): link quality issues to vehicle lookup
This commit is contained in:
@@ -15,6 +15,14 @@ function formatLag(value?: number | null) {
|
||||
return value == null ? '未接入' : value.toLocaleString();
|
||||
}
|
||||
|
||||
function qualityVehicleLookupKey(row: QualityIssueRow) {
|
||||
const vin = row.vin?.trim();
|
||||
if (vin && vin !== 'unknown') {
|
||||
return vin;
|
||||
}
|
||||
return row.plate?.trim() || row.phone?.trim() || '';
|
||||
}
|
||||
|
||||
export function Dashboard({ onOpenVehicle, onOpenQuality }: { onOpenVehicle: (vin: string) => void; onOpenQuality: () => void }) {
|
||||
const [summary, setSummary] = useState<DashboardSummary | null>(null);
|
||||
const [coverage, setCoverage] = useState<VehicleCoverageRow[]>([]);
|
||||
@@ -127,7 +135,14 @@ export function Dashboard({ onOpenVehicle, onOpenQuality }: { onOpenVehicle: (vi
|
||||
{ title: '来源', dataIndex: 'protocol', width: 110 },
|
||||
{ title: '问题', dataIndex: 'issueType', width: 140 },
|
||||
{ title: '级别', width: 90, render: (_: unknown, row: QualityIssueRow) => <Tag color={row.severity === 'error' ? 'red' : 'orange'}>{row.severity}</Tag> },
|
||||
{ title: '最后时间', dataIndex: 'lastSeen', width: 170 }
|
||||
{ title: '最后时间', dataIndex: 'lastSeen', width: 170 },
|
||||
{
|
||||
title: '操作',
|
||||
width: 110,
|
||||
render: (_: unknown, row: QualityIssueRow) => (
|
||||
<Button disabled={!qualityVehicleLookupKey(row)} onClick={() => onOpenVehicle(qualityVehicleLookupKey(row))}>车辆服务</Button>
|
||||
)
|
||||
}
|
||||
]}
|
||||
/>
|
||||
</Card>
|
||||
|
||||
@@ -49,9 +49,12 @@ async function copyText(value: string, label: string) {
|
||||
}
|
||||
}
|
||||
|
||||
function canOpenVehicle(vin?: string) {
|
||||
const value = vin?.trim();
|
||||
return Boolean(value && value !== 'unknown');
|
||||
function vehicleLookupKey(row: QualityIssueRow) {
|
||||
const vin = row.vin?.trim();
|
||||
if (vin && vin !== 'unknown') {
|
||||
return vin;
|
||||
}
|
||||
return row.plate?.trim() || row.phone?.trim() || '';
|
||||
}
|
||||
|
||||
export function Quality({
|
||||
@@ -186,7 +189,13 @@ export function Quality({
|
||||
<Space spacing={4}>
|
||||
<Button size="small" icon={<IconCopy />} onClick={() => copyText(row.phone, '手机号')}>手机号</Button>
|
||||
<Button size="small" icon={<IconCopy />} onClick={() => copyText(row.sourceEndpoint, '来源')}>来源</Button>
|
||||
<Button size="small" disabled={!canOpenVehicle(row.vin)} onClick={() => onOpenVehicle(row.vin)}>车辆服务</Button>
|
||||
<Button
|
||||
size="small"
|
||||
disabled={!vehicleLookupKey(row)}
|
||||
onClick={() => onOpenVehicle(vehicleLookupKey(row))}
|
||||
>
|
||||
车辆服务
|
||||
</Button>
|
||||
</Space>
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user