/** 日志来源模块 */
|
export type LogModule = 'CLOUD' | 'CDU' | 'XPU' | 'MINI_PROGRAM'
|
|
/** 日志级别 */
|
export type LogLevel = 'DEBUG' | 'INFO' | 'WARN' | 'ERROR'
|
|
/**
|
* 模块级状态(与后端 status 枚举一致)
|
* fetching = 车端日志拉取中(已提交拉取任务但日志尚不可取)
|
* loading 为前端本地过渡态,不由后端返回
|
*/
|
export type ModuleStatus = 'success' | 'timeout' | 'error' | 'empty' | 'fetching' | 'loading'
|
|
/**
|
* 查询记录状态(与后端 wire 值一致)
|
* fetching=拉取中 / partial=部分完成(车端待回填) / completed=已完成
|
*/
|
export type RecordStatus = 'fetching' | 'partial' | 'completed'
|
|
/** 查询维度:1=订单号 2=VIN 3=小程序上传(自动生成) */
|
export type QueryType = 1 | 2 | 3
|
|
/** 异常标注 */
|
export interface AnnotationInfo {
|
/** 异常模式,如"指令超时"、"状态不匹配" */
|
pattern: string
|
/** 推荐排查方向 */
|
suggestion: string
|
}
|
|
/** 单条日志(时间线的一行,带来源标签 module) */
|
export interface LogEntry {
|
/** 唯一ID */
|
id: string
|
/** ISO 8601 时间戳 */
|
timestamp: string
|
level: LogLevel
|
/** 来源模块(时间线上作为来源标签展示) */
|
module: LogModule
|
/** 来源服务名 */
|
source: string
|
/** 日志内容摘要 */
|
content: string
|
/** 完整日志原文 */
|
fullContent: string
|
traceId?: string
|
spanId?: string
|
annotation?: AnnotationInfo
|
}
|
|
/** 四路状态摘要(列表页与详情页共用) */
|
export interface ModuleStatusSummary {
|
module: LogModule
|
status: ModuleStatus
|
count: number
|
}
|
|
/** 订单信息(订单号维度查询时返回) */
|
export interface OrderInfo {
|
orderNumber: string
|
orderId: string
|
vin: string
|
plateNumber: string
|
status: number
|
statusDesc: string
|
createTime: string
|
appUserId: string
|
}
|
|
/** 车辆概要(VIN查询时返回) */
|
export interface VehicleSummary {
|
vin: string
|
plateNumber: string
|
relatedOrderCount: number
|
logTimeRange: { start: string; end: string }
|
}
|
|
/** 关联订单(VIN查询时返回) */
|
export interface RelatedOrder {
|
orderNumber: string
|
orderTime: string
|
status: number
|
statusDesc: string
|
hasAnomaly: boolean
|
}
|
|
// ──────────────── 新建排查任务 POST /orderLog/query ────────────────
|
|
/** 新建排查任务请求 */
|
export interface CreateTaskParams {
|
orderNumber: string
|
vin: string
|
timeRange: [number, number] | null
|
/** 拉取来源多选,不选的路不拉取(直接减少车端下载/解压/落库开销) */
|
modules: LogModule[]
|
/** 关键字:随任务记录留存,作为详情页展示筛选的预填条件;不收缩拉取范围(落全量) */
|
keyword: string
|
}
|
|
/** 新建排查任务响应 */
|
export interface CreateTaskResult {
|
recordId: number
|
/** 后端当前仅返回 recordId,status 可选 */
|
status?: RecordStatus
|
}
|
|
// ──────────────── 查询记录列表 GET /orderLog/records ────────────────
|
|
/** 列表筛选参数 */
|
export interface RecordListParams {
|
operator: string
|
orderNumber: string
|
vin: string
|
queryType: QueryType | null
|
timeRange: [number, number] | null
|
page: number
|
size: number
|
}
|
|
/** 列表项 */
|
export interface QueryRecord {
|
recordId: number
|
queryType: QueryType
|
queryTypeDesc: string
|
orderNumber: string
|
vin: string
|
queryStartTime: string
|
queryEndTime: string
|
operator: string
|
/** 查询时间 */
|
createTime: string
|
status: RecordStatus
|
statusDesc: string
|
/** 四路状态摘要,用于区分同一订单的多条记录 */
|
moduleStatus: ModuleStatusSummary[]
|
totalCount: number
|
hasError: boolean
|
}
|
|
/** 列表响应 */
|
export interface RecordListResult {
|
records: QueryRecord[]
|
page: number
|
size: number
|
total: number
|
}
|
|
// ──────────────── 记录详情 GET /orderLog/records/{recordId} ────────────────
|
|
/** 详情展示筛选参数(仅过滤已落库明细,不触发重新拉取) */
|
export interface DetailFilterParams {
|
levels: LogLevel[]
|
modules: LogModule[]
|
keyword: string
|
page: number
|
size: number
|
}
|
|
/** 详情响应 */
|
export interface RecordDetailResult {
|
recordId: number
|
status: RecordStatus
|
orderInfo: OrderInfo | null
|
/** 新建时选中的来源(详情页模块筛选只在此范围内) */
|
queryModules: LogModule[]
|
/** 新建时填的关键字(详情页关键字筛选预填值) */
|
keyword: string
|
/** 四路状态与条数概览(含车端 fetching 提示) */
|
moduleStatus: ModuleStatusSummary[]
|
/** 统一时间线(按 timestamp 排序,每行带 module 来源标签) */
|
entries: LogEntry[]
|
page: number
|
size: number
|
total: number
|
vehicleSummary?: VehicleSummary
|
relatedOrders?: RelatedOrder[]
|
}
|
|
/** 分页状态 */
|
export interface PaginationState {
|
page: number
|
pageSize: number
|
}
|