feat(@vben/web-antd): 新增巡检记录模块及路由配置
- 新增巡检记录 API(分页查询、详情、统计) - 卡片式列表展示巡检记录,支持按状态 Tab 筛选 - 统计栏展示合格率/总数/合格数/不合格数 - 详情抽屉展示巡检明细项、照片、归因结果 - 注册巡检记录和巡检模板路由 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
90
apps/web-antd/src/api/ops/inspection-record/index.ts
Normal file
90
apps/web-antd/src/api/ops/inspection-record/index.ts
Normal file
@@ -0,0 +1,90 @@
|
||||
import type { PageParam, PageResult } from '@vben/request';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace InspectionRecordApi {
|
||||
/** 巡检记录(列表项,对应 InspectionRecordRespVO) */
|
||||
export interface InspectionRecord {
|
||||
id: number;
|
||||
areaId: number;
|
||||
areaFullName?: string;
|
||||
inspectorId: number;
|
||||
inspectorName?: string;
|
||||
isLocationException: number; // 0=正常, 1=异常
|
||||
resultStatus: number; // 0=不合格, 1=合格
|
||||
attributionResult?: number; // 1=个人责任, 2=突发状况, 3=正常
|
||||
generatedOrderId?: number;
|
||||
createTime: string;
|
||||
}
|
||||
|
||||
/** 巡检明细项(对应 InspectionRecordItemRespVO) */
|
||||
export interface RecordItem {
|
||||
id: number;
|
||||
templateId: number;
|
||||
itemTitle?: string;
|
||||
itemDescription?: string;
|
||||
isPassed: boolean;
|
||||
remark?: string;
|
||||
tags?: string[];
|
||||
}
|
||||
|
||||
/** 巡检记录详情(对应 InspectionRecordDetailRespVO,继承列表 VO) */
|
||||
export interface InspectionRecordDetail extends InspectionRecord {
|
||||
remark?: string;
|
||||
tags?: string[];
|
||||
photos?: string[];
|
||||
items?: RecordItem[];
|
||||
}
|
||||
|
||||
/** 分页查询参数(对应 InspectionRecordPageReqVO) */
|
||||
export interface PageQuery extends PageParam {
|
||||
areaId?: number;
|
||||
inspectorId?: number;
|
||||
resultStatus?: number;
|
||||
createTime?: string[];
|
||||
}
|
||||
|
||||
/** 统计查询参数(对应 InspectionStatsReqVO) */
|
||||
export interface StatsQuery {
|
||||
areaId?: number;
|
||||
createTime?: string[];
|
||||
}
|
||||
|
||||
/** 区域不合格统计 */
|
||||
export interface AreaFailStat {
|
||||
areaId: number;
|
||||
failedCount: number;
|
||||
}
|
||||
|
||||
/** 统计数据(对应 InspectionStatsRespVO) */
|
||||
export interface InspectionStats {
|
||||
totalCount: number;
|
||||
passedCount: number;
|
||||
failedCount: number;
|
||||
passRate: number;
|
||||
hotSpotAreas?: AreaFailStat[];
|
||||
}
|
||||
}
|
||||
|
||||
// ========== 巡检记录 API ==========
|
||||
|
||||
/** 获取巡检记录分页列表 */
|
||||
export function getRecordPage(
|
||||
params: InspectionRecordApi.PageQuery,
|
||||
): Promise<PageResult<InspectionRecordApi.InspectionRecord>> {
|
||||
return requestClient.get('/ops/inspection/record/page', { params });
|
||||
}
|
||||
|
||||
/** 获取巡检记录详情 */
|
||||
export function getRecordDetail(
|
||||
id: number,
|
||||
): Promise<InspectionRecordApi.InspectionRecordDetail> {
|
||||
return requestClient.get('/ops/inspection/record/get', { params: { id } });
|
||||
}
|
||||
|
||||
/** 获取巡检统计数据 */
|
||||
export function getInspectionStats(
|
||||
params?: InspectionRecordApi.StatsQuery,
|
||||
): Promise<InspectionRecordApi.InspectionStats> {
|
||||
return requestClient.get('/ops/inspection/record/stats', { params });
|
||||
}
|
||||
Reference in New Issue
Block a user