feat(ems): 优化振动设备数据查询功能

- getMonitorInfoTree获取所有类型为10即振动设备,然后将所有获取到的振动设备的id放入monitorIds传给后台来获取数据
- 移除了不必要的列定义,简化了表格结构
- 添加了振动设备专用列,包括振动速度、位移、加速度和温度
- 优化了设备树结构查询逻辑,支持父节点和子节点查询
- 调整了查询条件设置方式,提高了查询效率
- 移除了不必要的表单输入项,简化了数据录入
boardTest
zch 3 weeks ago
parent de96fa0ef3
commit e5e42bfca7

@ -184,48 +184,27 @@
v-hasPermi="['ems/record:recordIotenvInstant:export']"
>导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList" :columns="columns"></right-toolbar>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="recordIotenvInstantList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<!-- <el-table-column label="主键标识" align="center" prop="objid" v-if="columns[0].visible"/>-->
<el-table-column label="序号" type="index" width="55" align="center" v-if="columns[0].visible" />
<el-table-column label="计量设备" align="center" prop="monitorName" v-if="columns[1].visible">
<el-table-column label="序号" type="index" width="55" align="center" />
<el-table-column label="计量设备" align="center" prop="monitorName" min-width="150">
</el-table-column>
<el-table-column label="温度" align="center" prop="temperature" v-if="columns[2].visible">
<!-- 振动设备专用列 -->
<el-table-column label="振动速度(mm/s)" align="center" prop="vibrationSpeed" width="120">
</el-table-column>
<el-table-column label="湿度" align="center" prop="humidity" v-if="columns[3].visible">
<el-table-column label="振动位移(μm)" align="center" prop="vibrationDisplacement" width="120">
</el-table-column>
<el-table-column label="照度" align="center" prop="illuminance" v-if="columns[4].visible">
<el-table-column label="振动加速度(g)" align="center" prop="vibrationAcceleration" width="120">
</el-table-column>
<el-table-column label="噪声" align="center" prop="noise" v-if="columns[5].visible">
<el-table-column label="振动温度(℃)" align="center" prop="vibrationTemp" width="120">
</el-table-column>
<el-table-column label="硫化氢浓度" align="center" prop="concentration" v-if="columns[6].visible">
</el-table-column>
<el-table-column label="振动-速度(mm/s)" align="center" prop="vibrationSpeed" v-if="columns[7].visible">
</el-table-column>
<el-table-column label="振动-位移(um)" align="center" prop="vibrationDisplacement" v-if="columns[8].visible">
</el-table-column>
<el-table-column label="振动-加速度(g)" align="center" prop="vibrationAcceleration" v-if="columns[9].visible">
</el-table-column>
<el-table-column label="振动-温度(℃)" align="center" prop="vibrationTemp" v-if="columns[10].visible">
</el-table-column>
<el-table-column label="采集时间" align="center" prop="collectTime" width="180" v-if="columns[11].visible">
</el-table-column>
<el-table-column label="记录时间" align="center" prop="recodeTime" width="180" v-if="columns[12].visible">
<!-- 记录时间列给足够的宽度 -->
<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">
<template slot-scope="scope">
@ -264,7 +243,7 @@
<el-form-item label="计量设备编号" prop="monitorId">
<el-input v-model="form.monitorId" placeholder="请输入计量设备编号" />
</el-form-item>
<el-form-item label="温度" prop="temperature">
<!-- <el-form-item label="温度" prop="temperature">
<el-input v-model="form.temperature" placeholder="请输入温度" />
</el-form-item>
<el-form-item label="湿度" prop="humidity">
@ -278,7 +257,7 @@
</el-form-item>
<el-form-item label="硫化氢浓度" prop="concentration">
<el-input v-model="form.concentration" placeholder="请输入硫化氢浓度" />
</el-form-item>
</el-form-item> -->
<el-form-item label="振动-速度(mm/s)" prop="vibrationSpeed">
<el-input v-model="form.vibrationSpeed" placeholder="请输入振动-速度(mm/s)" />
</el-form-item>
@ -291,14 +270,14 @@
<el-form-item label="振动-温度(℃)" prop="vibrationTemp">
<el-input v-model="form.vibrationTemp" placeholder="请输入振动-温度(℃)" />
</el-form-item>
<el-form-item label="采集时间" prop="collectTime">
<!-- <el-form-item label="采集时间" prop="collectTime">
<el-date-picker clearable
v-model="form.collectTime"
type="date"
value-format="yyyy-MM-dd"
placeholder="请选择采集时间">
</el-date-picker>
</el-form-item>
</el-form-item> -->
<el-form-item label="记录时间" prop="recodeTime">
<el-date-picker clearable
v-model="form.recodeTime"
@ -377,31 +356,17 @@ export default {
collectTime: null,
recodeTime: null,
monitorIds: [],
monitorName: null,
monitorName: null
},
//
form: {},
//
rules: {
},
columns: [
{ key: 0, label: `标识`, visible: true },
{ key: 1, label: `计量设备`, visible: true },
{ key: 2, label: `温度`, visible: false },
{ key: 3, label: `湿度`, visible: false },
{ key: 4, label: `照度`, visible: false },
{ key: 5, label: `噪声`, visible: false },
{ key: 6, label: `硫化氢浓度`, visible: false },
{ key: 7, label: `振动-速度(mm/s)`, visible: true },
{ key: 8, label: `振动-位移(um)`, visible: true },
{ key: 9, label: `振动-加速度(g)`, visible: true },
{ key: 10, label: `振动-温度(℃)`, visible: true },
{ key: 11, label: `采集时间`, visible: false },
{ key: 12, label: `记录时间`, visible: true },
]
}
};
},
created() {
async created() {
//
const nowDate = new Date();
const today = parseTime(new Date(), '{y}-{m}-{d}')
const lastDate = new Date();
@ -410,11 +375,11 @@ export default {
this.daterangeRecordTime[0] = yesterday+ ' 08:00:00'
this.daterangeRecordTime[1] = today + ' 08:00:00'
//
this.getTreeMonitorInfo()
this.getTreeselect()
this.getList();
//
await this.initVibrationDevices();
},
watch: {
@ -479,17 +444,28 @@ export default {
},
//
handleNodeClick(data) {
// monitorIds使monitorId
//
this.queryParams.monitorIds = [];
this.queryParams.monitorId = data.code
this.handleQuery()
this.queryParams.monitorId = null;
// 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);
}
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;
}
},
}
};
</script>

Loading…
Cancel
Save