From 09c19526bb1af853d30b33c465d33936865bb035 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Tue, 19 May 2026 15:31:45 +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=88v5=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/views/iot/ota/firmware/data.ts | 12 ++++++---- .../views/iot/ota/firmware/detail/index.vue | 2 +- .../iot/ota/firmware/detail/modules/info.vue | 3 +-- .../src/views/iot/ota/firmware/index.vue | 24 ++----------------- .../views/iot/ota/firmware/modules/form.vue | 10 ++++---- .../src/views/iot/ota/task/modules/detail.vue | 2 +- .../src/views/iot/ota/task/modules/form.vue | 4 +++- .../src/views/iot/ota/task/modules/info.vue | 2 +- .../src/views/iot/ota/task/modules/list.vue | 5 +++- .../views/iot/ota/task/modules/statistics.vue | 2 +- .../iot/ota/task/record/modules/list.vue | 7 +++--- 11 files changed, 29 insertions(+), 44 deletions(-) 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 e05633330..c02003ed3 100644 --- a/apps/web-antd/src/views/iot/ota/firmware/data.ts +++ b/apps/web-antd/src/views/iot/ota/firmware/data.ts @@ -1,12 +1,17 @@ import type { VbenFormSchema } from '#/adapter/form'; import type { VxeTableGridOptions } from '#/adapter/vxe-table'; import type { DescriptionItemSchema } from '#/components/description'; +import type { IotProductApi } from '#/api/iot/product/product'; import { formatDateTime } from '@vben/utils'; import { getSimpleProductList } from '#/api/iot/product/product'; import { getRangePickerDefaultProps } from '#/utils'; +/** 关联数据 */ +let productList: IotProductApi.Product[] = []; +getSimpleProductList().then((data) => (productList = data)); + /** 固件详情的描述字段 */ export function useDetailSchema(): DescriptionItemSchema[] { return [ @@ -124,9 +129,7 @@ export function useGridFormSchema(): VbenFormSchema[] { } /** 列表的字段 */ -export function useGridColumns( - getProductName?: (productId: number) => string | undefined, -): VxeTableGridOptions['columns'] { +export function useGridColumns(): VxeTableGridOptions['columns'] { return [ { type: 'checkbox', width: 40 }, { @@ -149,13 +152,12 @@ export function useGridColumns( title: '固件描述', minWidth: 200, }, - // TODO DONE @AI:后端 firmware 没返回 productName,formatter 调 getProductName resolver;resolver + productList 反应式状态由 index.vue 注入(对齐 infra/codegen 模式) { field: 'productId', title: '所属产品', minWidth: 150, formatter: ({ cellValue }) => - getProductName?.(cellValue) || (cellValue ? '加载中...' : '-'), + productList.find((p) => p.id === cellValue)?.name || '-', }, { 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 937ca8c24..896709122 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 @@ -1,4 +1,4 @@ -