From c87ed7fe177599b43601b3e65b47272931f5f4ff Mon Sep 17 00:00:00 2001 From: YunaiV Date: Sun, 16 Mar 2025 23:44:56 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E4=BB=A3=E7=A0=81=E8=AF=84=E5=AE=A1?= =?UTF-8?q?=E3=80=91IoT=EF=BC=9A=E6=95=B0=E6=8D=AE=E6=A1=A5=E6=A2=81?= =?UTF-8?q?=E7=9A=84=E6=8E=A5=E5=85=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/iot/device/group/index.ts | 10 ++++---- src/api/iot/statistics/index.ts | 23 ++++++++----------- src/views/iot/device/device/DeviceForm.vue | 6 ++++- .../device/device/detail/DeviceDataDetail.vue | 4 ++-- .../device/detail/DeviceDetailConfig.vue | 6 ++--- .../device/detail/DeviceDetailsInfo.vue | 11 +++++---- src/views/iot/device/device/detail/index.vue | 2 +- src/views/iot/product/product/ProductForm.vue | 16 ++++++++++--- .../iot/product/product/detail/index.vue | 2 +- .../iot/rule/databridge/IoTDataBridgeForm.vue | 6 ++--- .../rule/databridge/config/HttpConfigForm.vue | 4 ++-- .../config/RedisStreamMQConfigForm.vue | 1 + 12 files changed, 52 insertions(+), 39 deletions(-) diff --git a/src/api/iot/device/group/index.ts b/src/api/iot/device/group/index.ts index 02cca70b..4debe8b1 100644 --- a/src/api/iot/device/group/index.ts +++ b/src/api/iot/device/group/index.ts @@ -11,27 +11,27 @@ export interface DeviceGroupVO { // IoT 设备分组 API export const DeviceGroupApi = { - // 查询IoT 设备分组分页 + // 查询设备分组分页 getDeviceGroupPage: async (params: any) => { return await request.get({ url: `/iot/device-group/page`, params }) }, - // 查询IoT 设备分组详情 + // 查询设备分组详情 getDeviceGroup: async (id: number) => { return await request.get({ url: `/iot/device-group/get?id=` + id }) }, - // 新增IoT 设备分组 + // 新增设备分组 createDeviceGroup: async (data: DeviceGroupVO) => { return await request.post({ url: `/iot/device-group/create`, data }) }, - // 修改IoT 设备分组 + // 修改设备分组 updateDeviceGroup: async (data: DeviceGroupVO) => { return await request.put({ url: `/iot/device-group/update`, data }) }, - // 删除IoT 设备分组 + // 删除设备分组 deleteDeviceGroup: async (id: number) => { return await request.delete({ url: `/iot/device-group/delete?id=` + id }) }, diff --git a/src/api/iot/statistics/index.ts b/src/api/iot/statistics/index.ts index 707ca48f..1ca00d65 100644 --- a/src/api/iot/statistics/index.ts +++ b/src/api/iot/statistics/index.ts @@ -1,6 +1,6 @@ import request from '@/config/axios' -/** 统计数据类型 */ +/** IoT 统计数据类型 */ export interface IotStatisticsSummaryRespVO { productCategoryCount: number productCount: number @@ -16,7 +16,7 @@ export interface IotStatisticsSummaryRespVO { productCategoryDeviceCounts: Record } -/** 消息统计数据类型 */ +/** IoT 消息统计数据类型 */ export interface IotStatisticsDeviceMessageSummaryRespVO { upstreamCounts: Record downstreamCounts: Record @@ -24,21 +24,18 @@ export interface IotStatisticsDeviceMessageSummaryRespVO { // IoT 数据统计 API export const ProductCategoryApi = { - // 查询IoT基础数据统计 + // 查询基础的数据统计 getIotStatisticsSummary: async () => { - return await request.get({ + return await request.get({ url: `/iot/statistics/get-summary` }) }, - // 查询IoT上下行消息数据统计 - getIotStatisticsDeviceMessageSummary: async (params: { - startTime: number - endTime: number - }) => { - return await request.get({ - url: `/iot/statistics/get-log-summary`, - params + // 查询设备上下行消息的数据统计 + getIotStatisticsDeviceMessageSummary: async (params: { startTime: number; endTime: number }) => { + return await request.get({ + url: `/iot/statistics/get-log-summary`, + params }) } -} \ No newline at end of file +} diff --git a/src/views/iot/device/device/DeviceForm.vue b/src/views/iot/device/device/DeviceForm.vue index be33c0c5..cf6e92ac 100644 --- a/src/views/iot/device/device/DeviceForm.vue +++ b/src/views/iot/device/device/DeviceForm.vue @@ -43,7 +43,11 @@ :disabled="formType === 'update'" /> - + () -/** IoT 设备 数据详情 */ +/** IoT 设备数据详情 */ defineOptions({ name: 'IoTDeviceDataDetail' }) const dialogVisible = ref(false) // 弹窗的是否展示 @@ -78,9 +78,9 @@ const queryParams = reactive({ formatDate(endOfDay(new Date())) ] }) - const queryFormRef = ref() // 搜索的表单 +/** 获得设备历史数据 */ const getList = async () => { detailLoading.value = true try { diff --git a/src/views/iot/device/device/detail/DeviceDetailConfig.vue b/src/views/iot/device/device/detail/DeviceDetailConfig.vue index d419b257..13906b57 100644 --- a/src/views/iot/device/device/detail/DeviceDetailConfig.vue +++ b/src/views/iot/device/device/detail/DeviceDetailConfig.vue @@ -30,9 +30,9 @@ />
取消 - 保存 + + 保存 + 编辑
diff --git a/src/views/iot/device/device/detail/DeviceDetailsInfo.vue b/src/views/iot/device/device/detail/DeviceDetailsInfo.vue index f583007b..7b64a8a6 100644 --- a/src/views/iot/device/device/detail/DeviceDetailsInfo.vue +++ b/src/views/iot/device/device/detail/DeviceDetailsInfo.vue @@ -120,18 +120,19 @@ const copyToClipboard = async (text: string) => { /** 打开 MQTT 参数弹框的方法 */ const openMqttParams = async () => { try { - const res = await DeviceApi.getMqttConnectionParams(device.id) + const data = await DeviceApi.getMqttConnectionParams(device.id) // 根据 API 响应结构正确获取数据 + // TODO @haohao:'N/A' 是不是在 ui 里处理哈 mqttParams.value = { - mqttClientId: res.mqttClientId || 'N/A', - mqttUsername: res.mqttUsername || 'N/A', - mqttPassword: res.mqttPassword || 'N/A' + mqttClientId: data.mqttClientId || 'N/A', + mqttUsername: data.mqttUsername || 'N/A', + mqttPassword: data.mqttPassword || 'N/A' } // 显示 MQTT 弹框 mqttDialogVisible.value = true } catch (error) { - console.error('获取MQTT连接参数出错:', error) + console.error('获取 MQTT 连接参数出错:', error) message.error('获取MQTT连接参数失败,请检查网络连接或联系管理员') } } diff --git a/src/views/iot/device/device/detail/index.vue b/src/views/iot/device/device/detail/index.vue index a3d5f0c0..a2bd3dec 100644 --- a/src/views/iot/device/device/detail/index.vue +++ b/src/views/iot/device/device/detail/index.vue @@ -51,7 +51,7 @@ defineOptions({ name: 'IoTDeviceDetail' }) const route = useRoute() const message = useMessage() -const id = Number(route.params.id) // 将字符串转换为数字 +const id = route.params.id // 将字符串转换为数字 const loading = ref(true) // 加载中 const product = ref({} as ProductVO) // 产品详情 const device = ref({} as DeviceVO) // 设备详情 diff --git a/src/views/iot/product/product/ProductForm.vue b/src/views/iot/product/product/ProductForm.vue index e4eec674..83706fc6 100644 --- a/src/views/iot/product/product/ProductForm.vue +++ b/src/views/iot/product/product/ProductForm.vue @@ -45,7 +45,7 @@
@@ -62,7 +62,11 @@ /> - +