diff --git a/src/api/iot/device/index.ts b/src/api/iot/device/index.ts
new file mode 100644
index 00000000..4ee6d8d9
--- /dev/null
+++ b/src/api/iot/device/index.ts
@@ -0,0 +1,63 @@
+import request from '@/config/axios'
+
+// IoT 设备 VO
+export interface DeviceVO {
+ id: number // 设备 ID,主键,自增
+ deviceKey: string // 设备唯一标识符,全局唯一,用于识别设备
+ deviceName: string // 设备名称,在产品内唯一,用于标识设备
+ productId: number // 产品 ID,关联 iot_product 表的 id
+ productKey: string // 产品 Key,关联 iot_product 表的 product_key
+ deviceType: number // 设备类型:0 - 直连设备,1 - 网关子设备,2 - 网关设备
+ nickname: string // 设备备注名称,供用户自定义备注
+ gatewayId: number // 网关设备 ID,子设备需要关联的网关设备 ID
+ status: number // 设备状态:0 - 未激活,1 - 在线,2 - 离线,3 - 已禁用
+ statusLastUpdateTime: Date // 设备状态最后更新时间
+ lastOnlineTime: Date // 最后上线时间
+ lastOfflineTime: Date // 最后离线时间
+ activeTime: Date // 设备激活时间
+ ip: string // 设备的 IP 地址
+ firmwareVersion: string // 设备的固件版本
+ deviceSecret: string // 设备密钥,用于设备认证,需安全存储
+ mqttClientId: string // MQTT 客户端 ID
+ mqttUsername: string // MQTT 用户名
+ mqttPassword: string // MQTT 密码
+ authType: string // 认证类型(如一机一密、动态注册)
+ latitude: number // 设备位置的纬度,范围 -90.000000 ~ 90.000000
+ longitude: number // 设备位置的经度,范围 -180.000000 ~ 180.000000
+ areaId: number // 地区编码,符合国家地区编码标准,关联地区表
+ address: string // 设备详细地址
+ serialNumber: string // 设备序列号
+}
+
+// IoT 设备 API
+export const DeviceApi = {
+ // 查询IoT 设备分页
+ getDevicePage: async (params: any) => {
+ return await request.get({ url: `/iot/device/page`, params })
+ },
+
+ // 查询IoT 设备详情
+ getDevice: async (id: number) => {
+ return await request.get({ url: `/iot/device/get?id=` + id })
+ },
+
+ // 新增IoT 设备
+ createDevice: async (data: DeviceVO) => {
+ return await request.post({ url: `/iot/device/create`, data })
+ },
+
+ // 修改IoT 设备
+ updateDevice: async (data: DeviceVO) => {
+ return await request.put({ url: `/iot/device/update`, data })
+ },
+
+ // 删除IoT 设备
+ deleteDevice: async (id: number) => {
+ return await request.delete({ url: `/iot/device/delete?id=` + id })
+ },
+
+ // 导出IoT 设备 Excel
+ exportDevice: async (params) => {
+ return await request.download({ url: `/iot/device/export-excel`, params })
+ }
+}
\ No newline at end of file
diff --git a/src/api/iot/product/index.ts b/src/api/iot/product/index.ts
index 1bc45b9e..d4de1e5b 100644
--- a/src/api/iot/product/index.ts
+++ b/src/api/iot/product/index.ts
@@ -51,5 +51,10 @@ export const ProductApi = {
// 更新产品状态
updateProductStatus: async (id: number, status: number) => {
return await request.put({ url: `/iot/product/update-status?id=` + id + `&status=` + status })
+ },
+
+ // 查询产品(精简)列表
+ getSimpleProductList() {
+ return request.get({ url: '/iot/product/list-all-simple' })
}
}
diff --git a/src/router/modules/remaining.ts b/src/router/modules/remaining.ts
index 0a156539..4595d563 100644
--- a/src/router/modules/remaining.ts
+++ b/src/router/modules/remaining.ts
@@ -614,7 +614,7 @@ const remainingRouter: AppRouteRecordRaw[] = [
children: [
{
path: 'product/detail/:id',
- name: 'IotProductDetail',
+ name: 'IoTProductDetail',
meta: {
title: '产品详情',
noCache: true,
diff --git a/src/utils/dict.ts b/src/utils/dict.ts
index 4a8c017c..82f9218f 100644
--- a/src/utils/dict.ts
+++ b/src/utils/dict.ts
@@ -234,5 +234,6 @@ export enum DICT_TYPE {
IOT_PRODUCT_STATUS = 'iot_product_status', // IOT 产品状态
IOT_PRODUCT_DEVICE_TYPE = 'iot_product_device_type', // IOT 产品设备类型
IOT_DATA_FORMAT = 'iot_data_format', // IOT 数据格式
- IOT_PROTOCOL_TYPE = 'iot_protocol_type' // IOT 接入网关协议
+ IOT_PROTOCOL_TYPE = 'iot_protocol_type', // IOT 接入网关协议
+ IOT_DEVICE_STATUS = 'iot_device_status' // IOT 设备状态
}
diff --git a/src/views/iot/device/DeviceForm.vue b/src/views/iot/device/DeviceForm.vue
new file mode 100644
index 00000000..a77045c9
--- /dev/null
+++ b/src/views/iot/device/DeviceForm.vue
@@ -0,0 +1,121 @@
+
+
+
+
diff --git a/src/views/iot/device/index.vue b/src/views/iot/device/index.vue
new file mode 100644
index 00000000..e50819bd
--- /dev/null
+++ b/src/views/iot/device/index.vue
@@ -0,0 +1,276 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 搜索
+ 重置
+
+ 新增
+
+
+ 导出
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 编辑
+
+
+ 删除
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/views/iot/product/ProductForm.vue b/src/views/iot/product/ProductForm.vue
index 21cee6c3..7d254a03 100644
--- a/src/views/iot/product/ProductForm.vue
+++ b/src/views/iot/product/ProductForm.vue
@@ -103,7 +103,7 @@
import { ProductApi, ProductVO } from '@/api/iot/product'
import { DICT_TYPE, getIntDictOptions } from '@/utils/dict'
-defineOptions({ name: 'ProductForm' })
+defineOptions({ name: 'IoTProductForm' })
const { t } = useI18n()
const message = useMessage()
diff --git a/src/views/iot/product/detail/index.vue b/src/views/iot/product/detail/index.vue
index 8652e240..c77fe176 100644
--- a/src/views/iot/product/detail/index.vue
+++ b/src/views/iot/product/detail/index.vue
@@ -20,7 +20,7 @@ import { ProductApi, ProductVO } from '@/api/iot/product'
import ProductDetailsHeader from '@/views/iot/product/detail/ProductDetailsHeader.vue'
import ProductDetailsInfo from '@/views/iot/product/detail/ProductDetailsInfo.vue'
-defineOptions({ name: 'IotProductDetail' })
+defineOptions({ name: 'IoTProductDetail' })
const route = useRoute()
const message = useMessage()
diff --git a/src/views/iot/product/index.vue b/src/views/iot/product/index.vue
index a1f5ae4a..d3196ac4 100644
--- a/src/views/iot/product/index.vue
+++ b/src/views/iot/product/index.vue
@@ -44,7 +44,11 @@
-
+
+
+ {{ scope.row.name }}
+
+
@@ -106,7 +110,7 @@ import ProductForm from './ProductForm.vue'
import { DICT_TYPE } from '@/utils/dict'
/** iot 产品 列表 */
-defineOptions({ name: 'Product' })
+defineOptions({ name: 'IoTProduct' })
const message = useMessage() // 消息弹窗
const { t } = useI18n() // 国际化
@@ -166,7 +170,7 @@ const openForm = (type: string, id?: number) => {
/** 打开详情 */
const { currentRoute, push } = useRouter()
const openDetail = (id: number) => {
- push({ name: 'IotProductDetail', params: { id } })
+ push({ name: 'IoTProductDetail', params: { id } })
}
/** 删除按钮操作 */