feat(platform): prioritize vehicle action queue
This commit is contained in:
@@ -189,23 +189,51 @@ export function Vehicles({
|
|||||||
}
|
}
|
||||||
return items;
|
return items;
|
||||||
}, [pagination.total, summary]);
|
}, [pagination.total, summary]);
|
||||||
const actionQueue = useMemo<Array<{ label: string; count: number; filters: Record<string, string>; color: 'orange' | 'red' }>>(() => {
|
const actionQueue = useMemo<Array<{ label: string; count: number; filters: Record<string, string>; color: 'orange' | 'red'; priority: 'P0' | 'P1'; detail: string }>>(() => {
|
||||||
const items: Array<{ label: string; count: number; filters: Record<string, string>; color: 'orange' | 'red' }> = [];
|
const items: Array<{ label: string; count: number; filters: Record<string, string>; color: 'orange' | 'red'; priority: 'P0' | 'P1'; detail: string }> = [];
|
||||||
const unboundCount = summary?.unboundVehicles ?? 0;
|
const unboundCount = summary?.unboundVehicles ?? 0;
|
||||||
if (unboundCount > 0) {
|
if (unboundCount > 0) {
|
||||||
items.push({ label: '维护身份绑定', count: unboundCount, filters: { bindingStatus: 'unbound' }, color: 'orange' });
|
items.push({
|
||||||
|
label: '维护身份绑定',
|
||||||
|
count: unboundCount,
|
||||||
|
filters: { bindingStatus: 'unbound' },
|
||||||
|
color: 'orange',
|
||||||
|
priority: 'P0',
|
||||||
|
detail: '已有数据但无法归并到 VIN,先补绑定再看跨来源服务。'
|
||||||
|
});
|
||||||
}
|
}
|
||||||
const noDataCount = summary?.noDataVehicles ?? 0;
|
const noDataCount = summary?.noDataVehicles ?? 0;
|
||||||
if (noDataCount > 0) {
|
if (noDataCount > 0) {
|
||||||
items.push({ label: '确认平台转发', count: noDataCount, filters: { serviceStatus: 'no_data' }, color: 'orange' });
|
items.push({
|
||||||
|
label: '确认平台转发',
|
||||||
|
count: noDataCount,
|
||||||
|
filters: { serviceStatus: 'no_data' },
|
||||||
|
color: 'orange',
|
||||||
|
priority: 'P0',
|
||||||
|
detail: '车辆没有任何来源证据,优先确认平台转发、端口和订阅配置。'
|
||||||
|
});
|
||||||
}
|
}
|
||||||
const archiveIncompleteCount = summary?.archiveIncompleteVehicles ?? 0;
|
const archiveIncompleteCount = summary?.archiveIncompleteVehicles ?? 0;
|
||||||
if (archiveIncompleteCount > 0) {
|
if (archiveIncompleteCount > 0) {
|
||||||
items.push({ label: '完善车辆档案', count: archiveIncompleteCount, filters: { archiveStatus: 'incomplete' }, color: 'orange' });
|
items.push({
|
||||||
|
label: '完善车辆档案',
|
||||||
|
count: archiveIncompleteCount,
|
||||||
|
filters: { archiveStatus: 'incomplete' },
|
||||||
|
color: 'orange',
|
||||||
|
priority: 'P1',
|
||||||
|
detail: '车辆缺少车牌、手机号或 OEM 等基础档案,影响后续运营查询和治理。'
|
||||||
|
});
|
||||||
}
|
}
|
||||||
for (const field of summary?.archiveMissingFields ?? []) {
|
for (const field of summary?.archiveMissingFields ?? []) {
|
||||||
if (field.count <= 0) continue;
|
if (field.count <= 0) continue;
|
||||||
items.push({ label: `补齐${field.title}`, count: field.count, filters: { archiveMissing: field.field }, color: 'orange' });
|
items.push({
|
||||||
|
label: `补齐${field.title}`,
|
||||||
|
count: field.count,
|
||||||
|
filters: { archiveMissing: field.field },
|
||||||
|
color: 'orange',
|
||||||
|
priority: 'P1',
|
||||||
|
detail: `${field.title}会影响车辆档案检索、绑定确认和运营侧筛选。`
|
||||||
|
});
|
||||||
}
|
}
|
||||||
for (const source of summary?.missingSources ?? []) {
|
for (const source of summary?.missingSources ?? []) {
|
||||||
if (source.count <= 0) continue;
|
if (source.count <= 0) continue;
|
||||||
@@ -213,7 +241,9 @@ export function Vehicles({
|
|||||||
label: `补齐 ${source.protocol} 来源`,
|
label: `补齐 ${source.protocol} 来源`,
|
||||||
count: source.count,
|
count: source.count,
|
||||||
filters: { missingProtocol: source.protocol },
|
filters: { missingProtocol: source.protocol },
|
||||||
color: 'orange'
|
color: 'orange',
|
||||||
|
priority: 'P1',
|
||||||
|
detail: `${source.protocol} 来源缺失会降低跨来源定位、里程和实时判断可信度。`
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
return items;
|
return items;
|
||||||
@@ -438,13 +468,22 @@ export function Vehicles({
|
|||||||
</Card>
|
</Card>
|
||||||
{actionQueue.length > 0 ? (
|
{actionQueue.length > 0 ? (
|
||||||
<Card bordered title="处置队列" style={{ marginTop: 16 }}>
|
<Card bordered title="处置队列" style={{ marginTop: 16 }}>
|
||||||
<Space wrap>
|
<div className="vp-action-grid">
|
||||||
{actionQueue.map((item) => (
|
{actionQueue.map((item) => (
|
||||||
<Button key={`${item.label}-${item.count}`} size="small" theme="light" type={item.color === 'red' ? 'danger' : 'warning'} onClick={() => applyFilters({ ...filters, ...item.filters })}>
|
<div key={`${item.label}-${item.count}`} className="vp-action-item">
|
||||||
{item.label} {item.count.toLocaleString()}
|
<div>
|
||||||
</Button>
|
<Space spacing={6} wrap>
|
||||||
|
<Tag color={item.priority === 'P0' ? 'red' : 'orange'}>{item.priority}</Tag>
|
||||||
|
<Tag color={item.color}>{item.label} {item.count.toLocaleString()}</Tag>
|
||||||
|
</Space>
|
||||||
|
<div style={{ marginTop: 8 }}>{item.detail}</div>
|
||||||
|
</div>
|
||||||
|
<Button size="small" theme="light" type={item.color === 'red' ? 'danger' : 'warning'} onClick={() => applyFilters({ ...filters, ...item.filters })}>
|
||||||
|
{item.label} {item.count.toLocaleString()}
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
))}
|
))}
|
||||||
</Space>
|
</div>
|
||||||
</Card>
|
</Card>
|
||||||
) : null}
|
) : null}
|
||||||
<Card bordered style={{ marginTop: 16 }}>
|
<Card bordered style={{ marginTop: 16 }}>
|
||||||
|
|||||||
@@ -685,6 +685,12 @@ test('shows vehicle service result summary on vehicle list filters', async () =>
|
|||||||
expect(screen.getByText('档案不完整')).toBeInTheDocument();
|
expect(screen.getByText('档案不完整')).toBeInTheDocument();
|
||||||
expect(screen.getAllByText('缺手机号').length).toBeGreaterThanOrEqual(2);
|
expect(screen.getAllByText('缺手机号').length).toBeGreaterThanOrEqual(2);
|
||||||
expect(screen.getByText('处置队列')).toBeInTheDocument();
|
expect(screen.getByText('处置队列')).toBeInTheDocument();
|
||||||
|
expect(screen.getAllByText('P0').length).toBeGreaterThanOrEqual(2);
|
||||||
|
expect(screen.getAllByText('P1').length).toBeGreaterThanOrEqual(2);
|
||||||
|
expect(screen.getByText('已有数据但无法归并到 VIN,先补绑定再看跨来源服务。')).toBeInTheDocument();
|
||||||
|
expect(screen.getByText('车辆没有任何来源证据,优先确认平台转发、端口和订阅配置。')).toBeInTheDocument();
|
||||||
|
expect(screen.getByText('缺手机号会影响车辆档案检索、绑定确认和运营侧筛选。')).toBeInTheDocument();
|
||||||
|
expect(screen.getByText('YUTONG_MQTT 来源缺失会降低跨来源定位、里程和实时判断可信度。')).toBeInTheDocument();
|
||||||
expect(screen.getByRole('button', { name: '维护身份绑定 9' })).toBeInTheDocument();
|
expect(screen.getByRole('button', { name: '维护身份绑定 9' })).toBeInTheDocument();
|
||||||
expect(screen.getByRole('button', { name: '确认平台转发 4' })).toBeInTheDocument();
|
expect(screen.getByRole('button', { name: '确认平台转发 4' })).toBeInTheDocument();
|
||||||
expect(screen.getByRole('button', { name: '补齐缺手机号 7' })).toBeInTheDocument();
|
expect(screen.getByRole('button', { name: '补齐缺手机号 7' })).toBeInTheDocument();
|
||||||
|
|||||||
Reference in New Issue
Block a user