feat(platform): surface incomplete vehicle archives
This commit is contained in:
@@ -463,6 +463,9 @@ func TestHandlerVehicleServiceSummaryEndpoint(t *testing.T) {
|
|||||||
if body.Data.MultiSourceVehicles < 1 || body.Data.SingleSourceVehicles < 1 {
|
if body.Data.MultiSourceVehicles < 1 || body.Data.SingleSourceVehicles < 1 {
|
||||||
t.Fatalf("summary should expose source coverage distribution, got %+v", body.Data)
|
t.Fatalf("summary should expose source coverage distribution, got %+v", body.Data)
|
||||||
}
|
}
|
||||||
|
if body.Data.ArchiveIncompleteVehicles < 1 {
|
||||||
|
t.Fatalf("summary should expose incomplete archive vehicles, got %+v", body.Data)
|
||||||
|
}
|
||||||
if len(body.Data.ServiceStatuses) == 0 || len(body.Data.Protocols) == 0 {
|
if len(body.Data.ServiceStatuses) == 0 || len(body.Data.Protocols) == 0 {
|
||||||
t.Fatalf("summary should expose service status and protocol distributions, got %+v", body.Data)
|
t.Fatalf("summary should expose service status and protocol distributions, got %+v", body.Data)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -175,6 +175,9 @@ func (m *MockStore) VehicleCoverageSummary(ctx context.Context, query url.Values
|
|||||||
if row.BindingStatus != "bound" {
|
if row.BindingStatus != "bound" {
|
||||||
summary.UnboundVehicles++
|
summary.UnboundVehicles++
|
||||||
}
|
}
|
||||||
|
if vehicleArchiveIncomplete(row) {
|
||||||
|
summary.ArchiveIncompleteVehicles++
|
||||||
|
}
|
||||||
}
|
}
|
||||||
for _, protocol := range canonicalVehicleProtocols {
|
for _, protocol := range canonicalVehicleProtocols {
|
||||||
missing := 0
|
missing := 0
|
||||||
@@ -211,6 +214,9 @@ func (m *MockStore) VehicleServiceSummary(ctx context.Context) (VehicleServiceSu
|
|||||||
if row.BindingStatus == "bound" {
|
if row.BindingStatus == "bound" {
|
||||||
summary.BoundVehicles++
|
summary.BoundVehicles++
|
||||||
}
|
}
|
||||||
|
if vehicleArchiveIncomplete(row) {
|
||||||
|
summary.ArchiveIncompleteVehicles++
|
||||||
|
}
|
||||||
if row.Online {
|
if row.Online {
|
||||||
summary.OnlineVehicles++
|
summary.OnlineVehicles++
|
||||||
}
|
}
|
||||||
@@ -275,6 +281,13 @@ func (m *MockStore) VehicleServiceSummary(ctx context.Context) (VehicleServiceSu
|
|||||||
return summary, nil
|
return summary, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func vehicleArchiveIncomplete(row VehicleCoverageRow) bool {
|
||||||
|
return strings.TrimSpace(row.VIN) == "" ||
|
||||||
|
strings.TrimSpace(row.Plate) == "" ||
|
||||||
|
strings.TrimSpace(row.Phone) == "" ||
|
||||||
|
strings.TrimSpace(row.OEM) == ""
|
||||||
|
}
|
||||||
|
|
||||||
func (m *MockStore) VehicleRealtime(_ context.Context, query url.Values) (Page[VehicleRealtimeRow], error) {
|
func (m *MockStore) VehicleRealtime(_ context.Context, query url.Values) (Page[VehicleRealtimeRow], error) {
|
||||||
rows := m.locations
|
rows := m.locations
|
||||||
if vin := strings.TrimSpace(query.Get("vin")); vin != "" {
|
if vin := strings.TrimSpace(query.Get("vin")); vin != "" {
|
||||||
|
|||||||
@@ -73,6 +73,7 @@ type VehicleCoverageSummary struct {
|
|||||||
MultiSourceVehicles int `json:"multiSourceVehicles"`
|
MultiSourceVehicles int `json:"multiSourceVehicles"`
|
||||||
NoDataVehicles int `json:"noDataVehicles"`
|
NoDataVehicles int `json:"noDataVehicles"`
|
||||||
UnboundVehicles int `json:"unboundVehicles"`
|
UnboundVehicles int `json:"unboundVehicles"`
|
||||||
|
ArchiveIncompleteVehicles int `json:"archiveIncompleteVehicles"`
|
||||||
MissingSources []MissingSourceStat `json:"missingSources"`
|
MissingSources []MissingSourceStat `json:"missingSources"`
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -150,6 +151,7 @@ type VehicleServiceSummary struct {
|
|||||||
MultiSourceVehicles int `json:"multiSourceVehicles"`
|
MultiSourceVehicles int `json:"multiSourceVehicles"`
|
||||||
NoDataVehicles int `json:"noDataVehicles"`
|
NoDataVehicles int `json:"noDataVehicles"`
|
||||||
IdentityRequiredVehicles int `json:"identityRequiredVehicles"`
|
IdentityRequiredVehicles int `json:"identityRequiredVehicles"`
|
||||||
|
ArchiveIncompleteVehicles int `json:"archiveIncompleteVehicles"`
|
||||||
ServiceStatuses []ServiceStatusStat `json:"serviceStatuses"`
|
ServiceStatuses []ServiceStatusStat `json:"serviceStatuses"`
|
||||||
Protocols []ProtocolStat `json:"protocols"`
|
Protocols []ProtocolStat `json:"protocols"`
|
||||||
MissingSources []MissingSourceStat `json:"missingSources"`
|
MissingSources []MissingSourceStat `json:"missingSources"`
|
||||||
|
|||||||
@@ -238,7 +238,12 @@ func buildVehicleCoverageSummarySQL(query url.Values) SQLQuery {
|
|||||||
groupSQL := `SELECT v.vin, ` +
|
groupSQL := `SELECT v.vin, ` +
|
||||||
`COUNT(DISTINCT s.protocol) AS source_count, ` +
|
`COUNT(DISTINCT s.protocol) AS source_count, ` +
|
||||||
`COUNT(DISTINCT CASE WHEN s.updated_at >= DATE_SUB(NOW(), INTERVAL 1 MINUTE) THEN s.protocol END) AS online_source_count, ` +
|
`COUNT(DISTINCT CASE WHEN s.updated_at >= DATE_SUB(NOW(), INTERVAL 1 MINUTE) THEN s.protocol END) AS online_source_count, ` +
|
||||||
`MAX(CASE WHEN b.vin IS NOT NULL AND b.vin <> '' THEN 1 ELSE 0 END) AS bound ` +
|
`MAX(CASE WHEN b.vin IS NOT NULL AND b.vin <> '' THEN 1 ELSE 0 END) AS bound, ` +
|
||||||
|
`CASE WHEN v.vin IS NOT NULL AND v.vin <> '' ` +
|
||||||
|
`AND COALESCE(NULLIF(MAX(NULLIF(s.plate, '')), ''), NULLIF(MAX(NULLIF(b.plate, '')), '')) IS NOT NULL ` +
|
||||||
|
`AND NULLIF(MAX(NULLIF(b.phone, '')), '') IS NOT NULL ` +
|
||||||
|
`AND NULLIF(MAX(NULLIF(b.oem, '')), '') IS NOT NULL ` +
|
||||||
|
`THEN 1 ELSE 0 END AS archive_complete ` +
|
||||||
`FROM (` + vehicleSetSQL + `) v ` +
|
`FROM (` + vehicleSetSQL + `) v ` +
|
||||||
`LEFT JOIN vehicle_identity_binding b ON b.vin = v.vin ` +
|
`LEFT JOIN vehicle_identity_binding b ON b.vin = v.vin ` +
|
||||||
`LEFT JOIN vehicle_realtime_snapshot s ON s.vin = v.vin ` +
|
`LEFT JOIN vehicle_realtime_snapshot s ON s.vin = v.vin ` +
|
||||||
@@ -250,7 +255,8 @@ func buildVehicleCoverageSummarySQL(query url.Values) SQLQuery {
|
|||||||
`COALESCE(SUM(CASE WHEN source_count = 1 THEN 1 ELSE 0 END), 0) AS single_source_vehicles, ` +
|
`COALESCE(SUM(CASE WHEN source_count = 1 THEN 1 ELSE 0 END), 0) AS single_source_vehicles, ` +
|
||||||
`COALESCE(SUM(CASE WHEN source_count > 1 THEN 1 ELSE 0 END), 0) AS multi_source_vehicles, ` +
|
`COALESCE(SUM(CASE WHEN source_count > 1 THEN 1 ELSE 0 END), 0) AS multi_source_vehicles, ` +
|
||||||
`COALESCE(SUM(CASE WHEN source_count = 0 THEN 1 ELSE 0 END), 0) AS no_data_vehicles, ` +
|
`COALESCE(SUM(CASE WHEN source_count = 0 THEN 1 ELSE 0 END), 0) AS no_data_vehicles, ` +
|
||||||
`COALESCE(SUM(CASE WHEN bound = 0 THEN 1 ELSE 0 END), 0) AS unbound_vehicles ` +
|
`COALESCE(SUM(CASE WHEN bound = 0 THEN 1 ELSE 0 END), 0) AS unbound_vehicles, ` +
|
||||||
|
`COALESCE(SUM(CASE WHEN archive_complete = 0 THEN 1 ELSE 0 END), 0) AS archive_incomplete_vehicles ` +
|
||||||
`FROM (` + groupSQL + `) vehicle_coverage_summary`,
|
`FROM (` + groupSQL + `) vehicle_coverage_summary`,
|
||||||
Args: args,
|
Args: args,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -125,6 +125,7 @@ COALESCE(SUM(CASE WHEN source_count = 1 THEN 1 ELSE 0 END), 0) AS single_source_
|
|||||||
COALESCE(SUM(CASE WHEN source_count > 1 THEN 1 ELSE 0 END), 0) AS multi_source_vehicles,
|
COALESCE(SUM(CASE WHEN source_count > 1 THEN 1 ELSE 0 END), 0) AS multi_source_vehicles,
|
||||||
COALESCE(SUM(CASE WHEN source_count = 0 THEN 1 ELSE 0 END), 0) AS no_data_vehicles,
|
COALESCE(SUM(CASE WHEN source_count = 0 THEN 1 ELSE 0 END), 0) AS no_data_vehicles,
|
||||||
COALESCE(SUM(CASE WHEN bound = 0 THEN 1 ELSE 0 END), 0) AS identity_required_vehicles,
|
COALESCE(SUM(CASE WHEN bound = 0 THEN 1 ELSE 0 END), 0) AS identity_required_vehicles,
|
||||||
|
COALESCE(SUM(CASE WHEN archive_complete = 0 THEN 1 ELSE 0 END), 0) AS archive_incomplete_vehicles,
|
||||||
COALESCE(SUM(CASE WHEN bound = 1 AND source_count = `+canonicalSourceCount+` AND online_source_count = source_count THEN 1 ELSE 0 END), 0) AS healthy_vehicles,
|
COALESCE(SUM(CASE WHEN bound = 1 AND source_count = `+canonicalSourceCount+` AND online_source_count = source_count THEN 1 ELSE 0 END), 0) AS healthy_vehicles,
|
||||||
COALESCE(SUM(CASE WHEN bound = 1 AND source_count > 0 AND online_source_count > 0 AND (online_source_count < source_count OR source_count < `+canonicalSourceCount+`) THEN 1 ELSE 0 END), 0) AS degraded_vehicles,
|
COALESCE(SUM(CASE WHEN bound = 1 AND source_count > 0 AND online_source_count > 0 AND (online_source_count < source_count OR source_count < `+canonicalSourceCount+`) THEN 1 ELSE 0 END), 0) AS degraded_vehicles,
|
||||||
COALESCE(SUM(CASE WHEN bound = 1 AND source_count > 0 AND online_source_count = 0 THEN 1 ELSE 0 END), 0) AS offline_vehicles
|
COALESCE(SUM(CASE WHEN bound = 1 AND source_count > 0 AND online_source_count = 0 THEN 1 ELSE 0 END), 0) AS offline_vehicles
|
||||||
@@ -132,7 +133,12 @@ FROM (
|
|||||||
SELECT v.vin,
|
SELECT v.vin,
|
||||||
MAX(CASE WHEN b.vin IS NOT NULL AND b.vin <> '' THEN 1 ELSE 0 END) AS bound,
|
MAX(CASE WHEN b.vin IS NOT NULL AND b.vin <> '' THEN 1 ELSE 0 END) AS bound,
|
||||||
COUNT(DISTINCT s.protocol) AS source_count,
|
COUNT(DISTINCT s.protocol) AS source_count,
|
||||||
COUNT(DISTINCT CASE WHEN s.updated_at >= DATE_SUB(NOW(), INTERVAL 1 MINUTE) THEN s.protocol END) AS online_source_count
|
COUNT(DISTINCT CASE WHEN s.updated_at >= DATE_SUB(NOW(), INTERVAL 1 MINUTE) THEN s.protocol END) AS online_source_count,
|
||||||
|
CASE WHEN v.vin IS NOT NULL AND v.vin <> ''
|
||||||
|
AND COALESCE(NULLIF(MAX(NULLIF(s.plate, '')), ''), NULLIF(MAX(NULLIF(b.plate, '')), '')) IS NOT NULL
|
||||||
|
AND NULLIF(MAX(NULLIF(b.phone, '')), '') IS NOT NULL
|
||||||
|
AND NULLIF(MAX(NULLIF(b.oem, '')), '') IS NOT NULL
|
||||||
|
THEN 1 ELSE 0 END AS archive_complete
|
||||||
FROM (
|
FROM (
|
||||||
SELECT vin FROM vehicle_identity_binding WHERE vin IS NOT NULL AND vin <> ''
|
SELECT vin FROM vehicle_identity_binding WHERE vin IS NOT NULL AND vin <> ''
|
||||||
UNION
|
UNION
|
||||||
@@ -157,6 +163,7 @@ GROUP BY v.vin
|
|||||||
&summary.MultiSourceVehicles,
|
&summary.MultiSourceVehicles,
|
||||||
&summary.NoDataVehicles,
|
&summary.NoDataVehicles,
|
||||||
&summary.IdentityRequiredVehicles,
|
&summary.IdentityRequiredVehicles,
|
||||||
|
&summary.ArchiveIncompleteVehicles,
|
||||||
&healthy,
|
&healthy,
|
||||||
°raded,
|
°raded,
|
||||||
&offline,
|
&offline,
|
||||||
@@ -317,6 +324,7 @@ func (s *ProductionStore) VehicleCoverageSummary(ctx context.Context, query url.
|
|||||||
&summary.MultiSourceVehicles,
|
&summary.MultiSourceVehicles,
|
||||||
&summary.NoDataVehicles,
|
&summary.NoDataVehicles,
|
||||||
&summary.UnboundVehicles,
|
&summary.UnboundVehicles,
|
||||||
|
&summary.ArchiveIncompleteVehicles,
|
||||||
); err != nil {
|
); err != nil {
|
||||||
return VehicleCoverageSummary{}, err
|
return VehicleCoverageSummary{}, err
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -143,6 +143,7 @@ func TestBuildVehicleCoverageSummarySQL(t *testing.T) {
|
|||||||
"SUM(CASE WHEN online_source_count > 0 THEN 1 ELSE 0 END)",
|
"SUM(CASE WHEN online_source_count > 0 THEN 1 ELSE 0 END)",
|
||||||
"SUM(CASE WHEN source_count > 1 THEN 1 ELSE 0 END)",
|
"SUM(CASE WHEN source_count > 1 THEN 1 ELSE 0 END)",
|
||||||
"SUM(CASE WHEN source_count = 0 THEN 1 ELSE 0 END)",
|
"SUM(CASE WHEN source_count = 0 THEN 1 ELSE 0 END)",
|
||||||
|
"SUM(CASE WHEN archive_complete = 0 THEN 1 ELSE 0 END)",
|
||||||
"HAVING",
|
"HAVING",
|
||||||
"COUNT(DISTINCT s.protocol) > 1",
|
"COUNT(DISTINCT s.protocol) > 1",
|
||||||
} {
|
} {
|
||||||
|
|||||||
@@ -70,6 +70,7 @@ export interface VehicleCoverageSummary {
|
|||||||
multiSourceVehicles: number;
|
multiSourceVehicles: number;
|
||||||
noDataVehicles: number;
|
noDataVehicles: number;
|
||||||
unboundVehicles: number;
|
unboundVehicles: number;
|
||||||
|
archiveIncompleteVehicles: number;
|
||||||
missingSources: MissingSourceStat[];
|
missingSources: MissingSourceStat[];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -147,6 +148,7 @@ export interface VehicleServiceSummary {
|
|||||||
multiSourceVehicles: number;
|
multiSourceVehicles: number;
|
||||||
noDataVehicles: number;
|
noDataVehicles: number;
|
||||||
identityRequiredVehicles: number;
|
identityRequiredVehicles: number;
|
||||||
|
archiveIncompleteVehicles: number;
|
||||||
serviceStatuses: ServiceStatusStat[];
|
serviceStatuses: ServiceStatusStat[];
|
||||||
protocols: ProtocolStat[];
|
protocols: ProtocolStat[];
|
||||||
missingSources: MissingSourceStat[];
|
missingSources: MissingSourceStat[];
|
||||||
|
|||||||
@@ -160,7 +160,8 @@ export function Dashboard({ onOpenVehicle, onOpenQuality, onOpenVehicles }: { on
|
|||||||
{ label: '单源车辆', value: formatCount(serviceSummary?.singleSourceVehicles), filters: { coverage: 'single' } },
|
{ label: '单源车辆', value: formatCount(serviceSummary?.singleSourceVehicles), filters: { coverage: 'single' } },
|
||||||
{ label: '多源车辆', value: formatCount(serviceSummary?.multiSourceVehicles), filters: { coverage: 'multi' } },
|
{ label: '多源车辆', value: formatCount(serviceSummary?.multiSourceVehicles), filters: { coverage: 'multi' } },
|
||||||
{ label: '暂无来源车辆', value: formatCount(serviceSummary?.noDataVehicles), filters: { serviceStatus: 'no_data' } },
|
{ label: '暂无来源车辆', value: formatCount(serviceSummary?.noDataVehicles), filters: { serviceStatus: 'no_data' } },
|
||||||
{ label: '身份未绑定', value: formatCount(serviceSummary?.identityRequiredVehicles), filters: { serviceStatus: 'identity_required' } }
|
{ label: '身份未绑定', value: formatCount(serviceSummary?.identityRequiredVehicles), filters: { serviceStatus: 'identity_required' } },
|
||||||
|
{ label: '档案不完整', value: formatCount(serviceSummary?.archiveIncompleteVehicles), filters: { archiveStatus: 'incomplete' } }
|
||||||
];
|
];
|
||||||
const missingSourceCounts = new Map((serviceSummary?.missingSources ?? []).map((item) => [item.protocol, item.count]));
|
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 serviceActionQueue = useMemo<Array<{ label: string; count: number; filters: Record<string, string>; detail: string }>>(() => {
|
||||||
@@ -181,6 +182,14 @@ export function Dashboard({ onOpenVehicle, onOpenQuality, onOpenVehicles }: { on
|
|||||||
detail: '已有数据但无法稳定归并到 VIN,会影响车辆服务聚合。'
|
detail: '已有数据但无法稳定归并到 VIN,会影响车辆服务聚合。'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
if ((serviceSummary?.archiveIncompleteVehicles ?? 0) > 0) {
|
||||||
|
items.push({
|
||||||
|
label: '完善车辆档案',
|
||||||
|
count: serviceSummary?.archiveIncompleteVehicles ?? 0,
|
||||||
|
filters: { archiveStatus: 'incomplete' },
|
||||||
|
detail: '车辆缺少车牌、手机号或 OEM 等基础档案,影响后续运营查询和治理。'
|
||||||
|
});
|
||||||
|
}
|
||||||
for (const source of serviceSummary?.missingSources ?? []) {
|
for (const source of serviceSummary?.missingSources ?? []) {
|
||||||
if (source.count <= 0) continue;
|
if (source.count <= 0) continue;
|
||||||
items.push({
|
items.push({
|
||||||
|
|||||||
@@ -154,7 +154,8 @@ export function Vehicles({
|
|||||||
{ label: '单源车辆', value: (summary?.singleSourceVehicles ?? 0).toLocaleString(), filters: { coverage: 'single' } },
|
{ label: '单源车辆', value: (summary?.singleSourceVehicles ?? 0).toLocaleString(), filters: { coverage: 'single' } },
|
||||||
{ label: '多源车辆', value: (summary?.multiSourceVehicles ?? 0).toLocaleString(), filters: { coverage: 'multi' } },
|
{ label: '多源车辆', value: (summary?.multiSourceVehicles ?? 0).toLocaleString(), filters: { coverage: 'multi' } },
|
||||||
{ label: '暂无来源车辆', value: (summary?.noDataVehicles ?? 0).toLocaleString(), filters: { serviceStatus: 'no_data' } },
|
{ label: '暂无来源车辆', value: (summary?.noDataVehicles ?? 0).toLocaleString(), filters: { serviceStatus: 'no_data' } },
|
||||||
{ label: '待绑定', value: (summary?.unboundVehicles ?? 0).toLocaleString(), filters: { bindingStatus: 'unbound' } }
|
{ label: '待绑定', value: (summary?.unboundVehicles ?? 0).toLocaleString(), filters: { bindingStatus: 'unbound' } },
|
||||||
|
{ label: '档案不完整', value: (summary?.archiveIncompleteVehicles ?? 0).toLocaleString(), filters: { archiveStatus: 'incomplete' } }
|
||||||
];
|
];
|
||||||
for (const source of summary?.missingSources ?? []) {
|
for (const source of summary?.missingSources ?? []) {
|
||||||
if (source.count <= 0) continue;
|
if (source.count <= 0) continue;
|
||||||
@@ -176,6 +177,10 @@ export function Vehicles({
|
|||||||
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' });
|
||||||
}
|
}
|
||||||
|
const archiveIncompleteCount = summary?.archiveIncompleteVehicles ?? 0;
|
||||||
|
if (archiveIncompleteCount > 0) {
|
||||||
|
items.push({ label: '完善车辆档案', count: archiveIncompleteCount, filters: { archiveStatus: 'incomplete' }, color: 'orange' });
|
||||||
|
}
|
||||||
for (const source of summary?.missingSources ?? []) {
|
for (const source of summary?.missingSources ?? []) {
|
||||||
if (source.count <= 0) continue;
|
if (source.count <= 0) continue;
|
||||||
items.push({
|
items.push({
|
||||||
|
|||||||
@@ -92,6 +92,7 @@ test('dashboard renders vehicle service summary metrics', async () => {
|
|||||||
multiSourceVehicles: 181,
|
multiSourceVehicles: 181,
|
||||||
noDataVehicles: 461,
|
noDataVehicles: 461,
|
||||||
identityRequiredVehicles: 9,
|
identityRequiredVehicles: 9,
|
||||||
|
archiveIncompleteVehicles: 366,
|
||||||
serviceStatuses: [
|
serviceStatuses: [
|
||||||
{ status: 'healthy', title: '服务正常', count: 161 },
|
{ status: 'healthy', title: '服务正常', count: 161 },
|
||||||
{ status: 'degraded', title: '来源不完整', count: 41 }
|
{ status: 'degraded', title: '来源不完整', count: 41 }
|
||||||
@@ -128,6 +129,8 @@ test('dashboard renders vehicle service summary metrics', async () => {
|
|||||||
expect(screen.getByText('暂无来源车辆')).toBeInTheDocument();
|
expect(screen.getByText('暂无来源车辆')).toBeInTheDocument();
|
||||||
expect(screen.getByText('461')).toBeInTheDocument();
|
expect(screen.getByText('461')).toBeInTheDocument();
|
||||||
expect(screen.getByText('身份未绑定')).toBeInTheDocument();
|
expect(screen.getByText('身份未绑定')).toBeInTheDocument();
|
||||||
|
expect(screen.getByText('档案不完整')).toBeInTheDocument();
|
||||||
|
expect(screen.getByText('366')).toBeInTheDocument();
|
||||||
expect(screen.getByText('来源证据在线分布')).toBeInTheDocument();
|
expect(screen.getByText('来源证据在线分布')).toBeInTheDocument();
|
||||||
expect(screen.getByText('YUTONG_MQTT')).toBeInTheDocument();
|
expect(screen.getByText('YUTONG_MQTT')).toBeInTheDocument();
|
||||||
expect(screen.getByText('0%')).toBeInTheDocument();
|
expect(screen.getByText('0%')).toBeInTheDocument();
|
||||||
@@ -252,6 +255,7 @@ test('dashboard shows vehicle service action queue', async () => {
|
|||||||
multiSourceVehicles: 181,
|
multiSourceVehicles: 181,
|
||||||
noDataVehicles: 461,
|
noDataVehicles: 461,
|
||||||
identityRequiredVehicles: 9,
|
identityRequiredVehicles: 9,
|
||||||
|
archiveIncompleteVehicles: 366,
|
||||||
serviceStatuses: [],
|
serviceStatuses: [],
|
||||||
protocols: [],
|
protocols: [],
|
||||||
missingSources: [{ protocol: 'YUTONG_MQTT', count: 983 }]
|
missingSources: [{ protocol: 'YUTONG_MQTT', count: 983 }]
|
||||||
@@ -276,11 +280,12 @@ test('dashboard shows vehicle service action queue', async () => {
|
|||||||
expect(await screen.findByText('车辆服务处置队列')).toBeInTheDocument();
|
expect(await screen.findByText('车辆服务处置队列')).toBeInTheDocument();
|
||||||
expect(screen.getByRole('button', { name: '确认平台转发 461' })).toBeInTheDocument();
|
expect(screen.getByRole('button', { name: '确认平台转发 461' })).toBeInTheDocument();
|
||||||
expect(screen.getByRole('button', { name: '维护身份绑定 9' })).toBeInTheDocument();
|
expect(screen.getByRole('button', { name: '维护身份绑定 9' })).toBeInTheDocument();
|
||||||
|
expect(screen.getByRole('button', { name: '完善车辆档案 366' })).toBeInTheDocument();
|
||||||
expect(screen.getByRole('button', { name: '补齐 YUTONG_MQTT 来源 983' })).toBeInTheDocument();
|
expect(screen.getByRole('button', { name: '补齐 YUTONG_MQTT 来源 983' })).toBeInTheDocument();
|
||||||
|
|
||||||
fireEvent.click(screen.getByRole('button', { name: '确认平台转发 461' }));
|
fireEvent.click(screen.getByRole('button', { name: '完善车辆档案 366' }));
|
||||||
await waitFor(() => {
|
await waitFor(() => {
|
||||||
expect(window.location.hash).toBe('#/vehicles?serviceStatus=no_data');
|
expect(window.location.hash).toBe('#/vehicles?archiveStatus=incomplete');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user