change - 温度实时监控优化

master
yinq 4 months ago
parent 5265a43ea8
commit db714ed6cc

@ -107,8 +107,7 @@
{ {
field: 'monitorAddr', field: 'monitorAddr',
title: '测控点位置', title: '测控点位置',
align: 'left', align: 'left'
width: '20%'
}, },
{ {
field: 'collectDeviceId', field: 'collectDeviceId',

@ -156,6 +156,7 @@
{ {
name: 'Pressure', name: 'Pressure',
type: 'gauge', type: 'gauge',
animation: false,
detail: { detail: {
formatter: '{value}', formatter: '{value}',
offsetCenter: [0, '20%'], offsetCenter: [0, '20%'],
@ -177,6 +178,7 @@
{ {
name: 'Pressure', name: 'Pressure',
type: 'gauge', type: 'gauge',
animation: false,
detail: { detail: {
fontSize: 20, fontSize: 20,
formatter: '{value}' formatter: '{value}'
@ -242,6 +244,7 @@
{ {
name: 'Pressure', name: 'Pressure',
type: 'gauge', type: 'gauge',
animation: false,
detail: { detail: {
formatter: '{value}', formatter: '{value}',
offsetCenter: [0, '20%'], offsetCenter: [0, '20%'],
@ -263,6 +266,7 @@
{ {
name: 'Pressure', name: 'Pressure',
type: 'gauge', type: 'gauge',
animation: false,
detail: { detail: {
fontSize: 20, fontSize: 20,
formatter: '{value}' formatter: '{value}'

@ -126,6 +126,7 @@
var tempInfo = ''; var tempInfo = '';
for (var i = 0; i < tempData.length; i++) { for (var i = 0; i < tempData.length; i++) {
tempInfo += '<div class="echarts" id="' + tempData[i].name + '" style="height: 400px;width: 25%;float: left;" ></div>'; tempInfo += '<div class="echarts" id="' + tempData[i].name + '" style="height: 400px;width: 25%;float: left;" ></div>';
/* tempInfo += '<div class="echarts" id="' + tempData[i].name + '" style="height: 200px;width: 12.5%;float: left;" ></div>';*/
/*info += '<div style="background-color: red;width: 200px;height: 200px;">'+tempData[i].name+'</div>' border: solid 1px greenyellow;padding: 10px 10px;;*/ /*info += '<div style="background-color: red;width: 200px;height: 200px;">'+tempData[i].name+'</div>' border: solid 1px greenyellow;padding: 10px 10px;;*/
} }
$("#tempDiv").html(tempInfo); $("#tempDiv").html(tempInfo);
@ -133,9 +134,12 @@
var temperatureMeterChart = echarts.init(document.getElementById(tempData[i].name)); var temperatureMeterChart = echarts.init(document.getElementById(tempData[i].name));
var temperatureMeterOption = { var temperatureMeterOption = {
title: { title: {
text: tempData[i].name, text: tempData[i].name.length > 18 ? tempData[i].name.substring(0, 15) + '\n' + tempData[i].name.substring(15) : tempData[i].name,
subtext: tempData[i].refushTime, subtext: tempData[i].refushTime,
left: 'center' left: 'center',
textStyle: {
fontSize: 14 // 调小主标题字体大小
}
}, },
tooltip: { tooltip: {
formatter: '{a} <br/>{b} : {c}%' formatter: '{a} <br/>{b} : {c}%'
@ -147,6 +151,10 @@
type: 'gauge', type: 'gauge',
detail: {formatter: '{value}℃', fontSize: 16}, detail: {formatter: '{value}℃', fontSize: 16},
showSymbol: false, showSymbol: false,
animation: false, // 关闭动画
// radius: '60%',
// startAngle: 180, // 仪表盘起始角度(默认 225
// endAngle: 0, // 仪表盘结束角度(默认 -45
data: [{value: tempData[i].value}] data: [{value: tempData[i].value}]
} }
] ]
@ -166,14 +174,22 @@
$("#monitorId").val(treeNode.id); $("#monitorId").val(treeNode.id);
var treeObj = $.fn.zTree.getZTreeObj("tree"); var treeObj = $.fn.zTree.getZTreeObj("tree");
var checkedNode = treeObj.getCheckedNodes(); var checkedNode = treeObj.getCheckedNodes();
monitorId.splice(0, monitorId.length) monitorId.splice(0, monitorId.length);
checkedNode.forEach(function (e) { checkedNode.forEach(function (e) {
monitorId.push(e.id); monitorId.push(e.id);
}); });
console.log("选择测控点:" + monitorId); console.log("选择测控点:" + monitorId);
monitorInfo = monitorId; monitorInfo = monitorId;
refreshInterval = window.setInterval(meterChart(), 3000); // 先清除之前的定时器,避免重复创建
if (refreshInterval) {
window.clearInterval(refreshInterval);
}
meterChart();
// 正确方式:传递函数引用(而不是调用结果)
refreshInterval = window.setInterval(function() {
meterChart();
}, 5000);
$.table.search(); $.table.search();
} }

Loading…
Cancel
Save