feat(platform): link vehicle center workflows
This commit is contained in:
@@ -31,6 +31,17 @@ function sourceEvidenceText(row: VehicleCoverageRow) {
|
||||
return `${row.onlineSourceCount}/${row.sourceCount} 来源在线`;
|
||||
}
|
||||
|
||||
function primaryRowProtocol(row: VehicleCoverageRow, fallbackProtocol?: string) {
|
||||
return (fallbackProtocol || row.sourceStatus?.find((source) => source.online)?.protocol || row.protocols?.[0] || '').trim();
|
||||
}
|
||||
|
||||
function rowWorkflowFilters(row: VehicleCoverageRow, fallbackProtocol?: string) {
|
||||
return {
|
||||
keyword: row.vin,
|
||||
...(primaryRowProtocol(row, fallbackProtocol) ? { protocol: primaryRowProtocol(row, fallbackProtocol) } : {})
|
||||
};
|
||||
}
|
||||
|
||||
function vehicleArchiveCompleteness(row: VehicleCoverageRow) {
|
||||
const fields = [row.vin, row.plate, row.phone, row.oem];
|
||||
const completed = fields.filter((item) => Boolean(String(item ?? '').trim())).length;
|
||||
@@ -238,11 +249,15 @@ async function copyVehicleShareURL() {
|
||||
export function Vehicles({
|
||||
onOpenVehicle,
|
||||
onOpenQuality,
|
||||
onOpenRealtime,
|
||||
onOpenHistory,
|
||||
onFiltersChange,
|
||||
initialFilters = {}
|
||||
}: {
|
||||
onOpenVehicle: (vin: string, protocol?: string) => void;
|
||||
onOpenQuality?: (filters: Record<string, string>) => void;
|
||||
onOpenRealtime?: (filters: Record<string, string>) => void;
|
||||
onOpenHistory?: (filters: Record<string, string>) => void;
|
||||
onFiltersChange?: (filters: Record<string, string>) => void;
|
||||
initialFilters?: Record<string, string>;
|
||||
}) {
|
||||
@@ -472,16 +487,18 @@ export function Vehicles({
|
||||
{ title: '绑定', width: 90, render: (_: unknown, row: VehicleCoverageRow) => <Tag color={row.bindingStatus === 'bound' ? 'green' : 'orange'}>{row.bindingStatus === 'bound' ? '已绑定' : '未绑定'}</Tag> },
|
||||
{
|
||||
title: '操作',
|
||||
width: 190,
|
||||
width: 300,
|
||||
render: (_: unknown, row: VehicleCoverageRow) => (
|
||||
<Space>
|
||||
<Button onClick={() => onOpenVehicle(row.vin, filters.protocol)}>车辆服务</Button>
|
||||
<Button disabled={!row.vin || !onOpenQuality} onClick={() => onOpenQuality?.({ keyword: row.vin, ...(filters.protocol ? { protocol: filters.protocol } : {}) })}>质量问题</Button>
|
||||
<Space wrap>
|
||||
<Button disabled={!row.vin || !onOpenRealtime} onClick={() => onOpenRealtime?.(rowWorkflowFilters(row, filters.protocol))}>实时</Button>
|
||||
<Button disabled={!row.vin || !onOpenHistory} onClick={() => onOpenHistory?.(rowWorkflowFilters(row, filters.protocol))}>轨迹</Button>
|
||||
<Button onClick={() => onOpenVehicle(row.vin, primaryRowProtocol(row, filters.protocol))}>服务</Button>
|
||||
<Button disabled={!row.vin || !onOpenQuality} onClick={() => onOpenQuality?.(rowWorkflowFilters(row, filters.protocol))}>告警</Button>
|
||||
</Space>
|
||||
)
|
||||
}
|
||||
],
|
||||
[filters, onOpenQuality, onOpenVehicle]
|
||||
[filters, onOpenHistory, onOpenQuality, onOpenRealtime, onOpenVehicle]
|
||||
);
|
||||
|
||||
return (
|
||||
|
||||
Reference in New Issue
Block a user