diff --git a/src/api/iot/device/index.ts b/src/api/iot/device/index.ts new file mode 100644 index 00000000..903874b7 --- /dev/null +++ b/src/api/iot/device/index.ts @@ -0,0 +1,74 @@ +import request from '@/config/axios' + +// IoT 设备 VO +export interface DeviceVO { + id: number // 设备 ID,主键,自增 + deviceKey: string // 设备唯一标识符 + deviceName: string // 设备名称 + productId: number // 产品编号 + productKey: string // 产品标识 + deviceType: number // 设备类型 + nickname: string // 设备备注名称 + gatewayId: number // 网关设备 ID + status: number // 设备状态 + statusLastUpdateTime: Date // 设备状态最后更新时间 + lastOnlineTime: Date // 最后上线时间 + lastOfflineTime: Date // 最后离线时间 + activeTime: Date // 设备激活时间 + createTime: Date // 创建时间 + ip: string // 设备的 IP 地址 + firmwareVersion: string // 设备的固件版本 + deviceSecret: string // 设备密钥,用于设备认证,需安全存储 + mqttClientId: string // MQTT 客户端 ID + mqttUsername: string // MQTT 用户名 + mqttPassword: string // MQTT 密码 + authType: string // 认证类型 + latitude: number // 设备位置的纬度 + longitude: number // 设备位置的经度 + areaId: number // 地区编码 + address: string // 设备详细地址 + serialNumber: string // 设备序列号 +} + +export interface DeviceUpdateStatusVO { + id: number // 设备 ID,主键,自增 + status: number // 设备状态 +} + +// 设备 API +export const DeviceApi = { + // 查询设备分页 + getDevicePage: async (params: any) => { + return await request.get({ url: `/iot/device/page`, params }) + }, + + // 查询设备详情 + getDevice: async (id: number) => { + return await request.get({ url: `/iot/device/get?id=` + id }) + }, + + // 新增设备 + createDevice: async (data: DeviceVO) => { + return await request.post({ url: `/iot/device/create`, data }) + }, + + // 修改设备 + updateDevice: async (data: DeviceVO) => { + return await request.put({ url: `/iot/device/update`, data }) + }, + + // 修改设备状态 + updateDeviceStatus: async (data: DeviceUpdateStatusVO) => { + return await request.put({ url: `/iot/device/update-status`, data }) + }, + + // 删除设备 + deleteDevice: async (id: number) => { + return await request.delete({ url: `/iot/device/delete?id=` + id }) + }, + + // 获取设备数量 + getDeviceCount: async (productId: number) => { + return await request.get({ url: `/iot/device/count?productId=` + productId }) + } +} diff --git a/src/api/iot/product/index.ts b/src/api/iot/product/index.ts new file mode 100644 index 00000000..1ffa490d --- /dev/null +++ b/src/api/iot/product/index.ts @@ -0,0 +1,62 @@ +import request from '@/config/axios' + +// IoT 产品 VO +export interface ProductVO { + id: number // 产品编号 + name: string // 产品名称 + productKey: string // 产品标识 + protocolId: number // 协议编号 + categoryId: number // 产品所属品类标识符 + description: string // 产品描述 + validateType: number // 数据校验级别 + status: number // 产品状态 + deviceType: number // 设备类型 + netType: number // 联网方式 + protocolType: number // 接入网关协议 + dataFormat: number // 数据格式 + deviceCount: number // 设备数量 + createTime: Date // 创建时间 +} + +// IoT 产品 API +export const ProductApi = { + // 查询产品分页 + getProductPage: async (params: any) => { + return await request.get({ url: `/iot/product/page`, params }) + }, + + // 查询产品详情 + getProduct: async (id: number) => { + return await request.get({ url: `/iot/product/get?id=` + id }) + }, + + // 新增产品 + createProduct: async (data: ProductVO) => { + return await request.post({ url: `/iot/product/create`, data }) + }, + + // 修改产品 + updateProduct: async (data: ProductVO) => { + return await request.put({ url: `/iot/product/update`, data }) + }, + + // 删除产品 + deleteProduct: async (id: number) => { + return await request.delete({ url: `/iot/product/delete?id=` + id }) + }, + + // 导出产品 Excel + exportProduct: async (params) => { + return await request.download({ url: `/iot/product/export-excel`, params }) + }, + + // 更新产品状态 + 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/api/iot/thinkmodelfunction/index.ts b/src/api/iot/thinkmodelfunction/index.ts new file mode 100644 index 00000000..bd2e2d0f --- /dev/null +++ b/src/api/iot/thinkmodelfunction/index.ts @@ -0,0 +1,55 @@ +import request from '@/config/axios' + +// IoT 产品物模型 VO +export interface ThinkModelFunctionVO { + id: number // 物模型功能编号 + identifier: string // 功能标识 + name: string // 功能名称 + description: string // 功能描述 + productId: number // 产品编号 + productKey: string // 产品标识 + type: number // 功能类型 + property: string // 属性 + event: string // 事件 + service: string // 服务 +} + +// IoT 产品物模型 API +export const ThinkModelFunctionApi = { + // 查询产品物模型分页 + getThinkModelFunctionPage: async (params: any) => { + return await request.get({ url: `/iot/think-model-function/page`, params }) + }, + // 获得产品物模型 + getThinkModelFunctionListByProductId: async (params: any) => { + return await request.get({ + url: `/iot/think-model-function/list-by-product-id`, + params + }) + }, + + // 查询产品物模型详情 + getThinkModelFunction: async (id: number) => { + return await request.get({ url: `/iot/think-model-function/get?id=` + id }) + }, + + // 新增产品物模型 + createThinkModelFunction: async (data: ThinkModelFunctionVO) => { + return await request.post({ url: `/iot/think-model-function/create`, data }) + }, + + // 修改产品物模型 + updateThinkModelFunction: async (data: ThinkModelFunctionVO) => { + return await request.put({ url: `/iot/think-model-function/update`, data }) + }, + + // 删除产品物模型 + deleteThinkModelFunction: async (id: number) => { + return await request.delete({ url: `/iot/think-model-function/delete?id=` + id }) + }, + + // 导出产品物模型 Excel + exportThinkModelFunction: async (params) => { + return await request.download({ url: `/iot/think-model-function/export-excel`, params }) + } +} diff --git a/src/router/modules/remaining.ts b/src/router/modules/remaining.ts index bf2ba2bb..cba8359c 100644 --- a/src/router/modules/remaining.ts +++ b/src/router/modules/remaining.ts @@ -603,6 +603,38 @@ const remainingRouter: AppRouteRecordRaw[] = [ hidden: true, breadcrumb: false } + }, + { + path: '/iot', + component: Layout, + name: 'IOT', + meta: { + hidden: true + }, + children: [ + { + path: 'product/detail/:id', + name: 'IoTProductDetail', + meta: { + title: '产品详情', + noCache: true, + hidden: true, + activeMenu: '/iot/product' + }, + component: () => import('@/views/iot/product/detail/index.vue') + }, + { + path: 'device/detail/:id', + name: 'IoTDeviceDetail', + meta: { + title: '设备详情', + noCache: true, + hidden: true, + activeMenu: '/iot/device' + }, + component: () => import('@/views/iot/device/detail/index.vue') + } + ] } ] diff --git a/src/utils/dict.ts b/src/utils/dict.ts index f8a0f43b..ebf7fd9b 100644 --- a/src/utils/dict.ts +++ b/src/utils/dict.ts @@ -225,5 +225,18 @@ export enum DICT_TYPE { AI_WRITE_LENGTH = 'ai_write_length', // AI 写作长度 AI_WRITE_FORMAT = 'ai_write_format', // AI 写作格式 AI_WRITE_TONE = 'ai_write_tone', // AI 写作语气 - AI_WRITE_LANGUAGE = 'ai_write_language' // AI 写作语言 + AI_WRITE_LANGUAGE = 'ai_write_language', // AI 写作语言 + + // ========== IOT - 物联网模块 ========== + IOT_NET_TYPE = 'iot_net_type', // IOT 联网方式 + IOT_VALIDATE_TYPE = 'iot_validate_type', // IOT 数据校验级别 + 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_DEVICE_STATUS = 'iot_device_status', // IOT 设备状态 + IOT_PRODUCT_FUNCTION_TYPE = 'iot_product_function_type', // IOT 产品功能类型 + IOT_DATA_TYPE = 'iot_data_type', // IOT 数据类型 + IOT_UNIT_TYPE = 'iot_unit_type', // IOT 单位类型 + IOT_RW_TYPE = 'iot_rw_type' // IOT 读写类型 } diff --git a/src/views/iot/device/DeviceForm.vue b/src/views/iot/device/DeviceForm.vue new file mode 100644 index 00000000..cb026012 --- /dev/null +++ b/src/views/iot/device/DeviceForm.vue @@ -0,0 +1,156 @@ + + + + + + + + + + + + + + + + + 确 定 + 取 消 + + + + diff --git a/src/views/iot/device/detail/DeviceDetailsHeader.vue b/src/views/iot/device/detail/DeviceDetailsHeader.vue new file mode 100644 index 00000000..62960529 --- /dev/null +++ b/src/views/iot/device/detail/DeviceDetailsHeader.vue @@ -0,0 +1,76 @@ + + + + + + + {{ device.deviceName }} + + + + + + + 编辑 + + + + + + + + {{ product.name }} + + + {{ product.productKey }} + 复制 + + + + + + + diff --git a/src/views/iot/device/detail/DeviceDetailsInfo.vue b/src/views/iot/device/detail/DeviceDetailsInfo.vue new file mode 100644 index 00000000..59b9d254 --- /dev/null +++ b/src/views/iot/device/detail/DeviceDetailsInfo.vue @@ -0,0 +1,123 @@ + + + + + {{ product.name }} + + {{ product.productKey }} + 复制 + + + + + + {{ device.deviceName }} + 复制 + + {{ device.nickname }} + + {{ formatDate(device.createTime) }} + + + {{ formatDate(device.activeTime) }} + + + {{ formatDate(device.lastOnlineTime) }} + + + + + + {{ formatDate(device.lastOfflineTime) }} + + + 查看 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 关闭 + + + + + diff --git a/src/views/iot/device/detail/index.vue b/src/views/iot/device/detail/index.vue new file mode 100644 index 00000000..2db16bbc --- /dev/null +++ b/src/views/iot/device/detail/index.vue @@ -0,0 +1,66 @@ + + + + + + + + + + + + + + diff --git a/src/views/iot/device/index.vue b/src/views/iot/device/index.vue new file mode 100644 index 00000000..784b1482 --- /dev/null +++ b/src/views/iot/device/index.vue @@ -0,0 +1,267 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 搜索 + + + + 重置 + + + + 新增 + + + + + + + + + + + {{ scope.row.deviceName }} + + + + + + {{ productMap[scope.row.productId] }} + + + + + + + + + + + + + + + + + 查看 + + + 编辑 + + + 删除 + + + + + + + + + + + + + diff --git a/src/views/iot/product/ProductForm.vue b/src/views/iot/product/ProductForm.vue new file mode 100644 index 00000000..75d6efcc --- /dev/null +++ b/src/views/iot/product/ProductForm.vue @@ -0,0 +1,204 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {{ dict.label }} + + + + + + + + + + + 确 定 + 取 消 + + + + + diff --git a/src/views/iot/product/detail/ProductDetailsHeader.vue b/src/views/iot/product/detail/ProductDetailsHeader.vue new file mode 100644 index 00000000..ba009516 --- /dev/null +++ b/src/views/iot/product/detail/ProductDetailsHeader.vue @@ -0,0 +1,103 @@ + + + + + + + {{ product.name }} + + + + + + + 编辑 + + + 发布 + + + 撤销发布 + + + + + + + + {{ product.productKey }} + 复制 + + + + + {{ product.deviceCount }} + 前往管理 + + + + + + + diff --git a/src/views/iot/product/detail/ProductDetailsInfo.vue b/src/views/iot/product/detail/ProductDetailsInfo.vue new file mode 100644 index 00000000..5153045e --- /dev/null +++ b/src/views/iot/product/detail/ProductDetailsInfo.vue @@ -0,0 +1,44 @@ + + + + + {{ product.name }} + + + + + {{ formatDate(product.createTime) }} + + + + + + + + + + + + + + + + + {{ product.description }} + + + + + diff --git a/src/views/iot/product/detail/ProductTopic.vue b/src/views/iot/product/detail/ProductTopic.vue new file mode 100644 index 00000000..c327bb65 --- /dev/null +++ b/src/views/iot/product/detail/ProductTopic.vue @@ -0,0 +1,243 @@ + + + + + + + + + + + + + diff --git a/src/views/iot/product/detail/ThinkModelFunction.vue b/src/views/iot/product/detail/ThinkModelFunction.vue new file mode 100644 index 00000000..5a75d109 --- /dev/null +++ b/src/views/iot/product/detail/ThinkModelFunction.vue @@ -0,0 +1,154 @@ + + + + + + + + + + + 搜索 + 重置 + + 添加功能 + + + + + + + + + + + + + + + + + + 编辑 + + + 删除 + + + + + + + + + + + + diff --git a/src/views/iot/product/detail/ThinkModelFunctionForm.vue b/src/views/iot/product/detail/ThinkModelFunctionForm.vue new file mode 100644 index 00000000..895692e0 --- /dev/null +++ b/src/views/iot/product/detail/ThinkModelFunctionForm.vue @@ -0,0 +1,229 @@ + + + + + + 属性 + 服务 + 事件 + + + + + + + + + + + + + + + + + + + + + + + + ~ + + + + + + + + + + + 读写 + 只读 + + + + + + + + + 确 定 + 取 消 + + + + + diff --git a/src/views/iot/product/detail/index.vue b/src/views/iot/product/detail/index.vue new file mode 100644 index 00000000..ddc5e185 --- /dev/null +++ b/src/views/iot/product/detail/index.vue @@ -0,0 +1,80 @@ + + getProductData(id)" /> + + + + + + + + + + + + + + + + + diff --git a/src/views/iot/product/index.vue b/src/views/iot/product/index.vue new file mode 100644 index 00000000..fa285819 --- /dev/null +++ b/src/views/iot/product/index.vue @@ -0,0 +1,191 @@ + + + + + + + + + + + + 搜索 + 重置 + + 新增 + + + + + + + + + + + {{ scope.row.name }} + + + + + + + + + + + + + + + + + + 查看 + + + 删除 + + + + + + + + + + + + +