390 lines
17 KiB
Plaintext
390 lines
17 KiB
Plaintext
<%@ page language="java" pageEncoding="UTF-8"%>
|
||
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
|
||
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
|
||
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
|
||
<%@ page import="com.sipai.entity.base.ServerObject"%>
|
||
<%@ taglib uri="http://www.springsecurity.org/jsp" prefix="security"%>
|
||
<%@page import="com.sipai.entity.visual.JspElement"%>
|
||
<%request.setAttribute("Type_GetValue", JspElement.Type_GetValue); %>
|
||
<%request.setAttribute("Type_Get7dayHistory", JspElement.Type_GetHourHistory); %>
|
||
<%request.setAttribute("Type_Get7dayHistory", JspElement.Type_Get7dayHistory); %>
|
||
<%request.setAttribute("Type_GetModbus", JspElement.Type_GetModbus); %>
|
||
<%request.setAttribute("Type_GetHttp", JspElement.Type_GetHttp); %>
|
||
<!DOCTYPE html>
|
||
<!-- <html lang="zh-CN"> -->
|
||
<!-- BEGIN HEAD -->
|
||
|
||
<head>
|
||
<title></title>
|
||
<!-- 引用页头及CSS页-->
|
||
<jsp:include page="/jsp/inc.jsp"></jsp:include>
|
||
<script type="text/javascript">
|
||
|
||
//获取url地址根目录 当前taomcat下路径
|
||
function getRootPath(){
|
||
var pathName = window.location.pathname.substring(1);
|
||
// var webName = pathName == '' ? '' : pathName.substring(0, pathName.indexOf('/'));
|
||
return window.location.protocol + '//' + window.location.host;
|
||
}
|
||
//获取url地址根目录 当前taomcat下路径
|
||
function getRootPath2(){
|
||
var pathName = window.location.pathname.substring(1);
|
||
var webName = pathName == '' ? '' : pathName.substring(0, pathName.indexOf('/'));
|
||
return window.location.protocol + '//' + window.location.host +"/"+webName;
|
||
}
|
||
|
||
function numOutput(num){
|
||
var numpart=String(num).split(".");//将数字通过jq split用小数点分隔为数组对象
|
||
numpart[0]=numpart[0].replace(new RegExp('(\\d)(?=(\\d{3})+$)','ig'),"$1,");
|
||
//将数组对象第一个数据(整数部分)通过正则表达式每三位用逗号分隔
|
||
return numpart.join(".");//把数组通过join方法用.进行拼接
|
||
}
|
||
|
||
var mychart="";
|
||
var lineData=[];
|
||
var lineData2=[];
|
||
var lineData3=[];
|
||
var lineData4=[];
|
||
/* 请求数据 */
|
||
function getValue() {
|
||
$.post(ext.contextPath + '/plan/getJspWholeInfoByPlanLayoutId.do', { planLayoutId: "${param.planLayoutId}" }, function (data) {
|
||
// console.log(data);
|
||
if(data!=''){
|
||
for(var i=0;i<data.length;i++){
|
||
if(data[i].elementCode=="waterTrend"){
|
||
var valueD=[];
|
||
if(data[i].mPointHistory!=''){
|
||
for(var h=0;h<data[i].mPointHistory.length;h++){
|
||
var value=[];
|
||
value.push(data[i].mPointHistory[h].measuredt.substring(5,10));
|
||
value.push(data[i].mPointHistory[h].parmvalue);
|
||
valueD.push(value);
|
||
}
|
||
$('#data1').text(numOutput((data[i].mPointHistory[data[i].mPointHistory.length-1].parmvalue).toFixed(0)));
|
||
}
|
||
lineData.push({
|
||
name:'实际值',
|
||
value:valueD
|
||
})
|
||
}else if(data[i].elementCode=="waterDesign"){
|
||
var valueD=[];
|
||
if(lineData!=''){
|
||
for(var h=0;h<lineData[0].value.length;h++){
|
||
var value=[];
|
||
value.push(lineData[0].value[h][0]);
|
||
value.push(data[i].visualCacheData.value);
|
||
valueD.push(value);
|
||
}
|
||
}
|
||
lineData.push({
|
||
name:'目标值',
|
||
value:valueD
|
||
})
|
||
}else if(data[i].elementCode=="mudTrend"){
|
||
var valueD=[];
|
||
if(data[i].mPointHistory!=''){
|
||
for(var h=0;h<data[i].mPointHistory.length;h++){
|
||
var value=[];
|
||
value.push(data[i].mPointHistory[h].measuredt.substring(5,10));
|
||
value.push(data[i].mPointHistory[h].parmvalue);
|
||
valueD.push(value);
|
||
}
|
||
$('#data2').text(numOutput((data[i].mPointHistory[data[i].mPointHistory.length-1].parmvalue).toFixed(0)));
|
||
}
|
||
lineData2.push({
|
||
name:'实际值',
|
||
value:valueD
|
||
})
|
||
}else if(data[i].elementCode=="mudDesign"){
|
||
var valueD=[];
|
||
if(lineData2!=''){
|
||
for(var h=0;h<lineData2[0].value.length;h++){
|
||
var value=[];
|
||
value.push(lineData2[0].value[h][0]);
|
||
value.push(data[i].visualCacheData.value);
|
||
valueD.push(value);
|
||
}
|
||
}
|
||
lineData2.push({
|
||
name:'目标值',
|
||
value:valueD
|
||
})
|
||
}else if(data[i].elementCode=="waterPowerTrend"){
|
||
var valueD=[];
|
||
if(data[i].mPointHistory!=''){
|
||
for(var h=0;h<data[i].mPointHistory.length;h++){
|
||
var value=[];
|
||
value.push(data[i].mPointHistory[h].measuredt.substring(5,10));
|
||
value.push(data[i].mPointHistory[h].parmvalue);
|
||
valueD.push(value);
|
||
}
|
||
$('#data3').text(numOutput((data[i].mPointHistory[data[i].mPointHistory.length-1].parmvalue).toFixed(2)));
|
||
}
|
||
lineData3.push({
|
||
name:'实际值',
|
||
value:valueD
|
||
})
|
||
}else if(data[i].elementCode=="waterPowerDesign"){
|
||
var valueD=[];
|
||
if(lineData3!=''){
|
||
for(var h=0;h<lineData3[0].value.length;h++){
|
||
var value=[];
|
||
value.push(lineData3[0].value[h][0]);
|
||
value.push(data[i].visualCacheData.value);
|
||
valueD.push(value);
|
||
}
|
||
}
|
||
lineData3.push({
|
||
name:'目标值',
|
||
value:valueD
|
||
})
|
||
}else if(data[i].elementCode=="waterDrugTrend"){
|
||
var valueD=[];
|
||
if(data[i].mPointHistory!=''){
|
||
for(var h=0;h<data[i].mPointHistory.length;h++){
|
||
var value=[];
|
||
value.push(data[i].mPointHistory[h].measuredt.substring(5,10));
|
||
value.push(data[i].mPointHistory[h].parmvalue);
|
||
valueD.push(value);
|
||
}
|
||
$('#data4').text(numOutput((data[i].mPointHistory[data[i].mPointHistory.length-1].parmvalue).toFixed(0)));
|
||
}
|
||
lineData4.push({
|
||
name:'实际值',
|
||
value:valueD
|
||
})
|
||
}else if(data[i].elementCode=="electricPowerDesign"){
|
||
var valueD=[];
|
||
if(lineData4!=''){
|
||
for(var h=0;h<lineData4[0].value.length;h++){
|
||
var value=[];
|
||
value.push(lineData4[0].value[h][0]);
|
||
value.push(data[i].visualCacheData.value);
|
||
valueD.push(value);
|
||
}
|
||
}
|
||
lineData4.push({
|
||
name:'目标值',
|
||
value:valueD
|
||
})
|
||
}
|
||
}
|
||
}
|
||
|
||
doline('lineChart',lineData,'m³/D');
|
||
}, 'json');
|
||
}
|
||
var colorList = ['#F55945', '#74A8FF'];
|
||
function doline(id,data,unit){
|
||
var series = new Array;
|
||
data.forEach(function(val,i){
|
||
series[i] = {
|
||
name: val.name,
|
||
type: 'line',
|
||
data: val.value,
|
||
smooth: true,
|
||
showSymbol: false,
|
||
areaStyle: {
|
||
// 线性渐变,前四个参数分别是 x0, y0, x2, y2, 范围从 0 - 1,相当于在图形包围盒中的百分比,如果 globalCoord 为 `true`,则该四个值是绝对的像素位置
|
||
color: {
|
||
type: 'linear',
|
||
x: 0,
|
||
y: 0.9,
|
||
x2: 0,
|
||
y2: 0,
|
||
colorStops: [{
|
||
offset: 0, color: 'transparent'
|
||
}, {
|
||
offset: 1, color: colorList[i] // 100% 处的颜色
|
||
}],
|
||
global: false // 缺省为 false
|
||
}
|
||
},
|
||
lineStyle:{
|
||
color:colorList[i],
|
||
width:4
|
||
},
|
||
};
|
||
});
|
||
// 基于准备好的dom,初始化echarts实例
|
||
var myChart = echarts.init(document.getElementById(id));
|
||
var option = {
|
||
color: colorList,
|
||
tooltip: {
|
||
trigger: 'axis',
|
||
},
|
||
legend: {
|
||
top: 0,
|
||
left: 10,
|
||
icon:'circle',
|
||
textStyle: {
|
||
color: '#61798F' ,
|
||
lineHeight: 16,
|
||
fontSize: 13 ,
|
||
fontWeight : 600 ,
|
||
},
|
||
},
|
||
grid: {
|
||
left: '1%',
|
||
right: '5%',
|
||
top: '20%',
|
||
bottom: '5%',
|
||
containLabel: true
|
||
},
|
||
xAxis: {
|
||
type : 'category',
|
||
boundaryGap: false,
|
||
axisLabel: {
|
||
color:'#8A88B7',
|
||
},
|
||
axisLine: {
|
||
show: false
|
||
},
|
||
axisTick: {
|
||
show: false
|
||
},
|
||
},
|
||
yAxis: {
|
||
name:unit,
|
||
nameTextStyle:{
|
||
color:'#8A88B7'
|
||
},
|
||
type: 'value',
|
||
splitNumber: 3 ,
|
||
axisLine: {
|
||
show: false
|
||
},
|
||
axisTick: {
|
||
show: false
|
||
},
|
||
axisLabel: {
|
||
color:'#8A88B7',
|
||
},
|
||
//网格样式
|
||
splitLine: {
|
||
show: true,
|
||
lineStyle:{
|
||
color: '#8A88B7',
|
||
type: 'dashed'
|
||
}
|
||
}
|
||
},
|
||
series: series
|
||
};
|
||
myChart.clear();
|
||
myChart.setOption(option, true);
|
||
}
|
||
|
||
/* 定时器 */
|
||
//setInterval(change, 60000); //每1分钟切换
|
||
setInterval(getValue, 3600000); //每一小时切换
|
||
var num=1;
|
||
$(function(){
|
||
setInterval (showChart, 10000);
|
||
function showChart(){
|
||
if(num==0){
|
||
doline('lineChart',lineData,'m³/D');
|
||
document.getElementById("table1").style.background = "#238072";
|
||
document.getElementById("table2").style.background = "#16314c";
|
||
document.getElementById("table3").style.background = "#16314c";
|
||
document.getElementById("table4").style.background = "#16314c";
|
||
num++;
|
||
}else if(num==1){
|
||
doline('lineChart',lineData2,'吨');
|
||
document.getElementById("table1").style.background = "#16314c";
|
||
document.getElementById("table2").style.background = "#238072";
|
||
document.getElementById("table3").style.background = "#16314c";
|
||
document.getElementById("table4").style.background = "#16314c";
|
||
num++;
|
||
}else if(num==2){
|
||
doline('lineChart',lineData3,'kwh/t');
|
||
document.getElementById("table1").style.background = "#16314c";
|
||
document.getElementById("table2").style.background = "#16314c";
|
||
document.getElementById("table3").style.background = "#238072";
|
||
document.getElementById("table4").style.background = "#16314c";
|
||
num++;
|
||
}else if(num==3){
|
||
doline('lineChart',lineData4,'kwh');
|
||
document.getElementById("table1").style.background = "#16314c";
|
||
document.getElementById("table2").style.background = "#16314c";
|
||
document.getElementById("table3").style.background = "#16314c";
|
||
document.getElementById("table4").style.background = "#238072";
|
||
num=0;
|
||
}
|
||
}
|
||
})
|
||
/* 初始化 */
|
||
$(function () {
|
||
if('${param.backgroundColor}'=='transparent'){
|
||
document.body.style.backgroundColor = '${param.backgroundColor}';
|
||
}else{
|
||
document.body.style.backgroundColor = "#" + '${param.backgroundColor}';
|
||
}
|
||
document.getElementById("main").style.width = document.documentElement.clientWidth + "px";
|
||
document.getElementById("main").style.height = (document.documentElement.clientHeight) + "px";
|
||
|
||
document.getElementById("backImage").src = ""+getRootPath()+"/images/大屏/KPI管理.png";
|
||
document.getElementById("backImage2").src = ""+getRootPath()+"/images/大屏/水量.png";
|
||
document.getElementById("backImage3").src = ""+getRootPath()+"/images/大屏/泥量.png";
|
||
document.getElementById("backImage4").src = ""+getRootPath()+"/images/大屏/电.png";
|
||
document.getElementById("backImage5").src = ""+getRootPath()+"/images/大屏/电.png";
|
||
|
||
getValue();
|
||
//console.log("height",document.body.scrollHeight);
|
||
});
|
||
|
||
</script>
|
||
|
||
</head>
|
||
|
||
<body style="width:100%;height:100%;margin:0;padding:0;overflow-x:hidden;overflow-y:hidden;">
|
||
<div id="main" style="height:100%;width:100%;padding-left:30px;padding-right:30px;padding-bottom:30px;">
|
||
<div style="height:100%;width:100%;background:#16314C;border-radius: 8px;">
|
||
<div style="float:left;width:100%;height:80px;"><img id="backImage" src="" style="z-index:999;position:relative;height:100%;width: 25%;"/></div>
|
||
<div style="float:left;width:35%;height:calc(100% - 80px);">
|
||
<div style="float:left;width:100%;height:25%;padding-left: 20px;padding-right: 20px;padding-top:10px;padding-bottom:10px;">
|
||
<table id="table1" style="width: 100%;height:100%;background: #238072;border-radius: 18px;box-shadow: 9px 9px 12px 0px #0e2439, -9px -9px 12px 0px #203e5d;text-align: center;vertical-align: middle;">
|
||
<tr>
|
||
<td width="30%" style="color: #ffffff;"><img id="backImage2" src="" style="z-index:999;position:relative;height:45px;width:45px;"/></td>
|
||
<td width="30%" style="color: #ffffff;"><div style="float:left;width:100%;font-size:16px;text-align: left;">昨日水量</div><div style="float:left;width:100%;font-size:12px;text-align: left;">/m³</div></td>
|
||
<td id="data1" width="50%" style="color: #ffffff;font-size:24px;letter-spacing: 4px;"></td>
|
||
</tr>
|
||
</table>
|
||
</div>
|
||
<div style="float:left;width:100%;height:25%;padding-left: 20px;padding-right: 20px;padding-top:10px;padding-bottom:10px;">
|
||
<table id="table2" style="width: 100%;height:100%;background: #16314c;border-radius: 18px;box-shadow: 9px 9px 12px 0px #0e2439, -9px -9px 12px 0px #203e5d;text-align: center;vertical-align: middle;">
|
||
<tr>
|
||
<td width="30%" style="color: #ffffff;"><img id="backImage3" src="" style="z-index:999;position:relative;height:45px;width:45px;"/></td>
|
||
<td width="30%" style="color: #ffffff;"><div style="float:left;width:100%;font-size:16px;text-align: left;">昨日泥量</div><div style="float:left;width:100%;font-size:12px;text-align: left;">/t</div></td>
|
||
<td id="data2" width="50%" style="color: #ffffff;font-size:24px;letter-spacing: 4px;"></td>
|
||
</tr>
|
||
</table>
|
||
</div>
|
||
<div style="float:left;width:100%;height:25%;padding-left: 20px;padding-right: 20px;padding-top:10px;padding-bottom:10px;">
|
||
<table id="table3" style="width: 100%;height:100%;background: #16314c;border-radius: 18px;box-shadow: 9px 9px 12px 0px #0e2439, -9px -9px 12px 0px #203e5d;text-align: center;vertical-align: middle;">
|
||
<tr>
|
||
<td width="30%" style="color: #ffffff;"><img id="backImage4" src="" style="z-index:999;position:relative;height:45px;width:45px;"/></td>
|
||
<td width="30%" style="color: #ffffff;"><div style="float:left;width:100%;font-size:16px;text-align: left;">吨水电耗</div><div style="float:left;width:100%;font-size:12px;text-align: left;">/kwh/t</div></td>
|
||
<td id="data3" width="50%" style="color: #ffffff;font-size:24px;letter-spacing: 4px;"></td>
|
||
</tr>
|
||
</table>
|
||
</div>
|
||
<div style="float:left;width:100%;height:25%;padding-left: 20px;padding-right: 20px;padding-top:10px;padding-bottom:10px;">
|
||
<table id="table4" style="width: 100%;height:100%;background: #16314c;border-radius: 18px;box-shadow: 9px 9px 12px 0px #0e2439, -9px -9px 12px 0px #203e5d;text-align: center;vertical-align: middle;">
|
||
<tr>
|
||
<td width="30%" style="color: #ffffff;"><img id="backImage5" src="" style="z-index:999;position:relative;height:45px;width:45px;"/></td>
|
||
<td width="30%" style="color: #ffffff;"><div style="float:left;width:100%;font-size:16px;text-align: left;">用电量</div><div style="float:left;width:100%;font-size:12px;text-align: left;">/kwh</div></td>
|
||
<td id="data4" width="50%" style="color: #ffffff;font-size:24px;letter-spacing: 4px;"></td>
|
||
</tr>
|
||
</table>
|
||
</div>
|
||
|
||
</div>
|
||
<div style="float:left;width:65%;height:calc(100% - 80px);">
|
||
<div id="lineChart" style="width:100%;height:100%;padding: 20px;"></div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</body>
|
||
|
||
</html> |