diff --git a/src/api/iot/device/device/index.ts b/src/api/iot/device/device/index.ts index ec80bfab..5377203b 100644 --- a/src/api/iot/device/device/index.ts +++ b/src/api/iot/device/device/index.ts @@ -63,6 +63,16 @@ export enum DeviceStatusEnum { DISABLED = 3 // 已禁用 } +// IoT 模拟设备数据 +export interface SimulatorDataVO { + productKey: string + deviceKey: string + type: string + subType: string + reportTime: string + content: string // 存储 JSON 字符串 +} + // 设备 API export const DeviceApi = { // 查询设备分页 @@ -136,5 +146,10 @@ export const DeviceApi = { // 获取导入模板 importDeviceTemplate: async () => { return await request.download({ url: `/iot/device/get-import-template` }) + }, + + // 模拟设备 + simulatorDevice: async (data: SimulatorDataVO) => { + return await request.post({ url: `/iot/device/data/simulator`, data }) } } diff --git a/src/views/iot/device/device/detail/DeviceDetailsLog.vue b/src/views/iot/device/device/detail/DeviceDetailsLog.vue index 280092a7..d0a43a5c 100644 --- a/src/views/iot/device/device/detail/DeviceDetailsLog.vue +++ b/src/views/iot/device/device/detail/DeviceDetailsLog.vue @@ -90,23 +90,23 @@ const typeMap = { /** 查询日志列表 */ const getLogList = async () => { - if (!props.deviceId) return - loading.value = true - try { - const res = await DeviceApi.getDeviceLogs(props.deviceId, queryParams) - total.value = res.total - logList.value = res.list.map((item: any) => { - const log = { - time: item.time, - type: typeMap[item.type as keyof typeof typeMap] || item.type, - name: getLogName(item), - content: item.content - } - return log - }) - } finally { - loading.value = false - } + // if (!props.deviceId) return + // loading.value = true + // try { + // const res = await DeviceApi.getDeviceLogs(props.deviceId, queryParams) + // total.value = res.total + // logList.value = res.list.map((item: any) => { + // const log = { + // time: item.time, + // type: typeMap[item.type as keyof typeof typeMap] || item.type, + // name: getLogName(item), + // content: item.content + // } + // return log + // }) + // } finally { + // loading.value = false + // } } /** 获取日志名称 */ diff --git a/src/views/iot/device/device/detail/DeviceDetailsSimulator.vue b/src/views/iot/device/device/detail/DeviceDetailsSimulator.vue index 972cb8eb..bc16d69f 100644 --- a/src/views/iot/device/device/detail/DeviceDetailsSimulator.vue +++ b/src/views/iot/device/device/detail/DeviceDetailsSimulator.vue @@ -11,11 +11,6 @@ - - - @@ -87,6 +82,11 @@ + + +
发送 @@ -98,11 +98,6 @@ - - - @@ -112,6 +107,11 @@ prop="specs" :show-overflow-tooltip="true" /> + + +
发送 @@ -142,11 +142,6 @@ - - - @@ -156,6 +151,11 @@ prop="specs" :show-overflow-tooltip="true" /> + + +
获取 @@ -189,7 +189,7 @@