diff --git a/src/views/iot/ota/firmware/detail/index.vue b/src/views/iot/ota/firmware/detail/index.vue index 715b24d17..a7ce68501 100644 --- a/src/views/iot/ota/firmware/detail/index.vue +++ b/src/views/iot/ota/firmware/detail/index.vue @@ -44,9 +44,9 @@ - {{ - firmwareStatistics[IoTOtaTaskRecordStatusEnum.PUSHED.value] || 0 - }} + + {{ firmwareStatistics[IoTOtaTaskRecordStatusEnum.PUSHED.value] || 0 }} + 已推送 @@ -68,9 +68,9 @@ - {{ - firmwareStatistics[IoTOtaTaskRecordStatusEnum.FAILURE.value] || 0 - }} + + {{ firmwareStatistics[IoTOtaTaskRecordStatusEnum.FAILURE.value] || 0 }} + 升级失败 diff --git a/src/views/iot/ota/task/OtaTaskList.vue b/src/views/iot/ota/task/OtaTaskList.vue index d2898fa72..1d37713e4 100644 --- a/src/views/iot/ota/task/OtaTaskList.vue +++ b/src/views/iot/ota/task/OtaTaskList.vue @@ -9,10 +9,11 @@ label-width="68px" > - + 新增 + - - 详情 + 详情 @@ -87,7 +87,7 @@ ref="taskFormRef" :firmware-id="firmwareId" :product-id="productId" - @success="handleTaskSuccess" + @success="handleTaskCreateSuccess" /> @@ -108,11 +108,7 @@ defineOptions({ name: 'OtaTaskList' }) const props = defineProps<{ firmwareId: number - productId?: number -}>() - -const emit = defineEmits<{ - success: [] + productId: number }>() const message = useMessage() // 消息弹窗 @@ -155,16 +151,15 @@ const openTaskForm = () => { } /** 处理任务创建成功 */ -const handleTaskSuccess = () => { +const emit = defineEmits(['success']) // 定义 success 事件,用于操作成功后的回调 +const handleTaskCreateSuccess = () => { getTaskList() emit('success') } /** 查看任务详情 */ -const handleViewDetail = (id: number | undefined) => { - if (id) { - taskDetailRef.value?.open(id) - } +const handleTaskDetail = (id: number) => { + taskDetailRef.value?.open(id) } /** 取消任务 */ @@ -173,7 +168,9 @@ const handleCancelTask = async (id: number) => { await message.confirm('确认要取消该升级任务吗?') await IoTOtaTaskApi.cancelOtaTask(id) message.success('取消成功') - getTaskList() + // 刷新数据 + await getTaskList() + emit('success') } catch (error) { console.error('取消任务失败', error) } @@ -185,7 +182,5 @@ onMounted(() => { }) /** 暴露方法供父组件调用 */ -defineExpose({ - getTaskList -}) +defineExpose({ getTaskList }) diff --git a/src/views/iot/product/category/index.vue b/src/views/iot/product/category/index.vue index e78262217..f42108309 100644 --- a/src/views/iot/product/category/index.vue +++ b/src/views/iot/product/category/index.vue @@ -118,7 +118,6 @@ const queryParams = reactive({ createTime: [] }) const queryFormRef = ref() // 搜索的表单 -const exportLoading = ref(false) // 导出的加载中 /** 查询列表 */ const getList = async () => { diff --git a/src/views/iot/utils/constants.ts b/src/views/iot/utils/constants.ts index 5daadca66..a14e58e9d 100644 --- a/src/views/iot/utils/constants.ts +++ b/src/views/iot/utils/constants.ts @@ -166,8 +166,8 @@ export const IoTOtaTaskStatusEnum = { label: '进行中', value: 10 }, - COMPLETED: { - label: '已完成', + END: { + label: '已结束', value: 20 }, CANCELED: {