From 898d0f1e98dd40688730f29a9bd8b4b065e23149 Mon Sep 17 00:00:00 2001 From: chenshuichuan <1154693969@qq.com> Date: Mon, 3 Jun 2024 14:31:08 +0800 Subject: [PATCH] fix mqtt record --- src/api/iot/device/index.ts | 193 +++++++++++++++------------- src/views/iot/device/DeviceForm.vue | 32 +++++ src/views/iot/device/index.vue | 13 ++ src/views/iot/mqttrecord/index.vue | 3 +- 4 files changed, 148 insertions(+), 93 deletions(-) diff --git a/src/api/iot/device/index.ts b/src/api/iot/device/index.ts index ab2eda57..36d398dd 100644 --- a/src/api/iot/device/index.ts +++ b/src/api/iot/device/index.ts @@ -1,92 +1,101 @@ -import request from '@/config/axios' - -// 物联设备 VO -export interface DeviceVO { - id: number // ID - deviceConfigId: string // 设备配置id - deviceCode: string // 设备编号 - deviceName: string // 设备名称 - deviceType: string // 设备类型 - siemensSeries: string // Siemens系列(S7-300、S7-1500) - siemensConnectParam: string // 连接参数(波特率,数据位,停止位,校验位 例如:9600,8,1,N) - readCronType: string // 读取任务方式(0无,1有) - readRepeatValue: number // 读取任务时间间隔 - readRepeatUnit: string // 读取任务时间间隔单位 - readCron: string // 读取任务时间表达式 - writeCronType: string // 写入任务时间间隔 - writeRepeatValue: number // 写入任务时间间隔 - writeRepeatUnit: string // 写入任务时间间隔单位 - writeCron: string // 写入任务时间表达式 - localPersistent: string // 是否持久化(0不持久化,1持久化) - uploadRate: string // 上传方式(1实时,2自定义) - rateCount: number // 上传频率 - modbusProtocol: string // modbus协议类型(serial-rtu) - modbusPattern: string // modbus模式(client) - portName: string // modbus串口号 - modbusConnectParam: string // 连接参数(波特率,数据位,停止位,校验位 例如:9600,8,1,N) - modbusReadAddrGap: string // 读地址是否连续(0否,1是) - isUpload: string // 是否已下发(0下,1没下) - gatewayId: number // 网关id - orgId: number // 组织设备id - remark: string // 备注 - isEnable: boolean // 是否启用 -} - -// 物联设备 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 }) - }, - - // 删除物联设备 - deleteDevice: async (id: number) => { - return await request.delete({ url: `/iot/device/delete?id=` + id }) - }, - - // 导出物联设备 Excel - exportDevice: async (params) => { - return await request.download({ url: `/iot/device/export-excel`, params }) - }, - -// ==================== 子表(设备属性) ==================== - - // 获得设备属性分页 - getDeviceAttributePage: async (params) => { - return await request.get({ url: `/iot/device/device-attribute/page`, params }) - }, - // 新增设备属性 - createDeviceAttribute: async (data) => { - return await request.post({ url: `/iot/device/device-attribute/create`, data }) - }, - - // 修改设备属性 - updateDeviceAttribute: async (data) => { - return await request.put({ url: `/iot/device/device-attribute/update`, data }) - }, - - // 删除设备属性 - deleteDeviceAttribute: async (id: number) => { - return await request.delete({ url: `/iot/device/device-attribute/delete?id=` + id }) - }, - - // 获得设备属性 - getDeviceAttribute: async (id: number) => { - return await request.get({ url: `/iot/device/device-attribute/get?id=` + id }) - }, -} \ No newline at end of file +import request from '@/config/axios' + +// 物联设备 VO +export interface DeviceVO { + id: number // ID + deviceConfigId: string // 设备配置id + deviceCode: string // 设备编号 + deviceName: string // 设备名称 + deviceType: string // 设备类型 + siemensSeries: string // Siemens系列(S7-300、S7-1500) + siemensConnectParam: string // 连接参数(波特率,数据位,停止位,校验位 例如:9600,8,1,N) + readCronType: string // 读取任务方式(0无,1有) + readRepeatValue: number // 读取任务时间间隔 + readRepeatUnit: string // 读取任务时间间隔单位 + readCron: string // 读取任务时间表达式 + writeCronType: string // 写入任务时间间隔 + writeRepeatValue: number // 写入任务时间间隔 + writeRepeatUnit: string // 写入任务时间间隔单位 + writeCron: string // 写入任务时间表达式 + localPersistent: string // 是否持久化(0不持久化,1持久化) + uploadRate: string // 上传方式(1实时,2自定义) + rateCount: number // 上传频率 + modbusProtocol: string // modbus协议类型(serial-rtu) + modbusPattern: string // modbus模式(client) + portName: string // modbus串口号 + modbusConnectParam: string // 连接参数(波特率,数据位,停止位,校验位 例如:9600,8,1,N) + modbusReadAddrGap: string // 读地址是否连续(0否,1是) + isUpload: string // 是否已下发(0下,1没下) + gatewayId: number // 网关id + orgId: number // 组织设备id + remark: string // 备注 + isEnable: boolean // 是否启用 + + deviceUseType: string // 数采设备类型 + apIp: string // ap_ip + gateBridgeIp: string // 网桥ip + comServerIp: string // 串口服务器IP + comServerPort: string // 串口服务器端口 + plcControllerIp: string // PLC控制器地址 + plcScreenIp: string // PLC触控屏地址 + orgMachineId: number // i机台id +} + +// 物联设备 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 }) + }, + + // 删除物联设备 + deleteDevice: async (id: number) => { + return await request.delete({ url: `/iot/device/delete?id=` + id }) + }, + + // 导出物联设备 Excel + exportDevice: async (params) => { + return await request.download({ url: `/iot/device/export-excel`, params }) + }, + +// ==================== 子表(设备属性) ==================== + + // 获得设备属性分页 + getDeviceAttributePage: async (params) => { + return await request.get({ url: `/iot/device/device-attribute/page`, params }) + }, + // 新增设备属性 + createDeviceAttribute: async (data) => { + return await request.post({ url: `/iot/device/device-attribute/create`, data }) + }, + + // 修改设备属性 + updateDeviceAttribute: async (data) => { + return await request.put({ url: `/iot/device/device-attribute/update`, data }) + }, + + // 删除设备属性 + deleteDeviceAttribute: async (id: number) => { + return await request.delete({ url: `/iot/device/device-attribute/delete?id=` + id }) + }, + + // 获得设备属性 + getDeviceAttribute: async (id: number) => { + return await request.get({ url: `/iot/device/device-attribute/get?id=` + id }) + }, +} diff --git a/src/views/iot/device/DeviceForm.vue b/src/views/iot/device/DeviceForm.vue index d83e7b65..f83ce755 100644 --- a/src/views/iot/device/DeviceForm.vue +++ b/src/views/iot/device/DeviceForm.vue @@ -170,6 +170,38 @@ + + + + {{ dict.label }} + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/views/iot/device/index.vue b/src/views/iot/device/index.vue index ad77a1d1..d99998a9 100644 --- a/src/views/iot/device/index.vue +++ b/src/views/iot/device/index.vue @@ -169,6 +169,19 @@ + + + + + + + + + + +