Skip to content

Commit 53d1cb8

Browse files
YunaiVgitee-org
authored andcommitted
!542 IOT client 同步
Merge pull request !542 from 芋道源码/feature/iot
2 parents 9394a7c + 6d64117 commit 53d1cb8

File tree

18 files changed

+2173
-1
lines changed

18 files changed

+2173
-1
lines changed

src/api/iot/device/index.ts

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
import request from '@/config/axios'
2+
3+
// IoT 设备 VO
4+
export interface DeviceVO {
5+
id: number // 设备 ID,主键,自增
6+
deviceKey: string // 设备唯一标识符
7+
deviceName: string // 设备名称
8+
productId: number // 产品编号
9+
productKey: string // 产品标识
10+
deviceType: number // 设备类型
11+
nickname: string // 设备备注名称
12+
gatewayId: number // 网关设备 ID
13+
status: number // 设备状态
14+
statusLastUpdateTime: Date // 设备状态最后更新时间
15+
lastOnlineTime: Date // 最后上线时间
16+
lastOfflineTime: Date // 最后离线时间
17+
activeTime: Date // 设备激活时间
18+
createTime: Date // 创建时间
19+
ip: string // 设备的 IP 地址
20+
firmwareVersion: string // 设备的固件版本
21+
deviceSecret: string // 设备密钥,用于设备认证,需安全存储
22+
mqttClientId: string // MQTT 客户端 ID
23+
mqttUsername: string // MQTT 用户名
24+
mqttPassword: string // MQTT 密码
25+
authType: string // 认证类型
26+
latitude: number // 设备位置的纬度
27+
longitude: number // 设备位置的经度
28+
areaId: number // 地区编码
29+
address: string // 设备详细地址
30+
serialNumber: string // 设备序列号
31+
}
32+
33+
export interface DeviceUpdateStatusVO {
34+
id: number // 设备 ID,主键,自增
35+
status: number // 设备状态
36+
}
37+
38+
// 设备 API
39+
export const DeviceApi = {
40+
// 查询设备分页
41+
getDevicePage: async (params: any) => {
42+
return await request.get({ url: `/iot/device/page`, params })
43+
},
44+
45+
// 查询设备详情
46+
getDevice: async (id: number) => {
47+
return await request.get({ url: `/iot/device/get?id=` + id })
48+
},
49+
50+
// 新增设备
51+
createDevice: async (data: DeviceVO) => {
52+
return await request.post({ url: `/iot/device/create`, data })
53+
},
54+
55+
// 修改设备
56+
updateDevice: async (data: DeviceVO) => {
57+
return await request.put({ url: `/iot/device/update`, data })
58+
},
59+
60+
// 修改设备状态
61+
updateDeviceStatus: async (data: DeviceUpdateStatusVO) => {
62+
return await request.put({ url: `/iot/device/update-status`, data })
63+
},
64+
65+
// 删除设备
66+
deleteDevice: async (id: number) => {
67+
return await request.delete({ url: `/iot/device/delete?id=` + id })
68+
},
69+
70+
// 获取设备数量
71+
getDeviceCount: async (productId: number) => {
72+
return await request.get({ url: `/iot/device/count?productId=` + productId })
73+
}
74+
}

