From 9d54f60b10698c4169644bfbfa496fec2bbdcba8 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Tue, 19 May 2026 14:29:14 +0800 Subject: [PATCH] =?UTF-8?q?feat=EF=BC=88iot=EF=BC=89=EF=BC=9A=E4=BC=98?= =?UTF-8?q?=E5=8C=96=20ota=20=E7=9A=84=E4=BB=A3=E7=A0=81=E9=A3=8E=E6=A0=BC?= =?UTF-8?q?=EF=BC=88v3=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../web-antd/src/router/routes/modules/iot.ts | 2 +- .../src/views/iot/ota/firmware/data.ts | 12 +- .../views/iot/ota/firmware/detail/index.vue | 34 ++-- .../iot/ota/firmware/detail/modules/info.vue | 28 +++ .../src/views/iot/ota/firmware/index.vue | 22 ++- apps/web-antd/src/views/iot/ota/task/data.ts | 100 +++------- .../src/views/iot/ota/task/modules/detail.vue | 173 +++--------------- .../src/views/iot/ota/task/modules/form.vue | 2 + .../src/views/iot/ota/task/modules/info.vue | 30 +++ .../src/views/iot/ota/task/modules/list.vue | 65 ++++--- ...{upgrade-statistics.vue => statistics.vue} | 28 +-- .../src/views/iot/ota/task/record/data.ts | 59 ++++++ .../iot/ota/task/record/modules/list.vue | 143 +++++++++++++++ 13 files changed, 416 insertions(+), 282 deletions(-) create mode 100644 apps/web-antd/src/views/iot/ota/firmware/detail/modules/info.vue create mode 100644 apps/web-antd/src/views/iot/ota/task/modules/info.vue rename apps/web-antd/src/views/iot/ota/task/modules/{upgrade-statistics.vue => statistics.vue} (70%) create mode 100644 apps/web-antd/src/views/iot/ota/task/record/data.ts create mode 100644 apps/web-antd/src/views/iot/ota/task/record/modules/list.vue diff --git a/apps/web-antd/src/router/routes/modules/iot.ts b/apps/web-antd/src/router/routes/modules/iot.ts index 2bc6d32b2..ec0191863 100644 --- a/apps/web-antd/src/router/routes/modules/iot.ts +++ b/apps/web-antd/src/router/routes/modules/iot.ts @@ -37,7 +37,7 @@ const routes: RouteRecordRaw[] = [ activePath: '/iot/ota', }, component: () => - import('#/views/iot/ota/modules/firmware-detail/index.vue'), + import('#/views/iot/ota/firmware/detail/index.vue'), }, ], }, diff --git a/apps/web-antd/src/views/iot/ota/firmware/data.ts b/apps/web-antd/src/views/iot/ota/firmware/data.ts index befa885b3..e05633330 100644 --- a/apps/web-antd/src/views/iot/ota/firmware/data.ts +++ b/apps/web-antd/src/views/iot/ota/firmware/data.ts @@ -124,7 +124,9 @@ export function useGridFormSchema(): VbenFormSchema[] { } /** 列表的字段 */ -export function useGridColumns(): VxeTableGridOptions['columns'] { +export function useGridColumns( + getProductName?: (productId: number) => string | undefined, +): VxeTableGridOptions['columns'] { return [ { type: 'checkbox', width: 40 }, { @@ -147,13 +149,13 @@ export function useGridColumns(): VxeTableGridOptions['columns'] { title: '固件描述', minWidth: 200, }, - // TODO DONE @AI:vben 用 row.productName(后端 VO 已返回);vue3 + ep 用 getProductName(productId) 本地查表;vben 更直接,且 IoTOtaFirmwareApi.Firmware.productName 已是 API 契约 - // TODO @AI:实际后端没读取哈。看看怎么对齐下 vue3 + ep + // TODO DONE @AI:后端 firmware 没返回 productName,formatter 调 getProductName resolver;resolver + productList 反应式状态由 index.vue 注入(对齐 infra/codegen 模式) { - field: 'productName', + field: 'productId', title: '所属产品', minWidth: 150, - formatter: ({ row }) => row.productName || '未知产品', + formatter: ({ cellValue }) => + getProductName?.(cellValue) || (cellValue ? '加载中...' : '-'), }, { field: 'fileUrl', diff --git a/apps/web-antd/src/views/iot/ota/firmware/detail/index.vue b/apps/web-antd/src/views/iot/ota/firmware/detail/index.vue index 0fc0b789a..937ca8c24 100644 --- a/apps/web-antd/src/views/iot/ota/firmware/detail/index.vue +++ b/apps/web-antd/src/views/iot/ota/firmware/detail/index.vue @@ -4,11 +4,13 @@ import type { IoTOtaFirmwareApi } from '#/api/iot/ota/firmware'; import { onMounted, ref } from 'vue'; import { useRoute } from 'vue-router'; +import { Page } from '@vben/common-ui'; + import { getOtaFirmware } from '#/api/iot/ota/firmware'; import { getOtaTaskRecordStatusStatistics } from '#/api/iot/ota/task/record'; import OtaTaskList from '../../task/modules/list.vue'; -import UpgradeStatistics from '../../task/modules/upgrade-statistics.vue'; +import UpgradeStatistics from '../../task/modules/statistics.vue'; import FirmwareInfo from './modules/info.vue'; const route = useRoute(); @@ -50,23 +52,23 @@ onMounted(() => { diff --git a/apps/web-antd/src/views/iot/ota/firmware/detail/modules/info.vue b/apps/web-antd/src/views/iot/ota/firmware/detail/modules/info.vue new file mode 100644 index 000000000..6d1d4a682 --- /dev/null +++ b/apps/web-antd/src/views/iot/ota/firmware/detail/modules/info.vue @@ -0,0 +1,28 @@ + + + diff --git a/apps/web-antd/src/views/iot/ota/firmware/index.vue b/apps/web-antd/src/views/iot/ota/firmware/index.vue index 6d0d6789b..400869c6a 100644 --- a/apps/web-antd/src/views/iot/ota/firmware/index.vue +++ b/apps/web-antd/src/views/iot/ota/firmware/index.vue @@ -1,7 +1,9 @@