85 lines
5.0 KiB
TypeScript
85 lines
5.0 KiB
TypeScript
import type { AssetAnalysisCell } from './analytics';
|
|
|
|
export const FAULT_DIMENSIONS = {
|
|
city: '运营城市', status: '故障状态', inventory: '库存状态',
|
|
customer: '客户名称', department: '业务部门', handler: '运维处置人',
|
|
} as const;
|
|
export type FaultDimension = keyof typeof FAULT_DIMENSIONS;
|
|
export type FaultMetric = 'reported' | 'closed' | 'open';
|
|
export interface FaultOption { value: string; label: string }
|
|
export interface FaultCounts { reported: number; closed: number; open: number }
|
|
export const FAULT_REPORT_METHODS = { operations: '运维提报', customer: 'AI提报' } as const;
|
|
export type FaultReportMethod = keyof typeof FAULT_REPORT_METHODS;
|
|
export interface FaultRecord {
|
|
id: string; code: string; plate: string; description: string;
|
|
reportedAt: string | null; archivedAt: string | null; deadlineAt: string | null; receivedAt: string | null;
|
|
city: string; status: string; inventory: string;
|
|
customer: string; customerLabel: string; department: string;
|
|
handlers: FaultOption[];
|
|
level?: string; categories?: string[]; progress?: string; reportMethod?: FaultReportMethod;
|
|
}
|
|
export interface FaultQuery {
|
|
start: string; end: string; groupBy: FaultDimension;
|
|
filters: Partial<Record<FaultDimension, string>>;
|
|
metric: FaultMetric; day?: string; groupValue?: string; page: number;
|
|
subject?: string;
|
|
}
|
|
export interface FaultResponse {
|
|
start: string; end: string; updatedAt: string;
|
|
totals: FaultCounts;
|
|
daily: { date: string; reported: number; closed: number }[];
|
|
groups: (FaultOption & FaultCounts)[];
|
|
options: Record<FaultDimension, FaultOption[]>;
|
|
quality: { missingReport: number; invalidChronology: number; missingVehicle: number };
|
|
details: { rows: FaultRecord[]; total: number; page: number; pageSize: number };
|
|
}
|
|
|
|
export const FAULT_OVERVIEW_METRICS = { reported: '今日新增', closed: '本日解决', open: '当前在办', waiting: '待处理', processing: '处理中', suspended: '挂起', overdue: '逾期', ledger: '累计台账' } as const;
|
|
export type FaultOverviewMetric = keyof typeof FAULT_OVERVIEW_METRICS;
|
|
export interface FaultOverview {
|
|
date: string; updatedAt: string;
|
|
totals: Record<FaultOverviewMetric, number>;
|
|
}
|
|
export interface FaultAnalysisRecord extends FaultRecord { cell: AssetAnalysisCell }
|
|
export interface FaultAnalysisResponse {
|
|
date: string; updatedAt: string; metric: FaultOverviewMetric; rows: FaultAnalysisRecord[];
|
|
customerLabels: Record<string, string>;
|
|
}
|
|
|
|
export type FaultTrendStatus = 'all' | 'closed' | 'unclosed';
|
|
export interface FaultTrendQuery {
|
|
start: string; end: string; granularity: 'day' | 'month';
|
|
status: FaultTrendStatus; period?: string;
|
|
}
|
|
export interface FaultTrendCounts { reported: number; closed: number; unclosed: number }
|
|
export interface FaultTrendResponse {
|
|
start: string; end: string; granularity: 'day' | 'month'; updatedAt: string;
|
|
totals: FaultTrendCounts;
|
|
periods: (FaultTrendCounts & { period: string })[];
|
|
}
|
|
|
|
export const FAULT_WEEKLY_METRICS = { reported: '新增故障', received: '接收处理数量', closed: '解决故障' } as const;
|
|
export type FaultWeeklyMetric = keyof typeof FAULT_WEEKLY_METRICS;
|
|
export interface FaultWeeklyQuery { start: string; end: string; metric: FaultWeeklyMetric; day?: string }
|
|
export interface FaultWeeklyResponse {
|
|
start: string; end: string; updatedAt: string;
|
|
totals: Record<FaultWeeklyMetric, number>;
|
|
days: (Record<FaultWeeklyMetric, number> & { date: string })[];
|
|
}
|
|
|
|
export const FAULT_DASHBOARD_FILTERS = { region: '区域', customer: '客户', model: '品牌车型', city: '城市', department: '业务部门', handler: '运维处置人', level: '故障程度', category: '故障部位', inventory: '库存状态', reportMethod: '提报来源' } as const;
|
|
export type FaultDashboardDimension = keyof typeof FAULT_DASHBOARD_FILTERS;
|
|
export type FaultDashboardFilters = Partial<Record<FaultDashboardDimension, string>>;
|
|
export type FaultDashboardScope = 'focus' | 'cohort' | 'open' | 'waiting' | 'processing' | 'overdue' | 'ledger' | 'reported' | 'closed';
|
|
export interface FaultDistribution { value: string; label: string; reported: number; closed: number; unclosed: number; vehicles: number; open: number }
|
|
export interface FaultDashboardResponse {
|
|
start: string; end: string; updatedAt: string;
|
|
totals: { reported: number; operationsReported: number; customerReported: number; vehicles: number; customers: number; previous: number; change: number | null; open: number; waiting: number; processing: number; overdue: number; longestOverdueDays: number; todayReported: number; todayClosed: number; ledger: number };
|
|
options: Record<FaultDashboardDimension, FaultOption[]>;
|
|
distributions: Record<'region' | 'level' | 'customer' | 'model', FaultDistribution[]>;
|
|
matrix: { models: FaultOption[]; categories: FaultOption[]; cells: { model: string; category: string; count: number }[]; totals: Record<string, number> };
|
|
focus: FaultAnalysisRecord[];
|
|
focusTotals: { total: number; overdue: number };
|
|
quality: { missingLevel: number; missingCategory: number; missingVehicle: number; missingDeadline: number; missingReport: number };
|
|
}
|