From be40db2a9cebb071b76a13ab6b9de81b59c78788 Mon Sep 17 00:00:00 2001 From: lzh Date: Sun, 22 Mar 2026 14:55:45 +0800 Subject: [PATCH] =?UTF-8?q?feat(@vben/web-antd):=20=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E5=B7=A1=E6=A3=80=E8=AE=B0=E5=BD=95=E6=A8=A1=E5=9D=97=E5=8F=8A?= =?UTF-8?q?=E8=B7=AF=E7=94=B1=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 新增巡检记录 API(分页查询、详情、统计) - 卡片式列表展示巡检记录,支持按状态 Tab 筛选 - 统计栏展示合格率/总数/合格数/不合格数 - 详情抽屉展示巡检明细项、照片、归因结果 - 注册巡检记录和巡检模板路由 Co-Authored-By: Claude Opus 4.6 (1M context) --- .../src/api/ops/inspection-record/index.ts | 90 +++ .../web-antd/src/router/routes/modules/ops.ts | 22 + .../src/views/ops/inspection-record/data.ts | 75 +++ .../src/views/ops/inspection-record/index.vue | 353 ++++++++++ .../inspection-record/modules/card-view.vue | 388 +++++++++++ .../modules/detail-drawer.vue | 635 ++++++++++++++++++ .../inspection-record/modules/stats-bar.vue | 244 +++++++ 7 files changed, 1807 insertions(+) create mode 100644 apps/web-antd/src/api/ops/inspection-record/index.ts create mode 100644 apps/web-antd/src/views/ops/inspection-record/data.ts create mode 100644 apps/web-antd/src/views/ops/inspection-record/index.vue create mode 100644 apps/web-antd/src/views/ops/inspection-record/modules/card-view.vue create mode 100644 apps/web-antd/src/views/ops/inspection-record/modules/detail-drawer.vue create mode 100644 apps/web-antd/src/views/ops/inspection-record/modules/stats-bar.vue diff --git a/apps/web-antd/src/api/ops/inspection-record/index.ts b/apps/web-antd/src/api/ops/inspection-record/index.ts new file mode 100644 index 000000000..e41349e8f --- /dev/null +++ b/apps/web-antd/src/api/ops/inspection-record/index.ts @@ -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> { + return requestClient.get('/ops/inspection/record/page', { params }); +} + +/** 获取巡检记录详情 */ +export function getRecordDetail( + id: number, +): Promise { + return requestClient.get('/ops/inspection/record/get', { params: { id } }); +} + +/** 获取巡检统计数据 */ +export function getInspectionStats( + params?: InspectionRecordApi.StatsQuery, +): Promise { + return requestClient.get('/ops/inspection/record/stats', { params }); +} diff --git a/apps/web-antd/src/router/routes/modules/ops.ts b/apps/web-antd/src/router/routes/modules/ops.ts index 654e92836..64eb6d195 100644 --- a/apps/web-antd/src/router/routes/modules/ops.ts +++ b/apps/web-antd/src/router/routes/modules/ops.ts @@ -93,6 +93,28 @@ const routes: RouteRecordRaw[] = [ }, component: () => import('#/views/ops/work-order/dashboard/index.vue'), }, + // 巡检记录 + { + path: 'inspection-record', + name: 'OpsInspectionRecord', + meta: { + title: '巡检记录', + activePath: '/ops/inspection-record', + }, + component: () => + import('#/views/ops/inspection-record/index.vue'), + }, + // 巡检模板管理 + { + path: 'inspection-template', + name: 'OpsInspectionTemplate', + meta: { + title: '巡检模板管理', + activePath: '/ops/inspection-template', + }, + component: () => + import('#/views/ops/inspection-template/index.vue'), + }, ], }, ]; diff --git a/apps/web-antd/src/views/ops/inspection-record/data.ts b/apps/web-antd/src/views/ops/inspection-record/data.ts new file mode 100644 index 000000000..48995bbb7 --- /dev/null +++ b/apps/web-antd/src/views/ops/inspection-record/data.ts @@ -0,0 +1,75 @@ +/** 巡检结果状态映射 */ +export const RESULT_STATUS_MAP: Record = { + 0: '不合格', + 1: '合格', +}; + +/** 巡检结果颜色映射 */ +export const RESULT_COLOR_MAP: Record = { + 0: '#ff4d4f', + 1: '#52c41a', +}; + +/** 巡检结果浅色映射(用于背景等) */ +export const RESULT_LIGHT_COLOR_MAP: Record = { + 0: '#fff1f0', + 1: '#f6ffed', +}; + +/** 巡检结果图标映射 */ +export const RESULT_ICON_MAP: Record = { + 0: 'solar:close-circle-bold', + 1: 'solar:check-circle-bold', +}; + +/** 卡片左上角渐变背景(亮色模式) */ +export const CARD_GRADIENT_MAP: Record = { + 0: 'radial-gradient(ellipse at top left, rgb(255 77 79 / 12%) 0%, rgb(255 77 79 / 4%) 40%, transparent 70%)', + 1: 'radial-gradient(ellipse at top left, rgb(82 196 26 / 12%) 0%, rgb(82 196 26 / 4%) 40%, transparent 70%)', +}; + +/** 卡片左上角渐变背景(暗色模式) */ +export const CARD_GRADIENT_DARK_MAP: Record = { + 0: 'radial-gradient(ellipse at top left, rgb(255 77 79 / 15%) 0%, rgb(255 77 79 / 5%) 40%, transparent 70%)', + 1: 'radial-gradient(ellipse at top left, rgb(82 196 26 / 15%) 0%, rgb(82 196 26 / 5%) 40%, transparent 70%)', +}; + +/** 详情页顶部状态横幅渐变 */ +export const DETAIL_BANNER_GRADIENT_MAP: Record = { + 0: 'linear-gradient(135deg, #fff1f0 0%, #ffccc7 50%, #fff1f0 100%)', + 1: 'linear-gradient(135deg, #f6ffed 0%, #d9f7be 50%, #f6ffed 100%)', +}; + +/** 详情页顶部状态横幅渐变(暗色) */ +export const DETAIL_BANNER_GRADIENT_DARK_MAP: Record = { + 0: 'linear-gradient(135deg, #2a1215 0%, #431418 50%, #2a1215 100%)', + 1: 'linear-gradient(135deg, #162312 0%, #274916 50%, #162312 100%)', +}; + +/** 归因结果映射 */ +export const ATTRIBUTION_MAP: Record = { + 1: '个人责任', + 2: '突发状况', + 3: '正常', +}; + +/** 归因结果颜色映射 */ +export const ATTRIBUTION_COLOR_MAP: Record = { + 1: '#ff4d4f', + 2: '#faad14', + 3: '#52c41a', +}; + +/** 归因结果 Tag 颜色映射 */ +export const ATTRIBUTION_TAG_COLOR_MAP: Record = { + 1: 'error', + 2: 'warning', + 3: 'success', +}; + +/** 状态 Tab 选项 */ +export const STATUS_TAB_OPTIONS = [ + { key: 'ALL', label: '全部', resultStatus: undefined }, + { key: 'PASSED', label: '合格', resultStatus: 1 }, + { key: 'FAILED', label: '不合格', resultStatus: 0 }, +]; diff --git a/apps/web-antd/src/views/ops/inspection-record/index.vue b/apps/web-antd/src/views/ops/inspection-record/index.vue new file mode 100644 index 000000000..7057ca44e --- /dev/null +++ b/apps/web-antd/src/views/ops/inspection-record/index.vue @@ -0,0 +1,353 @@ + + + + + diff --git a/apps/web-antd/src/views/ops/inspection-record/modules/card-view.vue b/apps/web-antd/src/views/ops/inspection-record/modules/card-view.vue new file mode 100644 index 000000000..416c4a57a --- /dev/null +++ b/apps/web-antd/src/views/ops/inspection-record/modules/card-view.vue @@ -0,0 +1,388 @@ + + + + + diff --git a/apps/web-antd/src/views/ops/inspection-record/modules/detail-drawer.vue b/apps/web-antd/src/views/ops/inspection-record/modules/detail-drawer.vue new file mode 100644 index 000000000..6311a575d --- /dev/null +++ b/apps/web-antd/src/views/ops/inspection-record/modules/detail-drawer.vue @@ -0,0 +1,635 @@ + + + + + diff --git a/apps/web-antd/src/views/ops/inspection-record/modules/stats-bar.vue b/apps/web-antd/src/views/ops/inspection-record/modules/stats-bar.vue new file mode 100644 index 000000000..5c41b5e10 --- /dev/null +++ b/apps/web-antd/src/views/ops/inspection-record/modules/stats-bar.vue @@ -0,0 +1,244 @@ + + + + +