feat(ems): 优化物联网数据查询功能

- 添加选中节点类型控制,用于控制显示字段
- 实现父节点和子节点点击事件的差异化处理
- 添加列显示控制,根据节点类型动态显示传感器数据
- 优化重置查询功能,清除选中节点信息
boardTest
zch 4 weeks ago
parent c607c11182
commit de96fa0ef3

@ -338,6 +338,9 @@ export default {
label: 'label' label: 'label'
}, },
//
selectedNodeType: null,
// //
daterangeRecordTime: [], daterangeRecordTime: [],
@ -411,6 +414,8 @@ export default {
this.daterangeRecordTime[0] = yesterday+ ' 08:00:00' this.daterangeRecordTime[0] = yesterday+ ' 08:00:00'
this.daterangeRecordTime[1] = today + ' 08:00:00' this.daterangeRecordTime[1] = today + ' 08:00:00'
//
this.updateColumnsVisibility();
this.getTreeMonitorInfo() this.getTreeMonitorInfo()
this.getTreeselect() this.getTreeselect()
@ -472,10 +477,25 @@ export default {
}, },
// //
handleNodeClick(data) { handleNodeClick(data) {
// monitorIds使monitorId //
this.queryParams.monitorIds = []; this.queryParams.monitorIds = [];
this.queryParams.monitorId = data.code this.queryParams.monitorId = null;
this.handleQuery()
// 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);
} else {
// 使code
this.queryParams.monitorId = data.code;
console.log('点击子节点:', data.label, 'code:', data.code);
}
// type
this.selectedNodeType = data.type;
this.updateColumnsVisibility();
this.handleQuery();
}, },
/** 查询物联网数据列表 */ /** 查询物联网数据列表 */
@ -536,9 +556,15 @@ export default {
}, },
/** 重置按钮操作 */ /** 重置按钮操作 */
resetQuery() { resetQuery() {
this.resetForm("queryForm"); this.resetForm("queryForm");
this.daterangeCollectTime = []; this.daterangeCollectTime = [];
//
this.selectedNodeType = null;
this.queryParams.monitorId = null;
this.queryParams.monitorIds = [];
this.updateColumnsVisibility();
this.handleQuery(); this.handleQuery();
}, },
// //
@ -606,6 +632,47 @@ export default {
}) })
}, },
//
updateColumnsVisibility() {
//
this.columns.forEach(col => {
if (col.key >= 2 && col.key <= 5) { //
col.visible = false;
}
});
if (!this.selectedNodeType) {
//
this.columns[2].visible = true; //
this.columns[3].visible = true; // 湿
this.columns[4].visible = true; //
this.columns[5].visible = true; //
return;
}
// type
switch (this.selectedNodeType) {
case 5: //
this.columns[2].visible = true; //
break;
case 6: // 湿湿
this.columns[2].visible = true; //
this.columns[3].visible = true; // 湿
break;
case 7: //
this.columns[5].visible = true; //
break;
default:
//
this.columns[2].visible = true; //
this.columns[3].visible = true; // 湿
this.columns[4].visible = true; //
this.columns[5].visible = true; //
}
console.log('更新列显示:', this.selectedNodeType, this.columns.map(c => ({key: c.key, label: c.label, visible: c.visible})));
},
} }
}; };
</script> </script>

Loading…
Cancel
Save