diff --git a/src/views/ems/record/recordIOTInstant/index.vue b/src/views/ems/record/recordIOTInstant/index.vue
index 76178ba..d0bb5bc 100644
--- a/src/views/ems/record/recordIOTInstant/index.vue
+++ b/src/views/ems/record/recordIOTInstant/index.vue
@@ -187,7 +187,7 @@
-
+
@@ -214,25 +214,10 @@
label="噪声(dB)" align="center" prop="noise" width="100">
-
-
-
-
+
+
- 修改
- 删除
+ {{ scope.row.recodeTime || '--' }}
@@ -455,18 +440,23 @@ export default {
// 判断是否为父节点(有children属性)
if (data.children && data.children.length > 0) {
- // 父节点:收集所有子节点的code
- this.queryParams.monitorIds = data.children.map(child => child.code);
- console.log('点击父节点:', data.label, '子节点codes:', this.queryParams.monitorIds);
+ // 父节点:收集所有子节点的code,过滤掉空值
+ this.queryParams.monitorIds = data.children
+ .filter(child => child.code)
+ .map(child => child.code);
+
+ // 父节点的type应该与子节点一致,取第一个有效子节点的type
+ const firstValidChild = data.children.find(child => child.type);
+ this.selectedNodeType = firstValidChild ? firstValidChild.type : data.type;
+
+ console.log('点击父节点:', data.label, '节点type:', data.type, '子节点codes:', this.queryParams.monitorIds, '使用type:', this.selectedNodeType);
} else {
// 子节点:使用单个设备code
this.queryParams.monitorId = data.code;
- console.log('点击子节点:', data.label, 'code:', data.code);
+ this.selectedNodeType = data.type;
+ console.log('点击子节点:', data.label, 'code:', data.code, 'type:', this.selectedNodeType);
}
- // 存储当前选中节点的type,用于控制列显示
- this.selectedNodeType = data.type;
- console.log('选中节点类型:', this.selectedNodeType);
this.handleQuery();
},
@@ -485,8 +475,8 @@ export default {
}
- // 如果没有选中节点,则获取所有设备ID
- if (!this.queryParams.monitorId) {
+ // 如果既没有选中单个节点,也没有选中父节点,则获取所有设备ID
+ if (!this.queryParams.monitorId && (!this.queryParams.monitorIds || this.queryParams.monitorIds.length === 0)) {
this.queryParams.monitorIds = this.getAllMonitorIds(this.monitorInfoOptions);
}
@@ -494,6 +484,13 @@ export default {
this.recordIotenvInstantList = response.rows;
this.total = response.total;
this.loading = false;
+
+ // 调试信息:检查返回的数据
+ console.log('查询结果:', response.rows);
+ console.log('当前选中节点类型:', this.selectedNodeType);
+ if (response.rows && response.rows.length > 0) {
+ console.log('第一条记录的时间字段:', response.rows[0].recodeTime);
+ }
});
},
// 取消按钮
@@ -529,7 +526,14 @@ export default {
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
- this.daterangeCollectTime = [];
+
+ // 重置时间范围为默认值(昨天8:00:00到今天8:00:00)
+ const nowDate = new Date();
+ const today = parseTime(new Date(), '{y}-{m}-{d}')
+ const lastDate = new Date();
+ lastDate.setDate(nowDate.getDate() - 1)
+ const yesterday = parseTime(lastDate, '{y}-{m}-{d}')
+ this.daterangeRecordTime = [yesterday + ' 08:00:00', today + ' 08:00:00'];
// 重置选中节点类型和查询条件
this.selectedNodeType = null;