feat(record): 添加母排测温曲线功能,初始化

- 新增母排测温曲线页面,包括最高、最低、平均温度和温差曲线
- 实现曲线图的同步缩放功能
- 添加电柜和母排的树形结构选择
- 集成到现有的母排测温模块中
IOT
zch 1 year ago
parent 459f95f33f
commit 6720b059f7

@ -203,7 +203,13 @@ public class RecordBusbarTempController extends BaseController
return ResponseEntity.notFound().build();
}
}
@GetMapping("/busbarTempCurve")
public AjaxResult busbarTempCurve (RecordBusbarTemp recordBusbarTemp){
List<RecordBusbarTemp> recordBusbarTempList = recordBusbarTempService
.selectRecordBusbarTempList(recordBusbarTemp);
return success(recordBusbarTempList);
}
}

@ -67,3 +67,12 @@ export function CabinetAndBusbarTree(data) {
})
}
//母排测温曲线
export function busbarTempCurve(query) {
return request({
url: '/record/recordBusbarTemp/busbarTempCurve',
method: 'get',
params: query
})
}

@ -0,0 +1,777 @@
<template>
<div class="app-container">
<el-row :gutter="28">
<el-col :span="5" :xs="24">
<div class="head-container">
<el-input
v-model="filterBoxName"
placeholder="请输入母排名称"
clearable
size="small"
prefix-icon="el-icon-search"
style="margin-bottom: 20px"
/>
</div>
<div class="head-container">
<div class="tree-container">
<el-tree
:data="InfoOptions"
:props="props"
:expand-on-click-node="false"
:filter-node-method="filterNode"
ref="tree"
node-key="id"
default-expand-all
highlight-current
@node-click="handleNodeClick"
/>
</div>
</div>
</el-col>
<el-col :span="19" :xs="24">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch"
label-width="100px"
>
<!-- <el-form-item label="计量设备编号" prop="monitorCode">-->
<!-- <el-input-->
<!-- v-model="queryParams.monitorCode"-->
<!-- placeholder="请输入计量设备编号"-->
<!-- clearable-->
<!-- @keyup.enter.native="handleQuery"-->
<!-- />-->
<!-- </el-form-item>-->
<el-form-item label="记录时间">
<el-date-picker
v-model="daterangeRecordTime"
style="width: 340px"
value-format="yyyy-MM-dd HH:mm:ss"
type="datetimerange"
range-separator="-"
start-placeholder="开始时间"
end-placeholder="结束时间"
></el-date-picker>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery"></el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"></el-button>
</el-form-item>
</el-form>
<Chart ref="Chart1" class="chart1"/>
<Chart ref="Chart2" class="chart2"/>
<Chart ref="Chart3" class="chart3"/>
<Chart ref="Chart4" class="chart4"/>
</el-col>
</el-row>
</div>
</template>
<script>
import Treeselect from '@riophae/vue-treeselect'
import '@riophae/vue-treeselect/dist/vue-treeselect.css'
import { parseTime } from '@/utils/ruoyi'
import Chart from '@/components/Charts/Chart'
import * as echarts from 'echarts'
import {
addRecordBusbarTemp, busbarTempCurve,
CabinetAndBusbarTree,
delRecordBusbarTemp, getRecordBusbarTemp, listRecordBusbarTemp,
updateRecordBusbarTemp
} from "@/api/record/recordBusbarTemp";
export default {
name: 'recordBusbarTempCurve',
components: {
Chart,
Treeselect
},
data() {
return {
//
InfoOptions: [],
//
filterBoxName: undefined,
props:{
children: 'children',
label: 'label'
/* label: (data) => `(编号${data.code}) ${data.label} `*/
},
//
loading: true,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
//
recordBusbarTempList: [],
//
title: "",
//
photoTitle: "",
//
open: false,
//
photoOpen: false,
//
daterangeCreatedTime: [],
//
daterangeUpdatedTime: [],
//
daterangeRecordTime: [],
//
queryParams: {
pageNum: 1,
pageSize: 10,
objId: null,
busbarCode: null,
cabinetCode: null,
tempMax: null,
tempMin: null,
tempAvg: null,
tempDiff: null,
isAlarm: null,
filePath: null,
isFlag: null,
remark: null,
createdBy: null,
createdTime: null,
updatedBy: null,
updatedTime: null,
recordTime: null
},
//
form: {},
//
rules: {
busbarCode: [
{ required: true, message: "母排编号不能为空", trigger: "blur" }
],
cabinetCode: [
{ required: true, message: "电柜编号不能为空", trigger: "blur" }
],
},
};
},
created() {
const nowDate = parseTime(new Date(), '{y}-{m}-{d}')
this.daterangeRecordTime[0] = nowDate + ' 00:00:00'
this.daterangeRecordTime[1] = nowDate + ' 23:59:59'
this.getTreeselect()
this.getList()
},
watch: {
filterBoxName(val){
this.$refs.tree.filter(val)
}
},
methods: {
/** 查询母排测温信息列表 */
getList() {
this.loading = true;
this.queryParams.params = {};
if (null != this.daterangeRecordTime && '' != this.daterangeRecordTime) {
this.queryParams.params["beginRecordTime"] = this.daterangeRecordTime[0];
this.queryParams.params["endRecordTime"] = this.daterangeRecordTime[1];
}
this.getChart()
},
/** 查询电柜下拉树结构 */
getTreeselect() {
CabinetAndBusbarTree({}).then(response => {
this.InfoOptions = response.data
})
},
//
filterNode(value, data) {
if (!value) return true
return data.label.indexOf(value) !== -1
},
//
handleNodeClick(data) {
this.queryParams.busbarCode = data.code
this.selectBusbarName = data.label
this.handleQuery()
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.objId != null) {
updateRecordBusbarTemp(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addRecordBusbarTemp(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const objIds = row.objId || this.ids;
this.$modal.confirm('是否确认删除母排测温信息编号为"' + objIds + '"的数据项?').then(function() {
return delRecordBusbarTemp(objIds);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
this.download('record/recordBusbarTemp/export', {
...this.queryParams
}, `recordBusbarTemp_${new Date().getTime()}.xlsx`)
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.daterangeCreatedTime = [];
this.daterangeUpdatedTime = [];
this.daterangeRecordTime = [];
this.resetForm("queryForm");
this.handleQuery();
},
//
handleSelectionChange(selection) {
this.ids = selection.map(item => item.objId)
this.single = selection.length!==1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加母排测温信息";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const objId = row.objId || this.ids
getRecordBusbarTemp(objId).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改母排测温信息";
});
},
//
reset() {
this.form = {
objId: null,
busbarCode: null,
cabinetCode: null,
tempMax: null,
tempMin: null,
tempAvg: null,
tempDiff: null,
isAlarm: null,
filePath: null,
isFlag: null,
remark: null,
createdBy: null,
createdTime: null,
updatedBy: null,
updatedTime: null,
recordTime: null,
photoOpen : false,
visiblePhoto : null,
thermalPhoto : null,
thermalResponse : null,
visibleResponse : null,
};
this.resetForm("form");
this.photoOpen = false;
this.visiblePhoto = null;
this.thermalPhoto = null;
this.thermalResponse = null;
this.visibleResponse = null;
},
//
cancel() {
this.open = false;
this.reset();
this.photoOpen = false;
},
/** 母排测温曲线 */
async getChart() {
if (this.queryParams.busbarCode == null) {
return
}
let query = JSON.parse(JSON.stringify(this.queryParams))
const {data} = await busbarTempCurve(query)
let option1 = {
title: {
text: this.selectBusbarName + ' 最高温度曲线',
x: 'center'
},
grid: {
top: '15%',
bottom: '10%',
left: '10%',
right: '3%'
},
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'shadow',
label: {
show: true
}
}
},
dataZoom: [{
type: 'slider'
}],
legend: {
right: 0
},
xAxis: {
data: data.map(e => e.collectTime),
axisLine: {
show: true, //X线
lineStyle: {
color: '#000000'
}
},
axisTick: {
show: true //X
},
axisLabel: {
show: true,
textStyle: {
color: '#000000' //X
}
}
},
yAxis: [
{
type: 'value',
name: '温度(℃)',
nameTextStyle: {
color: '#000000'
},
splitLine: {
show: false
},
axisTick: {
show: true
},
axisLine: {
show: true,
lineStyle: {
color: '#000000'
}
},
axisLabel: {
show: true,
textStyle: {
color: '#000000'
}
}
}
],
series: [
{
name: '温度(℃)',
type: 'line',
smooth: true, //线
showAllSymbol: true, //
symbol: 'circle', //
symbolSize: 10, //
// itemStyle: {
// //线
// color: "#058cff",
// },
// lineStyle: {
// color: "#058cff",
// },
// areaStyle: {
// color: "rgba(5,140,255, 0.2)",
// },
data: data.map(e => e.tempMax)
},
]
}
let option2 = {
title: {
text: this.selectBusbarName + ' 最低温度曲线',
x: 'center'
},
grid: {
top: '15%',
bottom: '10%',
left: '10%',
right: '3%'
},
dataZoom: [{
type: 'slider'
}],
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'shadow',
label: {
show: true
}
}
},
legend: {
right: 0
},
xAxis: {
data: data.map(e => e.collectTime),
axisLine: {
show: true, //X线
lineStyle: {
color: '#000000'
}
},
axisTick: {
show: true //X
},
axisLabel: {
show: true,
textStyle: {
color: '#000000' //X
}
}
},
yAxis: [
{
type: 'value',
name: '温度(℃)',
nameTextStyle: {
color: '#000000'
},
splitLine: {
show: false
},
axisTick: {
show: true
},
axisLine: {
show: true,
lineStyle: {
color: '#000000'
}
},
axisLabel: {
show: true,
textStyle: {
color: '#000000'
}
}
}
],
series: [
{
name: '温度(℃)',
type: 'line',
smooth: true, //线
showAllSymbol: true, //
symbol: 'circle', //
symbolSize: 10, //
// itemStyle: {
// //线
// color: "#058cff",
// },
// lineStyle: {
// color: "#058cff",
// },
// areaStyle: {
// color: "rgba(5,140,255, 0.2)",
// },
data: data.map(e => e.tempMin)
},
]
}
let option3 = {
title: {
text: this.selectBusbarName + ' 平均温度曲线',
x: 'center'
},
grid: {
top: '15%',
bottom: '10%',
left: '10%',
right: '3%'
},
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'shadow',
label: {
show: true
}
}
},
dataZoom: [{
type: 'slider'
}],
legend: {
right: 0
},
xAxis: {
data: data.map(e => e.collectTime),
axisLine: {
show: true, //X线
lineStyle: {
color: '#000000'
}
},
axisTick: {
show: true //X
},
axisLabel: {
show: true,
textStyle: {
color: '#000000' //X
}
}
},
yAxis: [
{
type: 'value',
name: '平均温度',
nameTextStyle: {
color: '#000000'
},
splitLine: {
show: false
},
axisTick: {
show: true
},
axisLine: {
show: true,
lineStyle: {
color: '#000000'
}
},
axisLabel: {
show: true,
textStyle: {
color: '#000000'
}
}
}
],
series: [
{
name: '平均温度℃',
type: 'line',
smooth: true, //线
showAllSymbol: true, //
symbol: 'circle', //
symbolSize: 10, //
// itemStyle: {
// //线
// color: "#058cff",
// },
// lineStyle: {
// color: "#058cff",
// },
// areaStyle: {
// color: "rgba(5,140,255, 0.2)",
// },
data: data.map(e => e.tempAvg)
},
]
}
let option4 = {
title: {
text: this.selectBusbarName + ' 温差曲线',
x: 'center'
},
grid: {
top: '15%',
bottom: '10%',
left: '10%',
right: '3%'
},
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'shadow',
label: {
show: true
}
}
},
dataZoom: [{
type: 'slider'
}],
legend: {
right: 0
},
xAxis: {
data: data.map(e => e.collectTime),
axisLine: {
show: true, //X线
lineStyle: {
color: '#000000'
}
},
axisTick: {
show: true //X
},
axisLabel: {
show: true,
textStyle: {
color: '#000000' //X
}
}
},
yAxis: [
{
type: 'value',
name: '温差',
nameTextStyle: {
color: '#000000'
},
splitLine: {
show: false
},
axisTick: {
show: true
},
axisLine: {
show: true,
lineStyle: {
color: '#000000'
}
},
axisLabel: {
show: true,
textStyle: {
color: '#000000'
}
}
}
],
series: [
{
name: '温差',
type: 'line',
smooth: true, //线
showAllSymbol: true, //
symbol: 'circle', //
symbolSize: 10, //
// itemStyle: {
// color: "#058cff",
// },
// lineStyle: {
// color: "#058cff",
// },
// areaStyle: {
// color: "rgba(5,140,255, 0.2)",
// },
data: data.map(e => e.tempDiff)
},
]
}
this.$refs.Chart1.setData(option1)
this.$refs.Chart2.setData(option2)
this.$refs.Chart3.setData(option3)
this.$refs.Chart4.setData(option4)
echarts.connect(this.$refs.Chart1.chart, this.$refs.Chart2.chart, this.$refs.Chart3.chart, this.$refs.Chart4.chart)
this.$refs.Chart1.chart.on('datazoom', (e) => {
option2.dataZoom[0].start = e.start
option2.dataZoom[0].end = e.end
this.$refs.Chart2.setData(option2)
option3.dataZoom[0].start = e.start
option3.dataZoom[0].end = e.end
this.$refs.Chart3.setData(option3)
option4.dataZoom[0].start = e.start
option4.dataZoom[0].end = e.end
this.$refs.Chart4.setData(option4)
})
this.$refs.Chart2.chart.on('datazoom', (e) => {
option1.dataZoom[0].start = e.start
option1.dataZoom[0].end = e.end
this.$refs.Chart1.setData(option1)
option3.dataZoom[0].start = e.start
option3.dataZoom[0].end = e.end
this.$refs.Chart3.setData(option3)
option4.dataZoom[0].start = e.start
option4.dataZoom[0].end = e.end
this.$refs.Chart4.setData(option4)
})
this.$refs.Chart3.chart.on('datazoom', (e) => {
option2.dataZoom[0].start = e.start
option2.dataZoom[0].end = e.end
this.$refs.Chart2.setData(option2)
option1.dataZoom[0].start = e.start
option1.dataZoom[0].end = e.end
this.$refs.Chart1.setData(option1)
option4.dataZoom[0].start = e.start
option4.dataZoom[0].end = e.end
this.$refs.Chart4.setData(option4)
})
this.$refs.Chart4.chart.on('datazoom', (e) => {
option2.dataZoom[0].start = e.start
option2.dataZoom[0].end = e.end
this.$refs.Chart2.setData(option2)
option3.dataZoom[0].start = e.start
option3.dataZoom[0].end = e.end
this.$refs.Chart3.setData(option3)
option1.dataZoom[0].start = e.start
option1.dataZoom[0].end = e.end
this.$refs.Chart4.setData(option1)
})
}
}
}
</script>
<style scoped>
.chart1 {
width: 50%;
height: 40vh;
display: inline-block;
}
.chart2 {
width: 50%;
height: 40vh;
display: inline-block;
}
.chart3 {
width: 50%;
height: 40vh;
display: inline-block;
}
.chart4 {
width: 50%;
display: inline-block;
height: 40vh;
}
</style>
Loading…
Cancel
Save