From 9ea45b3d1421a5cbaf7fdee7b33c7d37a5624fbc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AE=89=E6=B5=A9=E6=B5=A9?= <1036606149@qq.com> Date: Sun, 3 Nov 2024 00:15:44 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E6=96=B0=E5=A2=9E=E5=8A=9F=E8=83=BD?= =?UTF-8?q?=E3=80=91IOT=EF=BC=9A=E8=AE=BE=E5=A4=87=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E5=B1=95=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/iot/device/index.ts | 18 +++ src/api/iot/product/index.ts | 8 +- .../iot/device/detail/DeviceDataDetail.vue | 28 ++++ .../iot/device/detail/DeviceDetailsModel.vue | 132 ++++++++++++++++++ src/views/iot/device/detail/index.vue | 10 +- src/views/iot/product/ProductForm.vue | 2 - .../iot/product/detail/ThinkModelFunction.vue | 2 + .../product/detail/ThinkModelFunctionForm.vue | 6 +- 8 files changed, 198 insertions(+), 8 deletions(-) create mode 100644 src/views/iot/device/detail/DeviceDataDetail.vue create mode 100644 src/views/iot/device/detail/DeviceDetailsModel.vue diff --git a/src/api/iot/device/index.ts b/src/api/iot/device/index.ts index 903874b7..9bc82c4f 100644 --- a/src/api/iot/device/index.ts +++ b/src/api/iot/device/index.ts @@ -35,6 +35,19 @@ export interface DeviceUpdateStatusVO { status: number // 设备状态 } +// IoT 设备数据 VO +export interface DeviceDataVO { + deviceId: number // 设备编号 + thinkModelFunctionId: number // 物模型编号 + productKey: string // 产品标识 + deviceName: string // 设备名称 + identifier: string // 属性标识符 + name: string // 属性名称 + dataType: string // 数据类型 + updateTime: Date // 更新时间 + value: string // 最新值 +} + // 设备 API export const DeviceApi = { // 查询设备分页 @@ -70,5 +83,10 @@ export const DeviceApi = { // 获取设备数量 getDeviceCount: async (productId: number) => { return await request.get({ url: `/iot/device/count?productId=` + productId }) + }, + + // 获取设备属性最新数据 + getDevicePropertiesLatestData: async (params: any) => { + return await request.get({ url: `/iot/device/data/latest-data`, params }) } } diff --git a/src/api/iot/product/index.ts b/src/api/iot/product/index.ts index 19c827cf..047dc716 100644 --- a/src/api/iot/product/index.ts +++ b/src/api/iot/product/index.ts @@ -23,6 +23,12 @@ export enum ValidateTypeEnum { WEAK = 0, // 弱校验 NONE = 1 // 免校验 } +// IOT 产品设备类型枚举类 0: 直连设备, 1: 网关子设备, 2: 网关设备 +export enum DeviceTypeEnum { + DEVICE = 0, // 直连设备 + GATEWAY_SUB = 1, // 网关子设备 + GATEWAY = 2 // 网关设备 +} // IoT 产品 API export const ProductApi = { @@ -63,6 +69,6 @@ export const ProductApi = { // 查询产品(精简)列表 getSimpleProductList() { - return request.get({ url: '/iot/product/list-all-simple' }) + return request.get({ url: '/iot/product/simple-list' }) } } diff --git a/src/views/iot/device/detail/DeviceDataDetail.vue b/src/views/iot/device/detail/DeviceDataDetail.vue new file mode 100644 index 00000000..b4df6484 --- /dev/null +++ b/src/views/iot/device/detail/DeviceDataDetail.vue @@ -0,0 +1,28 @@ + + diff --git a/src/views/iot/device/detail/DeviceDetailsModel.vue b/src/views/iot/device/detail/DeviceDetailsModel.vue new file mode 100644 index 00000000..40c1a89a --- /dev/null +++ b/src/views/iot/device/detail/DeviceDetailsModel.vue @@ -0,0 +1,132 @@ + + diff --git a/src/views/iot/device/detail/index.vue b/src/views/iot/device/detail/index.vue index 2db16bbc..be6eec79 100644 --- a/src/views/iot/device/detail/index.vue +++ b/src/views/iot/device/detail/index.vue @@ -11,17 +11,21 @@ - - + + + + + \ No newline at end of file +