Files
SIPAIIS_WMS_JSSW/WebRoot/jsp/visual/modules/bigScreen_energyManagement.jsp

234 lines
10 KiB
Plaintext
Raw Normal View History

2026-01-16 14:13:44 +08:00
<%@ 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;
}
var mychart="";
/* 请求数据 */
function getValue() {
$.post(ext.contextPath + '/plan/getJspWholeInfoByPlanLayoutId.do', { planLayoutId: "${param.planLayoutId}" }, function (data) {
// console.log(data);
if(data!=null&&data.length>0){
var series=[];
var yAxis=[];
var actualValue=0;
var targetValue=0;
var actualValueNum=0;
var targetValueNum=0;
var barcolor="#36BAFD";
for(var i=0;i<data.length;i++){
if(data[i].elementCode=="actualValue"){
if(actualValueNum==0){
barcolor="#3482FF";
}else if(actualValueNum==1){
barcolor="#C08F33";
}else if(actualValueNum==2||actualValueNum==3){
barcolor="#8D40CC";
}
actualValue=data[i].mPoint.parmvalue;
series.push({
name:data[i].name,
stack:data[i].name,
data: [actualValue],
yAxisIndex: actualValueNum,
type:'bar',
barWidth : 25,
barGap:1.8,
itemStyle:{
emphasis: {//柱形图圆角,鼠标移上去效果
color:barcolor,
barBorderRadius: [0, 0, 0, 0]
},
normal: {//柱形图圆角,初始化效果
color:barcolor,
barBorderRadius:[0, 0, 0, 0],
label: {
// formatter: "{a}",
formatter:function(params){ //标签内容
var name=params.seriesName.split("(");
return name[0];
},
show: true,
position: "bottom",
textStyle: {
// fontWeight: "bolder",
fontSize: "14",
color: "#FFFFFF"
}
}
}
}
});
yAxis.push({
type:'value',
show:false
});
actualValueNum++;
}else if(data[i].elementCode=="targetValue"){
// console.log(actualValue);
var tdata=[];
if(Number(data[i].valueUrl)-actualValue>0){
tdata.push((Number(data[i].valueUrl)-actualValue).toFixed(2));
}else{
tdata.push(0);
}
series.push({
name:actualValue.toFixed(2),
data: tdata,
stack:data[i].name,
yAxisIndex: targetValueNum,
type:'bar',
barWidth : 25,
barGap:1.8,
itemStyle:{
emphasis: {//柱形图圆角,鼠标移上去效果
color:'gray',
barBorderRadius: [10, 10,0,0]
},
normal: {//柱形图圆角,初始化效果
color:'gray',
barBorderRadius:[10, 10,0,0],
label: {
formatter: "{a}",
show: true,
position: "top",
textStyle: {
// fontWeight: "bolder",
fontSize: "14",
color: "#FFFFFF"
}
}
}
}
});
targetValueNum++;
}
}
mychart=echarts.init(document.getElementById('chart'));
var option = {
animation:false,
grid:{
// left: '1%', // 与容器左侧的距离
// right: '1%', // 与容器右侧的距离
top: '10%', // 与容器顶部的距离
bottom: '10%', // 与容器底部的距离
// containLabel:true
},
xAxis: {
type: 'category',
axisLabel: {
show: true,
align:'center',
textStyle: {
color: '#FFFFFF' //更改坐标轴文字颜色
}
},
axisLine:{
show:true,
lineStyle:{
color:'#3B415C', //更改坐标轴颜色
width: 2 // 粗细
}
},
axisTick: {
show: false
},
splitLine: {
show: false//是否显示分隔线。默认数值轴显示,类目轴不显示。
}
},
yAxis:yAxis,
series: series
};
// console.log(option);
mychart.setOption(option,true);
var textnum=data.length-actualValueNum;
var textHtml="";
for(var m=0;m<data.length;m++){
if(data[m].elementCode=="targetValue"){
textHtml+="<div style='float:left;width:100%;height: calc((100vh - 60px - 40px)/"+textnum+");'>";
textHtml+="<div style='float:left;width:100%;height: calc((100vh - 60px - 40px)/"+textnum+"/2);line-height: calc((100vh - 60px - 40px)/"+textnum+"/2);font-size: 18px;font-family: Helvetica;text-align: center;color: #ffffff;'>"+data[m].name+"</div>";
textHtml+="<div style='float:left;width:100%;height: calc((100vh - 60px - 40px)/"+textnum+"/2);line-height: calc((100vh - 60px - 40px)/"+textnum+"/2);font-size: 20px;font-family: Helvetica;text-align: center;color: #69F6F9;'>"+Number(data[m].valueUrl).toFixed(2)+"</div>";
// textHtml+="";
textHtml+="</div>";
}
}
$('#text').html(textHtml);
}
}, 'json');
}
/* 定时器 */
//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-15) + "px";
document.getElementById("backImage").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 style="height:100%;width:100%;padding-top:15px;">
<div id="main" style="height:100%;width:100%;padding:0px;background:rgba(19,32,85,0.27);border-radius: 8px;">
<div style='float:left;width:50%;height:60px;'><img id="backImage" src="" style="z-index:-1;position:relative;height:100%;width:100%;"/></div>
<div style='float:left;width:50%;height:60px;'></div>
<div id="chart" style="float:left;width:70%;height: calc(100vh - 60px - 15px);"></div>
<div style="float:left;width:30%;height: calc(100vh - 60px - 10px);">
<div id="titletext" style="float:left;width:100%;height:20px;color:#69F6F9;font-size:18px;text-align: center;margin-bottom: 15px;">计划值(灰色)</div>
<div id="text" style="float:left;width:100%;height: calc(100vh - 60px - 50px);margin-top: -10px;"></div>
</div>
</div>
</div>
</body>
</html>