From c7907d0d7338d8d738dc3b595f7ac089de6845bd Mon Sep 17 00:00:00 2001 From: YunaiV Date: Wed, 21 Jan 2026 13:41:21 +0800 Subject: [PATCH] =?UTF-8?q?feat(iot):=E3=80=90=E8=AE=BE=E5=A4=87=E5=AE=9A?= =?UTF-8?q?=E4=BD=8D=EF=BC=9A100%=E3=80=91=E9=A6=96=E9=A1=B5=E6=8E=A5?= =?UTF-8?q?=E5=85=A5=E5=9C=B0=E5=9B=BE=EF=BC=8C=E5=9F=BA=E4=BA=8E=20sequen?= =?UTF-8?q?tial-crafting-thacker.md=20=E8=A7=84=E5=88=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/iot/device/device/index.ts | 6 + src/api/iot/statistics/index.ts | 23 ++- src/components/Map/index.ts | 1 + src/components/Map/src/MapDialog.vue | 42 +--- src/components/Map/src/utils.ts | 62 ++++++ .../iot/home/components/DeviceMapCard.vue | 187 ++++++++++++++++++ src/views/iot/home/index.vue | 12 +- 7 files changed, 280 insertions(+), 53 deletions(-) create mode 100644 src/components/Map/src/utils.ts create mode 100644 src/views/iot/home/components/DeviceMapCard.vue diff --git a/src/api/iot/device/device/index.ts b/src/api/iot/device/device/index.ts index ab6a09a3..1804628c 100644 --- a/src/api/iot/device/device/index.ts +++ b/src/api/iot/device/device/index.ts @@ -5,6 +5,7 @@ export interface DeviceVO { id: number // 设备 ID,主键,自增 deviceName: string // 设备名称 productId: number // 产品编号 + productName?: string // 产品名称(只有部分接口返回,例如 getDeviceLocationList) productKey: string // 产品标识 deviceType: number // 设备类型 nickname: string // 设备备注名称 @@ -114,6 +115,11 @@ export const DeviceApi = { return await request.get({ url: `/iot/device/simple-list?`, params: { deviceType, productId } }) }, + // 获取设备位置列表(用于地图展示) + getDeviceLocationList: async () => { + return await request.get({ url: `/iot/device/location-list` }) + }, + // 根据产品编号,获取设备的精简信息列表 getDeviceListByProductId: async (productId: number) => { return await request.get({ url: `/iot/device/simple-list?`, params: { productId } }) diff --git a/src/api/iot/statistics/index.ts b/src/api/iot/statistics/index.ts index cdcb94d2..30360785 100644 --- a/src/api/iot/statistics/index.ts +++ b/src/api/iot/statistics/index.ts @@ -16,18 +16,6 @@ export interface IotStatisticsSummaryRespVO { productCategoryDeviceCounts: Record } -/** 时间戳-数值的键值对类型 */ -interface TimeValueItem { - [key: string]: number -} - -/** IoT 消息统计数据类型 */ -export interface IotStatisticsDeviceMessageSummaryRespVO { - statType: number - upstreamCounts: TimeValueItem[] - downstreamCounts: TimeValueItem[] -} - /** 新的消息统计数据项 */ export interface IotStatisticsDeviceMessageSummaryByDateRespVO { time: string @@ -41,6 +29,17 @@ export interface IotStatisticsDeviceMessageReqVO { times?: string[] } +/** 设备位置数据 VO */ +export interface DeviceLocationRespVO { + id: number + deviceName: string + nickname?: string + productName?: string + state: number + longitude: number + latitude: number +} + // IoT 数据统计 API export const StatisticsApi = { // 查询全局的数据统计 diff --git a/src/components/Map/index.ts b/src/components/Map/index.ts index 27b9675b..3ac8c7bc 100644 --- a/src/components/Map/index.ts +++ b/src/components/Map/index.ts @@ -1,3 +1,4 @@ import MapDialog from './src/MapDialog.vue' +export { loadBaiduMapSdk } from './src/utils' export { MapDialog } diff --git a/src/components/Map/src/MapDialog.vue b/src/components/Map/src/MapDialog.vue index 0f93c4d5..9b6ecdce 100644 --- a/src/components/Map/src/MapDialog.vue +++ b/src/components/Map/src/MapDialog.vue @@ -57,14 +57,7 @@ diff --git a/src/views/iot/home/index.vue b/src/views/iot/home/index.vue index 3d60acef..6ff2d3b7 100644 --- a/src/views/iot/home/index.vue +++ b/src/views/iot/home/index.vue @@ -54,13 +54,18 @@ - + - + + + + + +