src/api/iot/product/index.ts

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
import request from '@/config/axios'
2+
3+
// IoT 产品 VO
4+
export interface ProductVO {
5+
id: number // 产品编号
6+
name: string // 产品名称
7+
productKey: string // 产品标识
8+
protocolId: number // 协议编号
9+
categoryId: number // 产品所属品类标识符
10+
description: string // 产品描述
11+
validateType: number // 数据校验级别
12+
status: number // 产品状态
13+
deviceType: number // 设备类型
14+
netType: number // 联网方式
15+
protocolType: number // 接入网关协议
16+
dataFormat: number // 数据格式
17+
deviceCount: number // 设备数量
18+
createTime: Date // 创建时间
19+
}
20+
21+
// IoT 产品 API
22+
export const ProductApi = {
23+
// 查询产品分页
24+
getProductPage: async (params: any) => {
25+
return await request.get({ url: `/iot/product/page`, params })
26+
},
27+
28+
// 查询产品详情
29+
getProduct: async (id: number) => {
30+
return await request.get({ url: `/iot/product/get?id=` + id })
31+
},
32+
33+
// 新增产品
34+
createProduct: async (data: ProductVO) => {
35+
return await request.post({ url: `/iot/product/create`, data })
36+
},
37+
38+
// 修改产品
39+
updateProduct: async (data: ProductVO) => {
40+
return await request.put({ url: `/iot/product/update`, data })
41+
},
42+
43+
// 删除产品
44+
deleteProduct: async (id: number) => {
45+
return await request.delete({ url: `/iot/product/delete?id=` + id })
46+
},
47+
48+
// 导出产品 Excel
49+
exportProduct: async (params) => {
50+
return await request.download({ url: `/iot/product/export-excel`, params })
51+
},
52+
53+
// 更新产品状态
54+
updateProductStatus: async (id: number, status: number) => {
55+
return await request.put({ url: `/iot/product/update-status?id=` + id + `&status=` + status })
56+
},
57+
58+
// 查询产品(精简)列表
59+
getSimpleProductList() {
60+
return request.get({ url: '/iot/product/list-all-simple' })
61+
}
62+
}
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
import request from '@/config/axios'
2+
3+
// IoT 产品物模型 VO
4+
export interface ThinkModelFunctionVO {
5+
id: number // 物模型功能编号
6+
identifier: string // 功能标识
7+
name: string // 功能名称
8+
description: string // 功能描述
9+
productId: number // 产品编号
10+
productKey: string // 产品标识
11+
type: number // 功能类型
12+
property: string // 属性
13+
event: string // 事件
14+
service: string // 服务
15+
}
16+
17+
// IoT 产品物模型 API
18+
export const ThinkModelFunctionApi = {
19+
// 查询产品物模型分页
20+
getThinkModelFunctionPage: async (params: any) => {
21+
return await request.get({ url: `/iot/think-model-function/page`, params })
22+
},
23+
// 获得产品物模型
24+
getThinkModelFunctionListByProductId: async (params: any) => {
25+
return await request.get({
26+
url: `/iot/think-model-function/list-by-product-id`,
27+
params
28+
})
29+
},
30+
31+
// 查询产品物模型详情
32+
getThinkModelFunction: async (id: number) => {
33+
return await request.get({ url: `/iot/think-model-function/get?id=` + id })
34+
},
35+
36+
// 新增产品物模型
37+
createThinkModelFunction: async (data: ThinkModelFunctionVO) => {
38+
return await request.post({ url: `/iot/think-model-function/create`, data })
39+
},
40+
41+
// 修改产品物模型
42+
updateThinkModelFunction: async (data: ThinkModelFunctionVO) => {
43+
return await request.put({ url: `/iot/think-model-function/update`, data })
44+
},
45+
46+
// 删除产品物模型
47+
deleteThinkModelFunction: async (id: number) => {
48+
return await request.delete({ url: `/iot/think-model-function/delete?id=` + id })
49+
},
50+
51+
// 导出产品物模型 Excel
52+
exportThinkModelFunction: async (params) => {
53+
return await request.download({ url: `/iot/think-model-function/export-excel`, params })
54+
}
55+
}

src/router/modules/remaining.ts

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -603,6 +603,38 @@ const remainingRouter: AppRouteRecordRaw[] = [
603603
hidden: true,
604604
breadcrumb: false
605605
}
606+
},
607+
{
608+
path: '/iot',
609+
component: Layout,
610+
name: 'IOT',
611+
meta: {
612+
hidden: true
613+
},
614+
children: [
615+
{
616+
path: 'product/detail/:id',
617+
name: 'IoTProductDetail',
618+
meta: {
619+
title: '产品详情',
620+
noCache: true,
621+
hidden: true,
622+
activeMenu: '/iot/product'
623+
},
624+
component: () => import('@/views/iot/product/detail/index.vue')
625+
},
626+
{
627+
path: 'device/detail/:id',
628+
name: 'IoTDeviceDetail',
629+
meta: {
630+
title: '设备详情',
631+
noCache: true,
632+
hidden: true,
633+
activeMenu: '/iot/device'
634+
},
635+
component: () => import('@/views/iot/device/detail/index.vue')
636+
}
637+
]
606638
}
607639
]
608640

src/utils/dict.ts

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,5 +225,18 @@ export enum DICT_TYPE {
225225
AI_WRITE_LENGTH = 'ai_write_length', // AI 写作长度
226226
AI_WRITE_FORMAT = 'ai_write_format', // AI 写作格式
227227
AI_WRITE_TONE = 'ai_write_tone', // AI 写作语气
228-
AI_WRITE_LANGUAGE = 'ai_write_language' // AI 写作语言
228+
AI_WRITE_LANGUAGE = 'ai_write_language', // AI 写作语言
229+
230+
// ========== IOT - 物联网模块 ==========
231+
IOT_NET_TYPE = 'iot_net_type', // IOT 联网方式
232+
IOT_VALIDATE_TYPE = 'iot_validate_type', // IOT 数据校验级别
233+
IOT_PRODUCT_STATUS = 'iot_product_status', // IOT 产品状态
234+
IOT_PRODUCT_DEVICE_TYPE = 'iot_product_device_type', // IOT 产品设备类型
235+
IOT_DATA_FORMAT = 'iot_data_format', // IOT 数据格式
236+
IOT_PROTOCOL_TYPE = 'iot_protocol_type', // IOT 接入网关协议
237+
IOT_DEVICE_STATUS = 'iot_device_status', // IOT 设备状态
238+
IOT_PRODUCT_FUNCTION_TYPE = 'iot_product_function_type', // IOT 产品功能类型
239+
IOT_DATA_TYPE = 'iot_data_type', // IOT 数据类型
240+
IOT_UNIT_TYPE = 'iot_unit_type', // IOT 单位类型
241+
IOT_RW_TYPE = 'iot_rw_type' // IOT 读写类型
229242
}

0 commit comments

Comments
 (0)