From 6a4c33cbc622a43a75a592d1a834c48390cf196c Mon Sep 17 00:00:00 2001 From: YunaiV Date: Tue, 1 Jul 2025 22:24:02 +0800 Subject: [PATCH] =?UTF-8?q?feat=EF=BC=9A=E3=80=90IoT=20=E7=89=A9=E8=81=94?= =?UTF-8?q?=E7=BD=91=E3=80=91=E5=88=9D=E5=A7=8B=E5=8C=96=20IoT=20=E5=9B=BA?= =?UTF-8?q?=E4=BB=B6=E8=AF=A6=E6=83=85=E9=A1=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/iot/ota/firmware/index.ts | 15 +- src/api/iot/ota/task/index.ts | 37 ++ src/api/iot/ota/task/record/index.ts | 36 ++ src/router/modules/remaining.ts | 11 + src/views/iot/ota/firmware/detail/index.vue | 481 ++++++++++++++++++++ src/views/iot/ota/firmware/index.vue | 14 +- 6 files changed, 586 insertions(+), 8 deletions(-) create mode 100644 src/api/iot/ota/task/index.ts create mode 100644 src/api/iot/ota/task/record/index.ts create mode 100644 src/views/iot/ota/firmware/detail/index.vue diff --git a/src/api/iot/ota/firmware/index.ts b/src/api/iot/ota/firmware/index.ts index 5e953964..ad61e973 100644 --- a/src/api/iot/ota/firmware/index.ts +++ b/src/api/iot/ota/firmware/index.ts @@ -2,41 +2,42 @@ import request from '@/config/axios' /** IoT OTA 固件信息 */ export interface IoTOtaFirmware { - id: number // 固件编号 + id?: number // 固件编号 name?: string // 固件名称 - description: string // 固件描述 + description?: string // 固件描述 version?: string // 版本号 productId?: number // 产品编号 fileUrl?: string // 固件文件 URL fileSize?: number // 固件文件大小 fileDigestAlgorithm?: string // 固件文件签名算法 fileDigestValue?: string // 固件文件签名结果 + createTime?: Date // 创建时间 } // IoT OTA 固件 API export const IoTOtaFirmwareApi = { // 查询 OTA 固件分页 getOtaFirmwarePage: async (params: any) => { - return await request.get({ url: `/iot/ota-firmware/page`, params }) + return await request.get({ url: `/iot/ota/firmware/page`, params }) }, // 查询 OTA 固件详情 getOtaFirmware: async (id: number) => { - return await request.get({ url: `/iot/ota-firmware/get?id=` + id }) + return await request.get({ url: `/iot/ota/firmware/get?id=` + id }) }, // 新增 OTA 固件 createOtaFirmware: async (data: IoTOtaFirmware) => { - return await request.post({ url: `/iot/ota-firmware/create`, data }) + return await request.post({ url: `/iot/ota/firmware/create`, data }) }, // 修改 OTA 固件 updateOtaFirmware: async (data: IoTOtaFirmware) => { - return await request.put({ url: `/iot/ota-firmware/update`, data }) + return await request.put({ url: `/iot/ota/firmware/update`, data }) }, // 删除 OTA 固件 deleteOtaFirmware: async (id: number) => { - return await request.delete({ url: `/iot/ota-firmware/delete?id=` + id }) + return await request.delete({ url: `/iot/ota/firmware/delete?id=` + id }) } } diff --git a/src/api/iot/ota/task/index.ts b/src/api/iot/ota/task/index.ts new file mode 100644 index 00000000..22f0e7c8 --- /dev/null +++ b/src/api/iot/ota/task/index.ts @@ -0,0 +1,37 @@ +import request from '@/config/axios' + +/** IoT OTA 任务信息 */ +export interface OtaTask { + id?: number // 任务编号 + name?: string // 任务名称 + description?: string // 任务描述 + firmwareId?: number // 固件编号 + status?: number // 任务状态 + deviceScope?: number // 升级范围 + deviceTotalCount?: number // 设备总共数量 + deviceSuccessCount?: number // 设备成功数量 + createTime?: string // 创建时间 +} + +// IoT OTA 任务 API +export const IoTOtaTaskApi = { + // 查询 OTA 升级任务分页 + getOtaTaskPage: async (params: any) => { + return await request.get({ url: `/iot/ota/task/page`, params }) + }, + + // 查询 OTA 升级任务详情 + getOtaTask: async (id: number) => { + return await request.get({ url: `/iot/ota/task/get?id=` + id }) + }, + + // 创建 OTA 升级任务 + createOtaTask: async (data: OtaTask) => { + return await request.post({ url: `/iot/ota/task/create`, data }) + }, + + // 取消 OTA 升级任务 + cancelOtaTask: async (id: number) => { + return await request.post({ url: `/iot/ota/task/cancel?id=` + id }) + } +} diff --git a/src/api/iot/ota/task/record/index.ts b/src/api/iot/ota/task/record/index.ts new file mode 100644 index 00000000..220bda9b --- /dev/null +++ b/src/api/iot/ota/task/record/index.ts @@ -0,0 +1,36 @@ +import request from '@/config/axios' + +/** IoT OTA 任务记录信息 */ +export interface OtaTaskRecord { + id?: number // 升级记录编号 + firmwareId?: number // 固件编号 + firmwareVersion?: string // 固件版本 + taskId?: number // 任务编号 + deviceId?: string // 设备编号 + fromFirmwareId?: number // 来源的固件编号 + fromFirmwareVersion?: string // 来源的固件版本 + status?: number // 升级状态 + progress?: number // 升级进度,百分比 + description?: string // 升级进度描述 +} + +// IoT OTA 任务记录 API +export const IoTOtaTaskRecordApi = { + // 获取 OTA 升级记录状态统计 + getOtaTaskRecordStatusCount: async (firmwareId?: number, taskId?: number) => { + const params: any = {} + if (firmwareId) params.firmwareId = firmwareId + if (taskId) params.taskId = taskId + return await request.get({ url: `/iot/ota/task/record/get-status-count`, params }) + }, + + // 查询 OTA 任务记录分页 + getOtaTaskRecordPage: async (params: any) => { + return await request.get({ url: `/iot/ota/task/record/page`, params }) + }, + + // 查询 OTA 任务记录详情 + getOtaTaskRecord: async (id: number) => { + return await request.get({ url: `/iot/ota/task/record/get?id=` + id }) + } +} diff --git a/src/router/modules/remaining.ts b/src/router/modules/remaining.ts index 39bbe0ae..9c1246af 100644 --- a/src/router/modules/remaining.ts +++ b/src/router/modules/remaining.ts @@ -733,6 +733,17 @@ const remainingRouter: AppRouteRecordRaw[] = [ activeMenu: '/iot/device/device' }, component: () => import('@/views/iot/device/device/detail/index.vue') + }, + { + path: 'ota/firmware/detail/:id', + name: 'IoTOtaFirmwareDetail', + meta: { + title: '固件详情', + noCache: true, + hidden: true, + activeMenu: '/iot/operation/ota/firmware' + }, + component: () => import('@/views/iot/ota/firmware/detail/index.vue') } ] } diff --git a/src/views/iot/ota/firmware/detail/index.vue b/src/views/iot/ota/firmware/detail/index.vue new file mode 100644 index 00000000..661a47ec --- /dev/null +++ b/src/views/iot/ota/firmware/detail/index.vue @@ -0,0 +1,481 @@ + + + + + diff --git a/src/views/iot/ota/firmware/index.vue b/src/views/iot/ota/firmware/index.vue index 41787ae4..bfc862b1 100644 --- a/src/views/iot/ota/firmware/index.vue +++ b/src/views/iot/ota/firmware/index.vue @@ -98,8 +98,15 @@ :formatter="dateFormatter" width="180px" /> - +