refactor(ems): 优化环境监测数据查询功能

- 为表格添加 stripe、border 样式,优化视觉效果
-调整记录时间列宽度,确保时间信息完整显示
- 移除操作按钮,改为只显示时间信息
- 优化父节点点击逻辑,过滤无效子节点
- 调整设备类型获取方式,提高数据准确性
- 重置查询条件时,默认设置时间范围为昨天8点到今天8点
boardTest
zch 3 weeks ago
parent f657ca07db
commit 68a9b7e950

@ -187,7 +187,7 @@
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="recordIotenvInstantList" @selection-change="handleSelectionChange">
<el-table v-loading="loading" :data="recordIotenvInstantList" @selection-change="handleSelectionChange" stripe border style="width: 100%">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="序号" type="index" width="55" align="center" />
<el-table-column label="计量设备" align="center" prop="monitorName" min-width="150">
@ -214,25 +214,10 @@
label="噪声(dB)" align="center" prop="noise" width="100">
</el-table-column>
<!-- 记录时间列给足够的宽度 -->
<el-table-column label="记录时间" align="center" prop="recodeTime" width="200">
</el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="100">
<!-- 记录时间列确保始终显示并格式化时间 -->
<el-table-column label="记录时间" align="center" prop="recodeTime" min-width="180" show-overflow-tooltip>
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['ems/record:recordIotenvInstant:edit']"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['ems/record:recordIotenvInstant:remove']"
>删除</el-button>
<span>{{ scope.row.recodeTime || '--' }}</span>
</template>
</el-table-column>
</el-table>
@ -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);
// typetype
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:008: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;

Loading…
Cancel
Save