diff --git a/src/api/iot/device/device/index.ts b/src/api/iot/device/device/index.ts index efc3bfe3..27e9cd23 100644 --- a/src/api/iot/device/device/index.ts +++ b/src/api/iot/device/device/index.ts @@ -118,8 +118,13 @@ export const DeviceApi = { }, // 获取设备的精简信息列表 - getSimpleDeviceList: async (deviceType?: number) => { - return await request.get({ url: `/iot/device/simple-list?`, params: { deviceType } }) + getSimpleDeviceList: async (deviceType?: number, productId?: number) => { + return await request.get({ url: `/iot/device/simple-list?`, params: { deviceType, productId } }) + }, + + // 根据产品编号,获取设备的精简信息列表 + getDeviceListByProductId: async (productId: number) => { + return await request.get({ url: `/iot/device/simple-list?`, params: { productId } }) }, // 获取导入模板 diff --git a/src/api/iot/ota/task/index.ts b/src/api/iot/ota/task/index.ts index 22f0e7c8..66e2e9bd 100644 --- a/src/api/iot/ota/task/index.ts +++ b/src/api/iot/ota/task/index.ts @@ -8,6 +8,7 @@ export interface OtaTask { firmwareId?: number // 固件编号 status?: number // 任务状态 deviceScope?: number // 升级范围 + deviceIds?: number[] // 指定设备ID列表(当升级范围为指定设备时使用) deviceTotalCount?: number // 设备总共数量 deviceSuccessCount?: number // 设备成功数量 createTime?: string // 创建时间 diff --git a/src/utils/dict.ts b/src/utils/dict.ts index cc14074f..0daad8ed 100644 --- a/src/utils/dict.ts +++ b/src/utils/dict.ts @@ -243,5 +243,6 @@ export enum DICT_TYPE { IOT_ALERT_LEVEL = 'iot_alert_level', // IoT 告警级别 IOT_ALERT_RECEIVE_TYPE = 'iot_alert_receive_type', // IoT 告警接收类型 IOT_OTA_TASK_DEVICE_SCOPE = 'iot_ota_task_device_scope', // IoT OTA任务设备范围 - IOT_OTA_TASK_STATUS = 'iot_ota_task_status' // IoT OTA任务状态 + IOT_OTA_TASK_STATUS = 'iot_ota_task_status', // IoT OTA 任务状态 + IOT_OTA_RECORD_STATUS = 'iot_ota_record_status' // IoT OTA 记录状态 } diff --git a/src/views/iot/ota/firmware/detail/index.vue b/src/views/iot/ota/firmware/detail/index.vue index 23c613b2..fea514f8 100644 --- a/src/views/iot/ota/firmware/detail/index.vue +++ b/src/views/iot/ota/firmware/detail/index.vue @@ -21,8 +21,8 @@ - - + +
@@ -86,7 +86,11 @@ - +
diff --git a/src/views/iot/ota/task/OtaTaskDetail.vue b/src/views/iot/ota/task/OtaTaskDetail.vue new file mode 100644 index 00000000..e0e5637b --- /dev/null +++ b/src/views/iot/ota/task/OtaTaskDetail.vue @@ -0,0 +1,347 @@ + + + diff --git a/src/views/iot/ota/task/OtaTaskForm.vue b/src/views/iot/ota/task/OtaTaskForm.vue index 79cd3b69..6fde972b 100644 --- a/src/views/iot/ota/task/OtaTaskForm.vue +++ b/src/views/iot/ota/task/OtaTaskForm.vue @@ -1,9 +1,23 @@ @@ -33,79 +62,71 @@ diff --git a/src/views/iot/ota/task/OtaTaskList.vue b/src/views/iot/ota/task/OtaTaskList.vue index 448e3eb9..d2898fa7 100644 --- a/src/views/iot/ota/task/OtaTaskList.vue +++ b/src/views/iot/ota/task/OtaTaskList.vue @@ -1,5 +1,5 @@ - + + @@ -90,12 +101,18 @@ import { IoTOtaTaskApi, OtaTask } from '@/api/iot/ota/task' import { DICT_TYPE } from '@/utils/dict' import { IoTOtaTaskStatusEnum } from '@/views/iot/utils/constants' import OtaTaskForm from './OtaTaskForm.vue' +import OtaTaskDetail from './OtaTaskDetail.vue' /** IoT OTA 任务列表 */ defineOptions({ name: 'OtaTaskList' }) const props = defineProps<{ firmwareId: number + productId?: number +}>() + +const emit = defineEmits<{ + success: [] }>() const message = useMessage() // 消息弹窗 @@ -110,10 +127,9 @@ const queryParams = reactive({ name: '', firmwareId: props.firmwareId }) -const queryFormRef = ref() - -// 任务表单引用 -const taskFormRef = ref() +const queryFormRef = ref() // 查询表单引用 +const taskFormRef = ref() // 任务表单引用 +const taskDetailRef = ref() // 任务详情引用 /** 获取任务列表 */ const getTaskList = async () => { @@ -138,6 +154,19 @@ const openTaskForm = () => { taskFormRef.value?.open() } +/** 处理任务创建成功 */ +const handleTaskSuccess = () => { + getTaskList() + emit('success') +} + +/** 查看任务详情 */ +const handleViewDetail = (id: number | undefined) => { + if (id) { + taskDetailRef.value?.open(id) + } +} + /** 取消任务 */ const handleCancelTask = async (id: number) => { try { diff --git a/src/views/iot/utils/constants.ts b/src/views/iot/utils/constants.ts index 08bd6eaf..5daadca6 100644 --- a/src/views/iot/utils/constants.ts +++ b/src/views/iot/utils/constants.ts @@ -154,7 +154,7 @@ export const IoTOtaTaskDeviceScopeEnum = { label: '全部设备', value: 1 }, - SPECIFIC: { + SELECT: { label: '指定设备', value: 2 }