添加振动监控图表

master
夜笙歌 2 months ago
parent eda254a346
commit 3ed7c62796

@ -1,432 +1,424 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro"> <html lang="zh" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro" xmlns:th="http://www.thymeleaf.org">
<head> <head>
<th:block th:include="include :: header('振动数据曲线')" /> <th:block th:include="include :: header('振动数据曲线')"/>
<th:block th:include="include :: layout-latest-css" /> <th:block th:include="include :: layout-latest-css"/>
<th:block th:include="include :: ztree-css" /> <th:block th:include="include :: ztree-css"/>
<th:block th:include="include :: datetimepicker-css" /> <th:block th:include="include :: datetimepicker-css"/>
</head> </head>
<style>
.echarts{
width: 49%;
display: inline-block;
}
</style>
<body class="gray-bg"> <body class="gray-bg">
<div class="ui-layout-west"> <div class="ui-layout-west">
<div class="box box-main"> <div class="box box-main">
<div class="box-header"> <div class="box-header">
<div class="box-title"> <div class="box-title">
<i class="fa icon-grid"></i> 测控点信息 <i class="fa icon-grid"></i> 测控点信息
</div> </div>
<div class="box-tools pull-right"> <div class="box-tools pull-right">
<a type="button" class="btn btn-box-tool" href="#" onclick="dept()" title="测控点信息"><i class="fa fa-edit"></i></a> <a class="btn btn-box-tool" href="#" onclick="dept()" title="测控点信息" type="button"><i class="fa fa-edit"></i></a>
<button type="button" class="btn btn-box-tool" id="btnExpand" title="展开" style="display:none;"><i class="fa fa-chevron-up"></i></button> <button class="btn btn-box-tool" id="btnExpand" style="display:none;" title="展开" type="button"><i
<button type="button" class="btn btn-box-tool" id="btnCollapse" title="折叠"><i class="fa fa-chevron-down"></i></button> class="fa fa-chevron-up"></i></button>
<button type="button" class="btn btn-box-tool" id="btnRefresh" title="刷新"><i class="fa fa-refresh"></i></button> <button class="btn btn-box-tool" id="btnCollapse" title="折叠" type="button"><i class="fa fa-chevron-down"></i>
</div> </button>
</div> <button class="btn btn-box-tool" id="btnRefresh" title="刷新" type="button"><i class="fa fa-refresh"></i></button>
<div class="ui-layout-content"> </div>
<div id="tree" class="ztree"></div>
</div>
</div> </div>
<div class="ui-layout-content">
<div class="ztree" id="tree"></div>
</div>
</div>
</div> </div>
<div class="ui-layout-center"> <div class="ui-layout-center">
<div class="container-div"> <div class="container-div">
<div class="row"> <div class="row">
<div class="col-sm-12 search-collapse"> <div class="col-sm-12 search-collapse">
<form id="formId"> <form id="formId">
<input type="hidden" id="monitorId" name="monitorId"> <input id="monitorId" name="monitorId" type="hidden">
<div class="select-list"> <div class="select-list">
<ul> <ul>
<li class="select-time"> <li class="select-time">
<label>采集时间:</label><input type="text" class="form-control" style="width: 150px" id="laydate-demo-3" placeholder="开始时间" name="params[beginCollectTime]"/> <label>采集时间:</label><input class="form-control" id="laydate-demo-3" name="params[beginCollectTime]"
<span>-</span> placeholder="开始时间"
<input type="text" class="form-control" id="laydate-demo-4" style="width: 150px" placeholder="结束时间" name="params[endCollectTime]"/> style="width: 150px" type="text"/>
</li> <span>-</span>
<li> <input class="form-control" id="laydate-demo-4" name="params[endCollectTime]" placeholder="结束时间"
<!-- <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search();"><i class="fa fa-search"></i>&nbsp;搜索</a>--> style="width: 150px"
<!-- <a class="btn btn-primary btn-rounded btn-sm" onclick="getdata($('#monitorId').val())"><i class="fa fa-search"></i>&nbsp;搜索</a>--> type="text"/>
<!-- <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>--> </li>
</li> <li>
<!-- <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search();"><i class="fa fa-search"></i>&nbsp;搜索</a>-->
<!-- <a class="btn btn-primary btn-rounded btn-sm" onclick="getdata($('#monitorId').val())"><i class="fa fa-search"></i>&nbsp;搜索</a>-->
<!-- <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>-->
</li>
</ul> </ul>
</div> </div>
</form> </form>
</div> </div>
<div class="ibox-content" style="margin-top: 80px;margin-right: 0px;"> <div class="ibox-content" style="margin-top: 80px;margin-right: 0px;">
<div class="echarts" id="echarts-line-chart" style="height: 620px"></div> <div class="echarts" id="echarts-line-chart" style="height: 40vh"></div>
</div> <div class="echarts" id="echarts-line-chart1" style="height: 40vh"></div>
<div class="col-sm-12 select-table table-striped"> <div class="echarts" id="echarts-line-chart2" style="height: 40vh"></div>
<table id="bootstrap-table"></table> <div class="echarts" id="echarts-line-chart3" style="height: 40vh"></div>
</div> </div>
</div>
</div> </div>
</div>
</div> </div>
<th:block th:include="include :: footer" /> <th:block th:include="include :: footer"/>
<th:block th:include="include :: layout-latest-js" /> <th:block th:include="include :: layout-latest-js"/>
<th:block th:include="include :: ztree-js" /> <th:block th:include="include :: ztree-js"/>
<th:block th:include="include :: echarts-js" /> <th:block th:include="include :: echarts-js"/>
<th:block th:include="include :: datetimepicker-js" /> <th:block th:include="include :: datetimepicker-js"/>
<script src="../../../js/common/echarts.min.js"></script>
<script th:inline="javascript"> <script th:inline="javascript">
var prefix = ctx + "report/temandhumreport"
var timedata = [];
var tempreturedata = [];
var humdata = [];
layui.use('laydate', function () {
var laydate = layui.laydate;
laydate.render({
elem: '#laydate-demo-3',
type: 'datetime',
trigger: 'click'
});
var prefix = ctx + "report/temandhumreport" laydate.render({
var timedata=[]; elem: '#laydate-demo-4',
var tempreturedata=[]; type: 'datetime',
var humdata=[]; trigger: 'click'
layui.use('laydate', function(){
var laydate = layui.laydate;
laydate.render({
elem: '#laydate-demo-3',
type: 'datetime',
trigger: 'click'
});
laydate.render({
elem: '#laydate-demo-4',
type: 'datetime',
trigger: 'click'
});
}); });
$(function() { });
$(function () {
var panehHidden = false; var panehHidden = false;
// var time=getNowFormatDate(); // var time=getNowFormatDate();
// console.log(time); // console.log(time);
getdata(null); getdata(null);
if ($(this).width() < 769) { if ($(this).width() < 769) {
panehHidden = true; panehHidden = true;
} }
$('body').layout({ initClosed: panehHidden, west__size: 185 }); $('body').layout({initClosed: panehHidden, west__size: 185});
// initTable(); // initTable();
queryUserList(); queryUserList();
queryDeptTree(); queryDeptTree();
}); });
function queryUserList() { function queryUserList() {
var options = { var options = {
url: prefix + "/list", url: prefix + "/list",
modalName: "压缩空气实时数据", modalName: "压缩空气数据曲线",
columns: [{ columns: [{
checkbox: true checkbox: true
}, },
{ {
field: 'objid', field: 'objid',
title: '自增标识', title: '自增标识',
visible: false visible: false
}, },
{ {
field: 'monitorId', field: 'monitorId',
title: '测控点编号' title: '测控点编号'
}, },
{ {
field: 'between', field: 'between',
title: '采集时间' title: '采集时间'
}, },
{ {
field: 'temmaxNumber', field: 'temmaxNumber',
title: '温度最大值' title: '温度最大值'
}, },
{ {
field: 'temminNumber', field: 'temminNumber',
title: '温度最小值' title: '温度最小值'
}, },
{ {
field: 'temavgNumber', field: 'temavgNumber',
title: '温度平均值' title: '温度平均值'
}, },
{ {
field: 'hummaxNumber', field: 'hummaxNumber',
title: '湿度最大值' title: '湿度最大值'
}, },
{ {
field: 'humminNumber', field: 'humminNumber',
title: '湿度最小值' title: '湿度最小值'
}, },
{ {
field: 'humavgNumber', field: 'humavgNumber',
title: '湿度平均值' title: '湿度平均值'
}, },
] ]
}; };
$.table.init(options); $.table.init(options);
} }
function queryDeptTree() function queryDeptTree() {
{ var url = ctx + "system/Monitor/treeData?monitorType=20";
var url = ctx + "system/Monitor/treeData?monitorType=20"; var options = {
var options = { url: url,
url: url, expandLevel: 1,
expandLevel: 1, onClick: zOnClick,
onClick : zOnClick,
}; };
$.tree.init(options); $.tree.init(options);
function zOnClick(event, treeId, treeNode) { function zOnClick(event, treeId, treeNode) {
$("#monitorId").val(treeNode.id); $("#monitorId").val(treeNode.id);
/*alert(treeNode.id)*/ /*alert(treeNode.id)*/
$.table.search(); $.table.search();
getdata(treeNode.id); getdata(treeNode.id);
}
} }
}
$('#btnExpand').click(function() { $('#btnExpand').click(function () {
$._tree.expandAll(true); $._tree.expandAll(true);
$(this).hide(); $(this).hide();
$('#btnCollapse').show(); $('#btnCollapse').show();
}); });
$('#btnCollapse').click(function() { $('#btnCollapse').click(function () {
$._tree.expandAll(false); $._tree.expandAll(false);
$(this).hide(); $(this).hide();
$('#btnExpand').show(); $('#btnExpand').show();
}); });
$('#btnRefresh').click(function() { $('#btnRefresh').click(function () {
queryDeptTree(); queryDeptTree();
}); });
/* 社区信息 */ /* 社区信息 */
function dept() { function dept() {
var url = ctx + "system/Monitor"; var url = ctx + "system/Monitor";
$.modal.openTab("社区信息", url); $.modal.openTab("社区信息", url);
} }
function getdata(monitorId) {
var formData = new FormData();
formData.append("monitorId",monitorId);
formData.append("startTime",$("#laydate-demo-3").val());
formData.append("endTime",$("#laydate-demo-4").val());
$.ajax({
url: prefix + "/getdata",
type: 'post',
cache: false,
data: formData,
processData: false,
contentType: false,
dataType: "json",
success: function(result) {
console.log(result);
result.data.forEach(function(e){ function getdata(monitorId) {
// console.log(e.fluxData); var formData = new FormData();
timedata.push(e.collectTime); formData.append("monitorId", monitorId);
tempreturedata.push(e.tempreture); formData.append("startTime", $("#laydate-demo-3").val());
humdata.push(e.humidity); formData.append("endTime", $("#laydate-demo-4").val());
}); $.ajax({
design(); url: ctx + "system/TVibrationsensorData/sensorList",
} type: 'post',
}); cache: false,
} data: formData,
processData: false,
contentType: false,
dataType: "json",
success: function (result) {
design(result.data);
}
});
}
function design() { function design(e) {
var lineChart = echarts.init(document.getElementById("echarts-line-chart")); console.log(e)
// var lineoption = { let lineChart = echarts.init(document.getElementById("echarts-line-chart"));
// title: { let lineChart1 = echarts.init(document.getElementById("echarts-line-chart1"));
// text: '温湿度实时数据', let lineChart2 = echarts.init(document.getElementById("echarts-line-chart2"));
// left: 'center' let lineChart3 = echarts.init(document.getElementById("echarts-line-chart3"));
// }, lineChart.setOption({
// tooltip: { title: {
// trigger: 'axis', text: '温度数据曲线(℃)',
// axisPointer: { left: 'center'
// animation: false },
// } tooltip: {
// }, trigger: 'axis',
// legend: { axisPointer: {
// data: ['温度', '湿度'], animation: false
// left: 10 }
// }, },
// toolbox: { legend: {
// feature: { data: ['温度'],
// dataZoom: { left: 10
// yAxisIndex: 'none' },
// }, dataZoom: [
// restore: {}, {
// saveAsImage: {} show: true,
// } realtime: true,
// }, start: 0,
// axisPointer: { end: 100,
// link: {xAxisIndex: 'all'} xAxisIndex: 0
// }, },
// dataZoom: [ {
// { type: 'inside',
// show: true, realtime: true,
// realtime: true, start: 30,
// start: 0, end: 70,
// end: 100, xAxisIndex: 0
// xAxisIndex: [0, 1] }
// }, ],
// { xAxis: {
// type: 'inside', type: 'category',
// realtime: true, data: e.map(v=>v.collectTime)
// start: 30, },
// end: 70, yAxis: {
// xAxisIndex: [0, 1] type: 'value'
// } },
// ], series: [
// grid: [{ {
// left: 50, data: e.map(v=>v.temperature),
// right: 50, type: 'line'
// height: '35%' }
// }, { ]
// left: 50, });
// right: 50, lineChart1.setOption({
// top: '55%', title: {
// height: '35%' text: '速度数据曲线(mm/s)',
// }], left: 'center'
// xAxis: [ },
// { tooltip: {
// type: 'category', trigger: 'axis',
// boundaryGap: false, axisPointer: {
// axisLine: {onZero: true}, animation: false
// data: timedata }
// }, },
// { legend: {
// gridIndex: 1, data: ['速度'],
// type: 'category', left: 10
// boundaryGap: false, },
// axisLine: {onZero: true}, dataZoom: [
// data: timedata, {
// position: 'top' show: true,
// } realtime: true,
// start: 0,
// ], end: 100,
// yAxis: [ xAxisIndex: 0
// { },
// name: '温度', {
// type: 'value' type: 'inside',
// realtime: true,
// }, start: 30,
// { end: 70,
// gridIndex: 1, xAxisIndex: 0
// name: '湿度', }
// type: 'value', ],
// inverse: true xAxis: {
// } type: 'category',
// ], data: e.map(v=>v.collectTime)
// series: [ },
// yAxis: {
// { type: 'value'
// name: '温度', },
// type: 'line', series: [
// symbolSize: 8, {
// hoverAnimation: false, data: e.map(v=>v.speed),
// data:tempreturedata, type: 'line'
// smooth: true, }
// markPoint : { ]
// data : [ }, true);
// {type : 'max', name: '最大值'}, lineChart2.setOption({
// {type : 'min', name: '最小值'} title: {
// ] text: '位移数据曲线(um)',
// }, left: 'center'
// }, },
// { tooltip: {
// name: '湿度', trigger: 'axis',
// type: 'line', axisPointer: {
// xAxisIndex: 1, animation: false
// yAxisIndex: 1, }
// symbolSize: 8, },
// hoverAnimation: false, legend: {
// data:humdata, data: ['位移'],
// smooth: true, left: 10
// markPoint : { },
// data : [ dataZoom: [
// {type : 'max', name: '最大值'}, {
// {type : 'min', name: '最小值'} show: true,
// ] realtime: true,
// }, start: 0,
// } end: 100,
// ] xAxisIndex: 0
// }; },
var lineoption = { {
title: { type: 'inside',
text: '温度实时数据', realtime: true,
left: 'center' start: 30,
}, end: 70,
tooltip: { xAxisIndex: 0
trigger: 'axis', }
axisPointer: { ],
animation: false xAxis: {
} type: 'category',
}, data: e.map(v=>v.collectTime)
legend: { },
data: ['温度'], yAxis: {
left: 10 type: 'value'
}, },
toolbox: { series: [
feature: { {
dataZoom: { data: e.map(v=>v.displacement),
yAxisIndex: 'none' type: 'line'
}, }
restore: {}, ]
saveAsImage: {} }, true);
} lineChart3.setOption({
}, title: {
axisPointer: { text: '加速度数据曲线(g)',
link: { xAxisIndex: 'all' } left: 'center'
}, },
dataZoom: [ tooltip: {
{ trigger: 'axis',
show: true, axisPointer: {
realtime: true, animation: false
start: 0, }
end: 100, },
xAxisIndex: 0 legend: {
}, data: ['加速度'],
{ left: 10
type: 'inside', },
realtime: true, dataZoom: [
start: 30, {
end: 70, show: true,
xAxisIndex: 0 realtime: true,
} start: 0,
], end: 100,
grid: { xAxisIndex: 0
left: 50, },
right: 50, {
height: '60%' // 调整height值以适应图表位置 type: 'inside',
}, realtime: true,
xAxis: { start: 30,
type: 'category', end: 70,
boundaryGap: false, xAxisIndex: 0
axisLine: { onZero: true }, }
data: timedata ],
}, xAxis: {
yAxis: { type: 'category',
name: '温度', data: e.map(v=>v.collectTime)
type: 'value' },
}, yAxis: {
series: [ type: 'value'
{ },
name: '温度', series: [
type: 'line', {
symbolSize: 8, data: e.map(v=>v.acceleration),
hoverAnimation: false, type: 'line'
data: tempreturedata, }
smooth: true, ]
markPoint: { }, true);
data: [
{ type: 'max', name: '最大值' },
{ type: 'min', name: '最小值' }
]
},
}
]
};
lineChart.setOption(lineoption,true); $(window).resize(lineChart.resize);
$(window).resize(lineChart.resize); $(window).resize(lineChart1.resize);
timedata.splice(0,timedata.length); $(window).resize(lineChart2.resize);
tempreturedata.splice(0,tempreturedata.length); $(window).resize(lineChart3.resize);
humdata.splice(0,humdata.length); }
//console.log(timedata)
}
</script> </script>
</body> </body>
</html> </html>

Loading…
Cancel
Save