From 8bcfa205773c45723f27b8fd82ef51f06b7f2428 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Tue, 19 May 2026 16:52:27 +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=88v6=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/views/iot/ota/firmware/detail/index.vue | 2 +- .../iot/ota/firmware/detail/modules/info.vue | 2 +- .../web-antd/src/views/iot/ota/firmware/index.vue | 2 +- apps/web-antd/src/views/iot/ota/task/data.ts | 3 --- .../src/views/iot/ota/task/modules/detail.vue | 10 ++++------ .../src/views/iot/ota/task/modules/form.vue | 2 +- .../src/views/iot/ota/task/modules/info.vue | 2 +- .../src/views/iot/ota/task/modules/list.vue | 13 +++++++------ .../views/iot/ota/task/record/modules/list.vue | 15 +++++++-------- 9 files changed, 23 insertions(+), 28 deletions(-) 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 896709122..7f9ff9a36 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 @@ -17,7 +17,7 @@ const route = useRoute(); const firmwareId = ref(Number(route.params.id)); const firmwareLoading = ref(false); -const firmware = ref({} as IoTOtaFirmwareApi.Firmware); +const firmware = ref(); const firmwareStatisticsLoading = ref(false); const firmwareStatistics = ref>({}); 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 index 316b0de95..4b9fd79fc 100644 --- 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 @@ -9,7 +9,7 @@ import { useDetailSchema } from '../../data'; /** IoT OTA 固件基本信息 */ defineProps<{ - firmware: IoTOtaFirmwareApi.Firmware; + firmware?: IoTOtaFirmwareApi.Firmware; loading?: boolean; }>(); 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 9182e3fd8..70b73c316 100644 --- a/apps/web-antd/src/views/iot/ota/firmware/index.vue +++ b/apps/web-antd/src/views/iot/ota/firmware/index.vue @@ -45,7 +45,7 @@ async function handleDelete(row: IoTOtaFirmwareApi.Firmware) { duration: 0, }); try { - await deleteOtaFirmware(row.id as number); + await deleteOtaFirmware(row.id!); message.success({ content: $t('ui.actionMessage.deleteSuccess', [row.name]), }); diff --git a/apps/web-antd/src/views/iot/ota/task/data.ts b/apps/web-antd/src/views/iot/ota/task/data.ts index 94ad0f11f..a487fafc5 100644 --- a/apps/web-antd/src/views/iot/ota/task/data.ts +++ b/apps/web-antd/src/views/iot/ota/task/data.ts @@ -97,7 +97,6 @@ export function useFormSchema(): VbenFormSchema[] { ]; } -// TODO DONE @AI:任务列表内嵌固件详情页,单字段搜索意义不大,已去掉搜索表单 /** 任务列表的字段 */ export function useGridColumns(): VxeTableGridOptions['columns'] { return [ @@ -164,5 +163,3 @@ export function useGridColumns(): VxeTableGridOptions['columns'] { }, ]; } - -// TODO DONE @AI:record schema 已挪到 task/record/data.ts;list 也独立成 task/record/modules/list.vue diff --git a/apps/web-antd/src/views/iot/ota/task/modules/detail.vue b/apps/web-antd/src/views/iot/ota/task/modules/detail.vue index f0557fe97..9e0492c1c 100644 --- a/apps/web-antd/src/views/iot/ota/task/modules/detail.vue +++ b/apps/web-antd/src/views/iot/ota/task/modules/detail.vue @@ -6,9 +6,7 @@ import { ref } from 'vue'; import { useVbenModal } from '@vben/common-ui'; import { getOtaTask } from '#/api/iot/ota/task'; -import { - getOtaTaskRecordStatusStatistics, -} from '#/api/iot/ota/task/record'; +import { getOtaTaskRecordStatusStatistics } from '#/api/iot/ota/task/record'; import OtaTaskRecordList from '../record/modules/list.vue'; import TaskInfo from './info.vue'; @@ -18,7 +16,7 @@ const emit = defineEmits(['success']); const taskId = ref(); const taskLoading = ref(false); -const task = ref({} as IoTOtaTaskApi.Task); +const task = ref(); const taskStatisticsLoading = ref(false); const taskStatistics = ref>({}); @@ -53,7 +51,7 @@ async function getStatistics() { } /** 单条记录取消后,刷新任务信息和统计 */ -async function handleRecordCancelled() { +async function handleRecordSuccess() { await getStatistics(); await getTaskInfo(); emit('success'); @@ -92,7 +90,7 @@ const [Modal, modalApi] = useVbenModal({
- +
diff --git a/apps/web-antd/src/views/iot/ota/task/modules/form.vue b/apps/web-antd/src/views/iot/ota/task/modules/form.vue index 580d0f63f..68c2aaca2 100644 --- a/apps/web-antd/src/views/iot/ota/task/modules/form.vue +++ b/apps/web-antd/src/views/iot/ota/task/modules/form.vue @@ -83,7 +83,7 @@ const [Modal, modalApi] = useVbenModal({ diff --git a/apps/web-antd/src/views/iot/ota/task/modules/info.vue b/apps/web-antd/src/views/iot/ota/task/modules/info.vue index 5d45c0ecc..a671ca776 100644 --- a/apps/web-antd/src/views/iot/ota/task/modules/info.vue +++ b/apps/web-antd/src/views/iot/ota/task/modules/info.vue @@ -9,7 +9,7 @@ import { useDetailSchema } from '../data'; defineProps<{ loading?: boolean; - task: IoTOtaTaskApi.Task; + task?: IoTOtaTaskApi.Task; }>(); const [Description] = useDescription({ diff --git a/apps/web-antd/src/views/iot/ota/task/modules/list.vue b/apps/web-antd/src/views/iot/ota/task/modules/list.vue index a05175557..75ec23cb2 100644 --- a/apps/web-antd/src/views/iot/ota/task/modules/list.vue +++ b/apps/web-antd/src/views/iot/ota/task/modules/list.vue @@ -10,6 +10,7 @@ import { Input, message } from 'ant-design-vue'; import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table'; import { cancelOtaTask, getOtaTaskPage } from '#/api/iot/ota/task'; +import { $t } from '#/locales'; import { IoTOtaTaskStatusEnum } from '#/views/iot/utils/constants'; import { useGridColumns } from '../data'; @@ -60,7 +61,7 @@ function handleDetail(row: IoTOtaTaskApi.Task) { /** 取消任务 */ async function handleCancel(row: IoTOtaTaskApi.Task) { - await cancelOtaTask(row.id as number); + await cancelOtaTask(row.id!); message.success('取消成功'); await handleRefresh(); } @@ -107,18 +108,18 @@ const [Grid, gridApi] = useVbenVxeGrid({ allow-clear style="width: 200px" @press-enter="handleSearch" - @change="(e: any) => !e.target.value && handleSearch()" + @clear="handleSearch" /> (); -const emit = defineEmits(['cancelled']); +const emit = defineEmits(['success']); const activeTab = ref(''); @@ -43,10 +44,10 @@ async function handleTabChange(tabKey: number | string) { /** 取消单条记录的升级 */ async function handleCancelUpgrade(record: IoTOtaTaskRecordApi.TaskRecord) { - await cancelOtaTaskRecord(record.id as number); + await cancelOtaTaskRecord(record.id!); message.success('取消成功'); await gridApi.query(); - emit('cancelled'); + emit('success'); } const [Grid, gridApi] = useVbenVxeGrid({ @@ -84,15 +85,13 @@ const [Grid, gridApi] = useVbenVxeGrid({ /** taskId 变化时重新查询 */ watch( () => props.taskId, - (val) => { + async (val) => { if (val) { activeTab.value = ''; - gridApi.query(); + await gridApi.query(); } }, ); - -defineExpose({ refresh: () => gridApi.query() });