|
|
|
@ -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);
|
|
|
|
|
|
|
|
|
|
// 父节点的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;
|
|
|
|
|