From 945e88df34b6308045560fb71609c10a106031dc Mon Sep 17 00:00:00 2001 From: zch Date: Mon, 5 May 2025 19:38:12 +0800 Subject: [PATCH] =?UTF-8?q?refactor(ems):=20=E9=87=8D=E6=9E=84=E7=89=A9?= =?UTF-8?q?=E8=81=94=E7=BD=91=E6=95=B0=E6=8D=AE=E6=9F=A5=E8=AF=A2=E5=8A=9F?= =?UTF-8?q?=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 移除了不必要的控制台日志输出 - 新增了 getRecordIotenvInstantList API 用于查询物联网数据列表 - 优化了左侧树结构的渲染逻辑 -调整了日期范围选择器的使用方式 - 重构了查询参数的处理逻辑 --- src/api/ems/record/recordIotenvInstant.js | 9 + .../ems/record/recordIOTInstant/index.vue | 1164 +++++++++-------- .../ems/record/recordIotenvInstant/index.vue | 1 - .../record/recordVibrationInstant/index.vue | 590 +++++---- .../ems/report/currentIOTCurve/index.vue | 760 ++++++++--- .../report/currentVibrationCurve/index.vue | 84 +- 6 files changed, 1568 insertions(+), 1040 deletions(-) diff --git a/src/api/ems/record/recordIotenvInstant.js b/src/api/ems/record/recordIotenvInstant.js index bd782e3..7e6b541 100644 --- a/src/api/ems/record/recordIotenvInstant.js +++ b/src/api/ems/record/recordIotenvInstant.js @@ -42,3 +42,12 @@ export function delRecordIotenvInstant(objid) { method: 'delete' }) } + +// 查询物联网数据列表 +export function getRecordIotenvInstantList(query) { + return request({ + url: '/ems/record/recordIotenvInstant/getRecordIotenvInstantList', + method: 'get', + params: query + }) +} diff --git a/src/views/ems/record/recordIOTInstant/index.vue b/src/views/ems/record/recordIOTInstant/index.vue index 1ab58ea..7cd03b0 100644 --- a/src/views/ems/record/recordIOTInstant/index.vue +++ b/src/views/ems/record/recordIOTInstant/index.vue @@ -1,581 +1,609 @@ diff --git a/src/views/ems/record/recordIotenvInstant/index.vue b/src/views/ems/record/recordIotenvInstant/index.vue index 69f8615..5829ce9 100644 --- a/src/views/ems/record/recordIotenvInstant/index.vue +++ b/src/views/ems/record/recordIotenvInstant/index.vue @@ -495,7 +495,6 @@ if (!this.queryParams.monitorId) { this.queryParams.monitorIds = this.getAllMonitorIds(this.monitorInfoOptions); } - console.log(this.queryParams.monitorIds) listRecordIotenvInstant(this.queryParams).then(response => { this.recordIotenvInstantList = response.rows; diff --git a/src/views/ems/record/recordVibrationInstant/index.vue b/src/views/ems/record/recordVibrationInstant/index.vue index 446e214..7fa66b4 100644 --- a/src/views/ems/record/recordVibrationInstant/index.vue +++ b/src/views/ems/record/recordVibrationInstant/index.vue @@ -1,12 +1,11 @@ diff --git a/src/views/ems/report/currentVibrationCurve/index.vue b/src/views/ems/report/currentVibrationCurve/index.vue index f5ded44..a5e5a4a 100644 --- a/src/views/ems/report/currentVibrationCurve/index.vue +++ b/src/views/ems/report/currentVibrationCurve/index.vue @@ -75,6 +75,7 @@ import { parseTime } from '@/utils/ruoyi' import Chart from '@/components/Charts/Chart' import * as echarts from 'echarts' import { vibrationInstantList } from '@/api/ems/record/recordVibrationInstant' +import {getRecordIotenvInstantList} from "@/api/ems/record/recordIotenvInstant"; export default { name: 'currentVibrationCurve', @@ -124,7 +125,8 @@ export default { acceleration: null, temperature: null, recodeTime: null, - remark: null + remark: null, + monitorIds: [], }, // 表单参数 form: {}, @@ -176,6 +178,21 @@ export default { children: node.children } }, + // 递归获取树中所有节点的monitorId + getAllMonitorIds(nodes) { + let ids = []; + if (!nodes || nodes.length === 0) return ids; + + nodes.forEach(node => { + if (node.id) { + ids.push(node.id); + } + if (node.children && node.children.length > 0) { + ids = ids.concat(this.getAllMonitorIds(node.children)); + } + }); + return ids; + }, /** 查询电实时数据列表 */ getList() { this.loading = true @@ -188,6 +205,12 @@ export default { if (this.queryParams.sensorId !== null) { this.queryParams.params['sensorId'] = this.queryParams.sensorId; } + + // 如果没有选中节点,则获取所有设备ID + if (!this.queryParams.monitorId) { + this.queryParams.monitorIds = this.getAllMonitorIds(this.monitorInfoOptions); + } + this.getChart() }, @@ -201,7 +224,6 @@ export default { reset() { this.form = { objId: null, - collectTime: null, sensorId: null, speed: null, displacement: null, @@ -247,7 +269,10 @@ export default { /** 节点单击事件 */ handleNodeClick(data) { - /* this.queryParams.monitorCode = data.code*/ + // 点击节点时清空monitorIds,只使用选中的monitorId + this.queryParams.monitorIds = []; + + /* this.queryParams.monitorCode = data.code*/ this.queryParams.sensorId = data.code console.log("this.queryParams.sensorId"+this.queryParams.sensorId) @@ -261,7 +286,8 @@ export default { return } let query = JSON.parse(JSON.stringify(this.queryParams)) - const {data} = await vibrationInstantList(query) + // const {data} = await vibrationInstantList(query) + const {data} = await getRecordIotenvInstantList(query) let option1 = { title: { text: this.selectMonitorName + ' 速度曲线', @@ -289,7 +315,7 @@ export default { right: 0 }, xAxis: { - data: data.map(e => e.collectTime), + data: data.map(e => e.recodeTime), axisLine: { show: true, //隐藏X轴轴线 lineStyle: { @@ -351,7 +377,7 @@ export default { // areaStyle: { // color: "rgba(5,140,255, 0.2)", // }, - data: data.map(e => e.speed) + data: data.map(e => e.vibrationSpeed) }, ] } @@ -383,7 +409,7 @@ export default { right: 0 }, xAxis: { - data: data.map(e => e.collectTime), + data: data.map(e => e.recodeTime), axisLine: { show: true, //隐藏X轴轴线 lineStyle: { @@ -445,7 +471,7 @@ export default { // areaStyle: { // color: "rgba(5,140,255, 0.2)", // }, - data: data.map(e => e.temperature) + data: data.map(e => e.vibrationTemp) }, ] } @@ -476,7 +502,7 @@ export default { right: 0 }, xAxis: { - data: data.map(e => e.collectTime), + data: data.map(e => e.recodeTime), axisLine: { show: true, //隐藏X轴轴线 lineStyle: { @@ -538,7 +564,7 @@ export default { // areaStyle: { // color: "rgba(5,140,255, 0.2)", // }, - data: data.map(e => e.displacement) + data: data.map(e => e.vibrationDisplacement) }, ] } @@ -569,7 +595,7 @@ export default { right: 0 }, xAxis: { - data: data.map(e => e.collectTime), + data: data.map(e => e.recodeTime), axisLine: { show: true, //隐藏X轴轴线 lineStyle: { @@ -614,24 +640,24 @@ export default { } ], series: [ - { - name: '加速度(g)', - type: 'line', - smooth: true, //平滑曲线显示 - showAllSymbol: true, //显示所有图形。 - symbol: 'circle', //标记的图形为实心圆 - symbolSize: 10, //标记的大小 - // itemStyle: { - // color: "#058cff", - // }, - // lineStyle: { - // color: "#058cff", - // }, - // areaStyle: { - // color: "rgba(5,140,255, 0.2)", - // }, - data: data.map(e => e.acceleration) - }, + { + name: '加速度(g)', + type: 'line', + smooth: true, //平滑曲线显示 + showAllSymbol: true, //显示所有图形。 + symbol: 'circle', //标记的图形为实心圆 + symbolSize: 10, //标记的大小 + // itemStyle: { + // color: "#058cff", + // }, + // lineStyle: { + // color: "#058cff", + // }, + // areaStyle: { + // color: "rgba(5,140,255, 0.2)", + // }, + data: data.map(e => e.vibrationAcceleration) + }, ] } this.$refs.Chart1.setData(option1)