283 lines
11 KiB
Plaintext
283 lines
11 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">
|
||
|
||
|
||
var series1=[];
|
||
var series2=[];
|
||
var legendData1=[];
|
||
var legendData2=[];
|
||
/* 请求数据 */
|
||
function getValue() {
|
||
$.post(ext.contextPath + '/plan/getJspWholeInfoByPlanLayoutId.do', { planLayoutId: "${param.planLayoutId}" }, function (data) {
|
||
// console.log(data);
|
||
if(data!=''){
|
||
var nowHourP=0;
|
||
var lastHourP=0;
|
||
var nowdayP=0;
|
||
var lastdayP=0;
|
||
for(var i=0;i<data.length;i++){
|
||
if(data[i].elementCode=="line1"){
|
||
var datas=new Array();
|
||
for(var j=0;j<data[i].mPointHistory.length;j++){
|
||
const his=data[i].mPointHistory[j];
|
||
var ddata=new Array();
|
||
ddata.push(his.measuredt.substring(11,13));
|
||
ddata.push(his.parmvalue);
|
||
datas.push(ddata);
|
||
}
|
||
series1.push({
|
||
data: datas,
|
||
name: data[i].name,
|
||
type: 'line',
|
||
symbol:'none',
|
||
smooth: true
|
||
});
|
||
legendData1.push(data[i].name);
|
||
}else if(data[i].elementCode=="line2"){
|
||
var datas=new Array();
|
||
for(var j=0;j<data[i].mPointHistory.length;j++){
|
||
const his=data[i].mPointHistory[j];
|
||
var ddata=new Array();
|
||
ddata.push(his.measuredt.substring(11,13));
|
||
ddata.push(his.parmvalue);
|
||
datas.push(ddata);
|
||
}
|
||
series2.push({
|
||
data: datas,
|
||
name: data[i].name,
|
||
type: 'line',
|
||
symbol:'none',
|
||
smooth: true
|
||
});
|
||
legendData2.push(data[i].name);
|
||
}else if(data[i].elementCode=="hourWater"){
|
||
if(data[i].getValueType=="getLastHourFirst"){
|
||
if(data[i].mPointHistory.length>0){
|
||
if(data[i].mPointHistory[0]!=null){
|
||
nowHourP=data[i].mPointHistory[0].parmvalue;
|
||
}
|
||
}
|
||
|
||
}else if(data[i].getValueType=="getYesterdayNowHourFirstValue"){
|
||
if(data[i].mPointHistory.length>0){
|
||
if(data[i].mPointHistory[0]!=null){
|
||
lastHourP=data[i].mPointHistory[0].parmvalue;
|
||
}
|
||
}
|
||
}
|
||
}else if(data[i].elementCode=="dayWater"){
|
||
if(data[i].getValueType=="getTodaySumValue"){
|
||
if(data[i].mPointHistory.length>0){
|
||
if(data[i].mPointHistory[0]!=null){
|
||
nowdayP=data[i].mPointHistory[0].parmvalue;
|
||
}
|
||
}
|
||
}else if(data[i].getValueType=="getYesterdayHisHourSumValue"){
|
||
if(data[i].mPointHistory.length>0){
|
||
if(data[i].mPointHistory[0]!=null){
|
||
lastdayP=data[i].mPointHistory[0].parmvalue;
|
||
}
|
||
}
|
||
|
||
}
|
||
}
|
||
}
|
||
|
||
var hourhb=(nowHourP-lastHourP)/lastHourP*100;
|
||
hourhb=hourhb.toFixed(2);
|
||
$('#hourWaterP').text((nowHourP/10000).toFixed(2));
|
||
if(Number(hourhb)<0){
|
||
$('#hourWaterH').css("color","red");
|
||
$('#hourWaterH').text("⬇ 环比"+hourhb+"%");
|
||
}else{
|
||
$('#hourWaterH').css("color","#3fff00");
|
||
$('#hourWaterH').text("⬆ 环比"+hourhb+"%");
|
||
}
|
||
|
||
var dayhb=(nowdayP-lastdayP)/lastdayP*100;
|
||
dayhb=dayhb.toFixed(2);
|
||
$('#dayWaterP').text((nowdayP/10000).toFixed(2));
|
||
if(Number(dayhb)<0){
|
||
$('#dayWaterH').css("color","red");
|
||
$('#dayWaterH').text("⬇ 环比"+dayhb+"%");
|
||
}else{
|
||
$('#dayWaterH').css("color","#3fff00");
|
||
$('#dayWaterH').text("⬆ 环比"+dayhb+"%");
|
||
}
|
||
|
||
getchart('瞬时供水量',series1,legendData1);
|
||
|
||
}
|
||
}, 'json');
|
||
}
|
||
|
||
|
||
function getchart(title,series,legendData){
|
||
document.getElementById("chart").removeAttribute("_echarts_instance_");
|
||
var mychart=echarts.init(document.getElementById('chart'));
|
||
var option = {
|
||
color:['#815DB7','#20E9F2','#08A3A3'],
|
||
title: {
|
||
text: title,
|
||
top:10,
|
||
left:20,
|
||
textStyle:{
|
||
color:'#FFFFFF'
|
||
},
|
||
triggerEvent: true
|
||
},
|
||
legend: {
|
||
data: legendData,
|
||
top:10,
|
||
right:20,
|
||
textStyle:{
|
||
color:'#FFFFFF'
|
||
}
|
||
},
|
||
tooltip: {
|
||
trigger: 'axis'
|
||
},
|
||
grid:{
|
||
left: '4%', // 与容器左侧的距离
|
||
right: '4%', // 与容器右侧的距离
|
||
// top: '10%', // 与容器顶部的距离
|
||
bottom: '10%', // 与容器底部的距离
|
||
containLabel:true
|
||
},
|
||
xAxis: {
|
||
type:"category",
|
||
axisLine:{
|
||
lineStyle:{
|
||
color:'#ffffff',
|
||
}
|
||
},
|
||
axisTick: {
|
||
show: false
|
||
},
|
||
splitLine: {
|
||
show: false
|
||
}
|
||
},
|
||
yAxis: {
|
||
type : 'value',
|
||
axisLine:{
|
||
lineStyle:{
|
||
color:'#ffffff',
|
||
}
|
||
},
|
||
splitLine: {
|
||
show: true,
|
||
lineStyle:{
|
||
color: '#8C8C8C'
|
||
}
|
||
}
|
||
},
|
||
series: series
|
||
};
|
||
mychart.on('click', function (params) {
|
||
if(params.componentType && params.componentType === "title"){
|
||
if(params.event.topTarget.style.text === '瞬时供水量'){
|
||
getchart('累计供水量',series2,legendData2);
|
||
}else if(params.event.topTarget.style.text === '累计供水量'){
|
||
getchart('瞬时供水量',series1,legendData1);
|
||
}
|
||
}
|
||
})
|
||
// console.log(option);
|
||
mychart.setOption(option,true);
|
||
window.addEventListener("resize", function () {
|
||
myChart.resize();
|
||
});
|
||
}
|
||
|
||
/* 定时器 */
|
||
//setInterval(change, 60000); //每1分钟切换
|
||
setInterval(getValue, 3600000); //每一小时切换
|
||
|
||
/* 初始化 */
|
||
$(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";
|
||
|
||
getValue();
|
||
//console.log("height",document.body.scrollHeight);
|
||
});
|
||
|
||
//获取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;
|
||
}
|
||
|
||
</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-top:30px;padding-left:10px;padding-right:10px;">
|
||
<div style="height:100%;width:100%;">
|
||
<div style="float:left;width:100%;height:26px;margin-left: 20px;">
|
||
<div style="float:left;width:50%;height:26px;">
|
||
<div style="float:left;width:100px;height:26px;line-height: 26px;color: #ffffff;font-size: 20px;">
|
||
当前供水量
|
||
</div>
|
||
<div style="float:left;width:100px;height:26px;line-height: 26px;color: #ffffff;font-size: 16px;">
|
||
(万m3/h)
|
||
</div>
|
||
</div>
|
||
<div style="float:left;width:50%;height:26px;">
|
||
<div style="float:left;width:140px;height:26px;line-height: 26px;color: #ffffff;font-size: 20px;">
|
||
今日累计供水量
|
||
</div>
|
||
<div style="float:left;width:100px;height:26px;line-height: 26px;color: #ffffff;font-size: 16px;">
|
||
(万m3)
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<div style="float:left;width:100%;height:80px;margin-left: 20px;">
|
||
<div style="float:left;width:50%;height:80px;">
|
||
<div id="hourWaterP" style="float:left;height:80px;line-height: 80px;color: #69f6f9;font-size: 40px;">
|
||
</div>
|
||
<div id="hourWaterH" style="float:left;height:80px;line-height: 80px;font-size: 20px;padding-left: 10px;">
|
||
</div>
|
||
</div>
|
||
<div style="float:left;width:50%;height:80px;">
|
||
<div id="dayWaterP" style="float:left;height:80px;line-height: 80px;color: #69f6f9;font-size: 40px;">
|
||
</div>
|
||
<div id="dayWaterH" style="float:left;height:80px;line-height: 80px;font-size: 20px;padding-left: 10px;">
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<div style="float:left;width:100%;height:280px;margin-left: 20px;background: #16314c;">
|
||
<div id="chart" style="float:left;width: 100%;height: 100%;"></div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</body>
|
||
|
||
</html> |