From 7be9c3e80e734222d48a348688e3d0b425cd908a Mon Sep 17 00:00:00 2001 From: YunaiV Date: Fri, 31 Jan 2025 22:47:11 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E4=BB=A3=E7=A0=81=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E3=80=91IoT=EF=BC=9A=E5=8E=BB=E9=99=A4=20Simulation=20?= =?UTF-8?q?=E5=85=B3=E9=94=AE=E5=AD=97=EF=BC=8C=E5=AE=9A=E4=B9=89=E6=9B=B4?= =?UTF-8?q?=E6=B8=85=E6=99=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/iot/device/device/index.ts | 20 +++++++++---------- .../device/detail/DeviceDetailsSimulator.vue | 12 +++-------- 2 files changed, 13 insertions(+), 19 deletions(-) diff --git a/src/api/iot/device/device/index.ts b/src/api/iot/device/device/index.ts index 0989a4c2..f44786b5 100644 --- a/src/api/iot/device/device/index.ts +++ b/src/api/iot/device/device/index.ts @@ -56,16 +56,16 @@ export enum DeviceStateEnum { OFFLINE = 2 // 离线 } -// IoT 模拟设备上行数据 Request VO -export interface IotDeviceSimulationUpstreamReqVO { +// IoT 设备上行 Request VO +export interface IotDeviceUpstreamReqVO { id: number // 设备编号 type: string // 消息类型 identifier: string // 标识符 data: any // 请求参数 } -// IoT 模拟设备下行数据 Request VO -export interface IotDeviceSimulationDownstreamReqVO { +// IoT 设备下行 Request VO +export interface IotDeviceDownstreamReqVO { id: number // 设备编号 type: string // 消息类型 identifier: string // 标识符 @@ -129,14 +129,14 @@ export const DeviceApi = { return await request.download({ url: `/iot/device/get-import-template` }) }, - // 模拟设备上行 - simulationDeviceUpstream: async (data: IotDeviceSimulationUpstreamReqVO) => { - return await request.post({ url: `/iot/device/simulation-upstream`, data }) + // 设备上行 + upstreamDevice: async (data: IotDeviceUpstreamReqVO) => { + return await request.post({ url: `/iot/device/upstream`, data }) }, - // 模拟设备下行 - simulationDeviceDownstream: async (data: IotDeviceSimulationDownstreamReqVO) => { - return await request.post({ url: `/iot/device/simulation-downstream`, data }) + // 设备下行 + downstreamDevice: async (data: IotDeviceDownstreamReqVO) => { + return await request.post({ url: `/iot/device/downstream`, data }) }, // 获取设备属性最新数据 diff --git a/src/views/iot/device/device/detail/DeviceDetailsSimulator.vue b/src/views/iot/device/device/detail/DeviceDetailsSimulator.vue index f4a42753..ecf704af 100644 --- a/src/views/iot/device/device/detail/DeviceDetailsSimulator.vue +++ b/src/views/iot/device/device/detail/DeviceDetailsSimulator.vue @@ -100,13 +100,7 @@
- - 发送 - + 发送
@@ -331,7 +325,7 @@ const handlePropertyReport = async () => { }) try { - await DeviceApi.simulationDeviceUpstream({ + await DeviceApi.upstreamDevice({ id: props.device.id, type: 'property', identifier: 'report', @@ -375,7 +369,7 @@ const handlePropertyReport = async () => { /** 处理设备状态 */ const handleDeviceState = async (state: number) => { try { - await DeviceApi.simulationDeviceUpstream({ + await DeviceApi.upstreamDevice({ id: props.device.id, type: 'state', identifier: 'report',