feat(assets): 完成故障维修运维 BI 与 Excel 报表导出
This commit is contained in:
@@ -0,0 +1,65 @@
|
||||
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 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[];
|
||||
}
|
||||
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 })[];
|
||||
}
|
||||
Reference in New Issue
Block a user