refactor: extract mileage shared types
This commit is contained in:
74
src/server/routes/mileage/types.ts
Normal file
74
src/server/routes/mileage/types.ts
Normal file
@@ -0,0 +1,74 @@
|
|||||||
|
/** 缓存中的单辆车数据 */
|
||||||
|
export interface CachedVehicle {
|
||||||
|
plate: string;
|
||||||
|
vin: string;
|
||||||
|
dailyKm: number;
|
||||||
|
totalKm: number | null;
|
||||||
|
source: string;
|
||||||
|
isOnline: boolean;
|
||||||
|
isDataSynced: boolean;
|
||||||
|
customer: string | null;
|
||||||
|
department: string | null;
|
||||||
|
manager: string | null;
|
||||||
|
rentStatus: string | null;
|
||||||
|
entity: string | null;
|
||||||
|
project: string | null;
|
||||||
|
yesterdayKm: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 车牌前缀统计 */
|
||||||
|
export interface PlatePrefix {
|
||||||
|
prefix: string;
|
||||||
|
count: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 筛选选项(前端下拉) */
|
||||||
|
export interface MonitoringFilters {
|
||||||
|
departments: string[];
|
||||||
|
customers: string[];
|
||||||
|
plates: string[];
|
||||||
|
projects: string[];
|
||||||
|
entities: string[];
|
||||||
|
rentStatuses: string[];
|
||||||
|
platePrefixes: PlatePrefix[];
|
||||||
|
targetNames: string[];
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 监控缓存 */
|
||||||
|
export interface MonitoringCache {
|
||||||
|
vehicles: CachedVehicle[];
|
||||||
|
stats: { totalToday: number; totalAll: number; vehicleCount: number };
|
||||||
|
filters: MonitoringFilters;
|
||||||
|
targetPlatesMap: Map<string, Set<string>>;
|
||||||
|
updatedAt: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** /monitoring 响应中的统计 */
|
||||||
|
export interface MonitoringStats {
|
||||||
|
totalToday: number;
|
||||||
|
totalAll: number;
|
||||||
|
vehicleCount: number;
|
||||||
|
yesterdayTotal: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** /monitoring 完整响应 */
|
||||||
|
export interface MonitoringResponse {
|
||||||
|
vehicles: CachedVehicle[];
|
||||||
|
stats: MonitoringStats;
|
||||||
|
filters: MonitoringFilters;
|
||||||
|
total: number;
|
||||||
|
page: number;
|
||||||
|
totalPages: number;
|
||||||
|
updatedAt: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 车辆关联信息(从 lingniu_prod 查出的原始行) */
|
||||||
|
export interface VehicleInfoRow {
|
||||||
|
plate: string;
|
||||||
|
customer: string | null;
|
||||||
|
department: string | null;
|
||||||
|
manager: string | null;
|
||||||
|
rent_status: string | null;
|
||||||
|
entity: string | null;
|
||||||
|
project: string | null;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user