diff --git a/src/views/ems/record/recordVibrationInstant/index.vue b/src/views/ems/record/recordVibrationInstant/index.vue
index 212c1a3..43aefa5 100644
--- a/src/views/ems/record/recordVibrationInstant/index.vue
+++ b/src/views/ems/record/recordVibrationInstant/index.vue
@@ -184,48 +184,27 @@
v-hasPermi="['ems/record:recordIotenvInstant:export']"
>导出
-
+
-
-
-
-
+
+
-
-
+
+
+
-
-
+
-
-
+
-
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
@@ -264,7 +243,7 @@
-
+
@@ -291,14 +270,14 @@
-
+
0) {
+ // 父节点:收集所有子节点的code
+ this.queryParams.monitorIds = data.children.map(child => child.code);
+ console.log('点击振动设备父节点:', data.label, '子节点codes:', this.queryParams.monitorIds);
+ } else {
+ // 子节点:使用单个设备code
+ this.queryParams.monitorId = data.code;
+ console.log('点击振动设备子节点:', data.label, 'code:', data.code);
+ }
+
+ this.handleQuery();
},
/** 查询物联网数据列表 */
getList() {
this.loading = true;
-
if (null != this.daterangeCollectTime && '' != this.daterangeCollectTime) {
this.queryParams.params['beginCollectTime'] = this.daterangeCollectTime[0]
this.queryParams.params['endCollectTime'] = this.daterangeCollectTime[1]
@@ -499,10 +475,13 @@ export default {
this.queryParams.params['endRecordTime'] = this.daterangeRecordTime[1]
}
-
- // 如果没有选中节点,则获取所有设备ID
- if (!this.queryParams.monitorId) {
- this.queryParams.monitorIds = this.getAllMonitorIds(this.monitorInfoOptions);
+ // 如果没有选中具体设备且没有设备ID列表,则不执行查询
+ if (!this.queryParams.monitorId && this.queryParams.monitorIds.length === 0) {
+ this.recordIotenvInstantList = [];
+ this.total = 0;
+ this.loading = false;
+ console.log('没有振动设备数据可查询');
+ return;
}
listRecordIotenvInstant(this.queryParams).then(response => {
@@ -543,9 +522,14 @@ export default {
},
/** 重置按钮操作 */
resetQuery() {
-
this.resetForm("queryForm");
this.daterangeCollectTime = [];
+
+ // 重置查询条件,重新获取所有振动设备ID
+ this.queryParams.monitorId = null;
+ this.queryParams.monitorIds = this.getAllMonitorIds(this.monitorInfoOptions);
+ console.log('重置后振动设备IDs:', this.queryParams.monitorIds);
+
this.handleQuery();
},
// 多选框选中数据
@@ -613,6 +597,24 @@ export default {
})
},
+ // 初始化振动设备数据
+ async initVibrationDevices() {
+ try {
+ const response = await getMonitorInfoTree({ monitorType: 10 });
+ this.monitorInfoOptions = response.data;
+
+ // 获取所有振动设备的ID用于初始查询
+ this.queryParams.monitorIds = this.getAllMonitorIds(this.monitorInfoOptions);
+ console.log('初始化振动设备IDs:', this.queryParams.monitorIds);
+
+ // 设置完设备ID后再执行查询
+ this.getList();
+ } catch (error) {
+ console.error('获取振动设备树结构失败:', error);
+ this.loading = false;
+ }
+ },
+
}
};