Files
SIPAIIS_WMS_JSSW/WebRoot/jsp/timeefficiency/electricityCostAnalysis.jsp
2026-01-16 14:13:44 +08:00

1209 lines
34 KiB
Plaintext
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<%@ 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"%>
<html:html lang="true">
<head>
<jsp:include page="/jsp/inc.jsp"></jsp:include>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<link rel="StyleSheet" href="CSS/comm2.css" type="text/css" />
<link href="bootstrap/css/bootstrap.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="JS/comm.js"></script>
<script type="text/javascript" src="JS/echarts3.0.js"></script>
<script type="text/javascript" src="My97DatePicker/WdatePicker.js"></script>
<script type="text/javascript" src="JS/jquery-1.4.2.js"></script>
<script src="bootstrap/js/jquery.min.js" type="text/javascript"></script>
<script src="bootstrap/js/bootstrap.min.js" type="text/javascript"></script>
<script type="text/javascript" src="jquery-easyui-1.3.2/jquery-1.8.0.min.js"></script>
<script type="text/javascript" src="bootstrap/layer/layer.js"></script>
<!-- <script type="text/javascript" src="bootstrap/js/bootstrap.min.js"></script> -->
<style type="text/css">
.floattop_div {
width: 100%;
height: 42%;
margin-left:5px;
margin-top:5px;
/* background: red; */
border:0px solid #8B8386;
float: left;
}
.floattop_div_1 {
width: 35%;
height: 100%;
margin-left:5px;
margin-top:5px;
/* background: red; */
border:0px solid #8B8386;
float: left;
}
.floattop_div_2 {
width: 32%;
height: 100%;
margin-left:5px;
margin-top:5px;
border:1px solid #d7d8d9;
float: left;
}
.floattop_div_3 {
width: 30%;
height: 100%;
margin-left:5px;
margin-top:5px;
border:0px solid #8B8386;
float: left;
}
.floatbottom_div {
width: 100%;
height: 45%;
margin-left:5px;
margin-top:5px;
border:0px solid #8B8386;
float: left;
}
.floatbottom_div_1 {
width: 35%;
height: 100%;
margin-left:5px;
margin-top:5px;
border:0px solid #8B8386;
float: left;
}
.floatbottom_div_2 {
width: 62.7%;
height: 100%;
margin-left:5px;
margin-top:5px;
border:0px solid #8B8386;
float: left;
}
/* .floatbottom_div_3 {
width: 30%;
height: 100%;
margin-left:5px;
margin-top:5px;
border:0px solid #8B8386;
float: left;
} */
.tpt-bar {
display:flex;
border:1px solid #e2e2e2;
border-radius:2px;
background:#E3E4E6;
box-shadow:0 2px 5px 0 rgba(0,0,0,.1);
flex-wrap:wrap;
}
.tpt-bar label {
display:block;
padding:0 20px;
height:38px;
line-height:38px;
cursor:pointer;
order:1;
}
.tpt-bar .tpt-bar-con {
z-index:0;
display:none;
margin-top:-1px;
padding:10px;
width:100%;
min-height:120px;
border-top:1px solid #e2e2e2;
background:#fff;
order:99;
}
.tpt-bar input[type=radio] {
position:absolute;
opacity:0;
}
.tpt-bar input[type=radio]:checked+label {
z-index:1;
margin-right:-1px;
margin-left:-1px;
border-right:1px solid #e2e2e2;
border-left:1px solid #e2e2e2;
background:#fff;
}
.tpt-bar input[type=radio]:checked+label+.tpt-bar-con {
display:block;
}
</style>
<script type="text/javascript">
var maindfgcjson="";
var mainscjyjson="";
function dojfdfhtml(){
$("#showdata").datepicker({
format: "yyyy-mm",
todayBtn: "linked",
startView: 1,
minViewMode: 1,
language: "zh-CN",
orientation: "bottom auto",
autoclose: true,
todayHighlight: true
});
var showdata=$('#showdata').val();
$("#jfdfjson").bootstrapTable({ // 对应table标签的id
url: ext.contextPath + '/timeEfficiency/electricityPrice/getElectricityPricelist2.do', // 获取表格数据的url
cache: false, // 设置为 false 禁用 AJAX 数据缓存, 默认为true
striped: true, //表格显示条纹默认为false
pagination: true, // 在表格底部显示分页组件默认false
pageList: [10, 20, 50], // 设置页面可以显示的数据条数
pageSize: 15, // 页面数据条数
pageNumber: 1, // 首页页码
sidePagination: 'server', // 设置为服务器端分页
queryParams: function (params) { // 请求服务器数据时发送的参数可以在这里添加额外的查询参数返回false则终止请求
return {
rows: params.limit, // 每页要显示的数据条数
page: params.offset / params.limit + 1, // 每页显示数据的开始页码
sort: 'insdt', // 要排序的字段
order: params.order,
showdata:showdata,
bizId: unitId,
search_name: $('#search_name').val(),
//type: '${type}'
}
},
onClickRow: function (row) {//单击行事件,执行查看功能
viewFun(row.id);
},
sortName: 'start_time', // 要排序的字段
sortOrder: 'asc', // 排序规则
columns: [
{
field: 'peakprice', // 返回json数据中的name
title: '总电费', // 表格表头显示文字
align: 'center', // 左右居中
valign: 'middle' // 上下居中
},
{
field: 'voltagelevel', // 返回json数据中的name
title: ' 电压等级 ', // 表格表头显示文字
align: 'center', // 左右居中
valign: 'middle' // 上下居中
},
{
field: 'dianduprice', // 返回json数据中的name
title: '电度电价(元)', // 表格表头显示文字
align: 'center', // 左右居中
valign: 'middle' // 上下居中
},
{
field: 'basicprice', // 返回json数据中的name
title: '基本电费', // 表格表头显示文字
align: 'center', // 左右居中
valign: 'middle' // 上下居中
},
],
onLoadSuccess: function () { //加载成功时执行
adjustBootstrapTableView("table");
},
onLoadError: function () { //加载失败时执行
console.info("加载数据失败");
},
});
}
function dodfgchtml(){
var bizid=unitId;
var showdata=$('#showdata').val();
$.ajax({
type:'GET',
url:ext.contextPath + "/timeEfficiency/electricityPrice/doecharts2.do?&math="+Math.random()+"&bizid="+bizid+"&showdata="+showdata,
async: false,
globle:false,
error: function(){
return false;
},
success: function(data){
//全厂电费构成
var dfgcjson=eval('(' + data + ')');
maindfgcjson=dfgcjson;
var dfgchtml="";
dfgchtml=dfgchtml+"<table style='font-size: 12px;border: 1px solid #e4e4e4;table-layout: fixed;border-collapse: collapse;width:100%;height:10%' cellspacing='0'>";
dfgchtml=dfgchtml+"<thead style='background: #E3E4E6;border:1px solid #d7d8d9;'><tr><th align='left' width='30%'>&nbsp;&nbsp;&nbsp;&nbsp;全厂电费构成</th> <th ></th> <th align='right' width='40px;'> <span class='btnright' onclick='showhiddendiv(this);' ><img src='IMG/efficiency/电费分析菜单.png' style='width:50%;height:50%;'></span></th></tr></thead>";
dfgchtml=dfgchtml+"</table>";
dfgchtml=dfgchtml+"<table style='font-size: 12px;border-left: 1px solid #e4e4e4;border-right: 1px solid #e4e4e4;table-layout: fixed;border-collapse: collapse;width:100%;height:90%;background: #FAFAFA' cellspacing='0'>";
dfgchtml=dfgchtml+"<tr style='border-bottom: 1px solid #e4e4e4;padding-bottom:5px;font-weight:bold;height:15%;'>";
dfgchtml=dfgchtml+"<td align='center' style='border-right: 1px solid #e4e4e4;'>分项名称</td>";
dfgchtml=dfgchtml+"<td align='center' style='border-right: 1px solid #e4e4e4;'>预算费用(元)</td>";
dfgchtml=dfgchtml+"<td align='center' style='border-right: 1px solid #e4e4e4;'>实际费用(元)</td>";
dfgchtml=dfgchtml+"<td align='center' >节约费用(元)</td></tr>";
for(var key in dfgcjson){
dfgchtml=dfgchtml+"<tr style='border-bottom: 1px solid #e4e4e4;padding-bottom:5px;height:15%;' >";
dfgchtml=dfgchtml+"<td align='center' style='font-weight:bold;border-right: 1px solid #e4e4e4;'>"+key+"</td>";
if(dfgcjson[key][0]=='/'){
dfgchtml=dfgchtml+"<td align='center' style='border-right: 1px solid #e4e4e4;'>/</td>";
}else if(dfgcjson[key][0]=='-'){
dfgchtml=dfgchtml+"<td align='center' style='border-right: 1px solid #e4e4e4;'>-</td>";
}else{
var num1=number_format(dfgcjson[key][0], 2, ".", ",", "round");
dfgchtml=dfgchtml+"<td align='center' style='border-right: 1px solid #e4e4e4;'>"+num1+"</td>";
}
if(dfgcjson[key][1]=='/'){
dfgchtml=dfgchtml+"<td align='center' style='border-right: 1px solid #e4e4e4;'>/</td>";
}else if(dfgcjson[key][1]=='-'){
dfgchtml=dfgchtml+"<td align='center' style='border-right: 1px solid #e4e4e4;'>-</td>";
}else{
var num2=number_format(dfgcjson[key][2], 2, ".", ",", "round");
dfgchtml=dfgchtml+"<td align='center' style='border-right: 1px solid #e4e4e4;'>"+num2+"</td>";
}
if(dfgcjson[key][2]=='/'){
dfgchtml=dfgchtml+"<td align='center' >/</td>";
}else if(dfgcjson[key][2]=='-'){
dfgchtml=dfgchtml+"<td align='center' >-</td>";
}else{
var num3=number_format(dfgcjson[key][1], 2, ".", ",", "round");
dfgchtml=dfgchtml+"<td align='center' >"+num3+"</td>";
}
dfgchtml=dfgchtml+"</tr>";
}
dfgchtml=dfgchtml+"<tr style='border-bottom: 1px solid #e4e4e4;padding-bottom:5px;height:15%;' >";
dfgchtml=dfgchtml+"<td align='center' style='font-weight:bold;border-right: 1px solid #e4e4e4;'></td>";
dfgchtml=dfgchtml+"<td align='center' style='border-right: 1px solid #e4e4e4;'></td>";
dfgchtml=dfgchtml+"<td align='center' style='border-right: 1px solid #e4e4e4;'></td>";
dfgchtml=dfgchtml+"<td align='center' ></td>";
dfgchtml=dfgchtml+"</tr>";
dfgchtml=dfgchtml+"<tr style='border-bottom: 1px solid #e4e4e4;padding-bottom:5px;height:15%;' >";
dfgchtml=dfgchtml+"<td align='center' style='font-weight:bold;border-right: 1px solid #e4e4e4;'></td>";
dfgchtml=dfgchtml+"<td align='center' style='border-right: 1px solid #e4e4e4;'></td>";
dfgchtml=dfgchtml+"<td align='center' style='border-right: 1px solid #e4e4e4;'></td>";
dfgchtml=dfgchtml+"<td align='center' ></td>";
dfgchtml=dfgchtml+"</tr>";
dfgchtml=dfgchtml+"</table>";
$('#dfgcjson').html(dfgchtml);
}
});
$('#mydiv1').attr('style','position:absolute;display:none;padding:8px;border:1px solid #a5b6c8;background:#eef3f7;');
}
function doscjyhtml(){
var bizid=unitId;
var showdata=$('#showdata').val();
$.ajax({
type:'GET',
url:"constitute.do?method=getelectricityCostAnalysisForscjy&&math="+Math.random()+"&bizid="+bizid+"&showdata="+showdata,
async: false,
globle:false,
error: function(){
return false;
},
success: function(data){
//生产节约电费
var scjyjson=eval('(' + data + ')');
mainscjyjson=scjyjson;
var scjyhtml="";
scjyhtml=scjyhtml+"<table style='font-size: 12px;border: 1px solid #e4e4e4;table-layout: fixed;border-collapse: collapse;width:100%;height:10%' cellspacing='0'>";
scjyhtml=scjyhtml+"<thead style='background: #E3E4E6;border:1px solid #d7d8d9;'><tr><th align='left' width='30%'>&nbsp;&nbsp;生产节约电费</th> <th ></th> <th align='right' width='40px;'> <span class='btnright' onclick='showhiddendiv(this);' ><img src='IMG/efficiency/电费分析菜单.png' style='width:50%;height:50%;'></span> </th></tr></thead>";
scjyhtml=scjyhtml+"</table>";
scjyhtml=scjyhtml+"<table style='font-size: 12px;border-left: 1px solid #e4e4e4;border-right: 1px solid #e4e4e4;table-layout: fixed;border-collapse: collapse;width:100%;height:90%;background: #FAFAFA' cellspacing='0'>";
scjyhtml=scjyhtml+"<tr style='border-bottom: 1px solid #e4e4e4;padding-bottom:5px;font-weight:bold;'>";
scjyhtml=scjyhtml+"<td align='center' style='border-right: 1px solid #e4e4e4;'>分项名称</td>";
scjyhtml=scjyhtml+"<td align='center' style='border-right: 1px solid #e4e4e4;'>预算费用(元)</td>";
scjyhtml=scjyhtml+"<td align='center' style='border-right: 1px solid #e4e4e4;'>实际费用(元)</td>";
scjyhtml=scjyhtml+"<td align='center' >节约费用(元)</td></tr>";
for(var key in scjyjson){
scjyhtml=scjyhtml+"<tr style='border-bottom: 1px solid #e4e4e4;padding-bottom:5px;' >";
scjyhtml=scjyhtml+"<td align='center' style='font-weight:bold;border-right: 1px solid #e4e4e4;'>"+key+"</td>";
if(scjyjson[key][0]=='/'){
scjyhtml=scjyhtml+"<td align='center' style='border-right: 1px solid #e4e4e4;'>/</td>";
}else if(scjyjson[key][0]=='-'){
scjyhtml=scjyhtml+"<td align='center' style='border-right: 1px solid #e4e4e4;'>-</td>";
}else{
var num1=number_format(scjyjson[key][0], 2, ".", ",", "round");
scjyhtml=scjyhtml+"<td align='center' style='border-right: 1px solid #e4e4e4;'>"+num1+"</td>";
}
if(scjyjson[key][1]=='/'){
scjyhtml=scjyhtml+"<td align='center' style='border-right: 1px solid #e4e4e4;'>/</td>";
}else if(scjyjson[key][1]=='-'){
scjyhtml=scjyhtml+"<td align='center' style='border-right: 1px solid #e4e4e4;'>-</td>";
}else{
var num2=number_format(scjyjson[key][1], 2, ".", ",", "round");
scjyhtml=scjyhtml+"<td align='center' style='border-right: 1px solid #e4e4e4;'>"+num2+"</td>";
}
if(scjyjson[key][2]=='/'){
scjyhtml=scjyhtml+"<td align='center' >/</td>";
}else if(scjyjson[key][2]=='-'){
scjyhtml=scjyhtml+"<td align='center' >-</td>";
}else{
var num3=number_format(scjyjson[key][2], 2, ".", ",", "round");
scjyhtml=scjyhtml+"<td align='center' >"+num3+"</td>";
}
scjyhtml=scjyhtml+"</tr>";
}
scjyhtml=scjyhtml+"</table>";
$('#dfgcjson').html(scjyhtml);
}
});
$('#mydiv1').attr('style','position:absolute;display:none;padding:8px;border:1px solid #a5b6c8;background:#eef3f7;');
}
function dodfqx(){
var bizid=unitId;
var showdata=$('#showdata').val();
$.ajax({
type:'GET',
url:ext.contextPath + "/timeEfficiency/electricityPrice/doecharts1.do?&math="+Math.random()+"&bizid="+bizid+"&showdata="+showdata,
async: false,
globle:false,
error: function(){
return false;
},
success: function(data){
var data=eval('(' + data + ')');
var mychart=echarts.init(document.getElementById('mycharts1'));
var colors=['#FFA700','#0078E2'];
var legenddata=new Array();
var xdata=new Array();
var series=[];
var datanum=0;
for(var key in data){
legenddata[datanum]=key;
if(datanum==0){
for(var keynum=0;keynum<data[key].length;keynum++){
xdata[keynum]=keynum+1;
}
}
series.push({
name: key,
data: data[key],
type: 'line',
smooth: true
})
datanum++;
}
var option = {
color: colors,
title: {
text: '电费曲线',
subtext: showdata,
x: 'center'
},
legend: {
data:legenddata,
left:'5%',
top:'3%'
},
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'cross',
crossStyle: {
color: '#999'
}
}
},
grid: {
left: '2%',
right: '2%',
bottom: '1%',
containLabel: true
},
xAxis: {
type: 'category',
data: xdata,
axisPointer: {
type: 'line'
}
},
yAxis: {
name:"(元)",
type: 'value',
splitLine: {
show: false
},
scale:true
},
series: series
};
mychart.clear();
mychart.setOption(option);
}
});
}
function dodsdh(){
var bizid=unitId;
var showdata=$('#showdata').val();
$.ajax({
type:'GET',
url:"constitute.do?method=getelectricityCostAnalysisFordsdh&&math="+Math.random()+"&bizid="+bizid+"&showdata="+showdata,
async: false,
globle:false,
error: function(){
return false;
},
success: function(data){
var data=eval('(' + data + ')');
var mychart=echarts.init(document.getElementById('mycharts1'));
var colors=['#FFA700','#0078E2'];
var legenddata=new Array();
var xdata=new Array();
var series=[];
var datanum=0;
for(var key in data){
legenddata[datanum]=key;
if(datanum==0){
for(var keynum=0;keynum<data[key].length;keynum++){
xdata[keynum]=keynum+1;
}
}
series.push({
name: key,
data: data[key],
type: 'line',
smooth: true
})
datanum++;
}
var option = {
color: colors,
title: {
text: '吨水电耗',
subtext: showdata,
x: 'center'
},
legend: {
data:legenddata,
left:'5%',
top:'3%'
},
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'cross',
crossStyle: {
color: '#999'
}
}
},
grid: {
left: '2%',
right: '2%',
bottom: '1%',
containLabel: true
},
xAxis: {
type: 'category',
data: xdata,
axisPointer: {
type: 'line'
}
},
yAxis: {
name:"(kWh/t)",
type: 'value',
splitLine: {
show: false
},
scale:true
},
series: series
};
mychart.clear();
mychart.setOption(option);
}
});
}
function dopjdj(){
var bizid=unitId;
var showdata=$('#showdata').val();
$.ajax({
type:'GET',
url:"constitute.do?method=getelectricityCostAnalysisForpjdj&&math="+Math.random()+"&bizid="+bizid+"&showdata="+showdata,
async: false,
globle:false,
error: function(){
return false;
},
success: function(data){
var data=eval('(' + data + ')');
var mychart=echarts.init(document.getElementById('mycharts1'));
var colors=['#FFA700','#0078E2'];
var legenddata=new Array();
var xdata=new Array();
var series=[];
var datanum=0;
for(var key in data){
legenddata[datanum]=key;
if(datanum==0){
for(var keynum=0;keynum<data[key].length;keynum++){
xdata[keynum]=keynum+1;
}
}
series.push({
name: key,
data: data[key],
type: 'line',
smooth: true
})
datanum++;
}
var option = {
color: colors,
title: {
text: '平均电价',
subtext: showdata,
x: 'center'
},
legend: {
data:legenddata,
left:'5%',
top:'3%'
},
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'cross',
crossStyle: {
color: '#999'
}
}
},
grid: {
left: '2%',
right: '2%',
bottom: '1%',
containLabel: true
},
xAxis: {
type: 'category',
data: xdata,
axisPointer: {
type: 'line'
}
},
yAxis: {
name:"(元)",
type: 'value',
splitLine: {
show: false
},
scale:true
},
series: series
};
mychart.clear();
mychart.setOption(option);
}
});
}
function doscdfqx(){
var namekist1=[];var namekist2=[];
// for(var key in maindfgcjson){
// namekist1.push({
// name:key,
// value:maindfgcjson[key][1]
// });
// }
// for(var key in mainscjyjson){
// namekist2.push({
// name:key,
// value:mainscjyjson[key][1]
// });
// }
// var data=[];
// var color1=['#ebb410','#258e9e','#9b5f40'];
// var color2=['#76c0cb','#34a3b4','#f7a129','#d45a59','#ba764d','#9db2b7','#ddaf61','#a2b029','#76c0cb'];
// for(var i=0;i<namekist1.length;i++){
// if(i==0){
// var children=[];
// for(var j=0;j<namekist2.length;j++){
// if(namekist2[j].value!='/'){
// children.push({
// name:namekist2[j].name,
// value:Number(namekist2[j].value),
// itemStyle: {
// color: color2[j]
// }
// });
// }
// }
// data.push({
// name:namekist1[i].name,
// value:Number(namekist1[i].value),
// itemStyle: {
// color: color1[i]
// },
// children:children
// })
// }else{
// data.push({
// name:namekist1[i].name,
// value:Number(namekist1[i].value),
// itemStyle: {
// color: color1[i]
// },
// children: [{
// value: Number(namekist1[i].value),
// itemStyle: {
// color: color1[i]
// }
// }]
// })
// }
// }
var mychart=echarts.init(document.getElementById('mycharts2'));
var option = {
tooltip: {
trigger: 'item',
formatter: "{a} <br/>{b}: {c} ({d}%)"
},
// legend: {
// orient: 'vertical',
// x: 'left',
// data:${showList2}
// },
series: [
{
name:'全厂能耗',
type:'pie',
center: ['50%', '55%'],
radius: [0, '40%'],
label: {
normal: {
position: 'inner'
}
},
labelLine: {
normal: {
show: false
}
},
data:function(){
var dataArr = maindfgcjson;
var data=[];
var color=['#ebb410','#258e9e','#9b5f40']
var changenum=0;
for( var k in dataArr){
var item={
name:k,
itemStyle: {
normal: {
color: color[changenum]
}
},
value:dataArr[k][1]
}
data.push(item);
changenum++;
};
return data;
}(),
},
{
name:'全厂能耗',
type:'pie',
center: ['50%', '55%'],
radius: ['41%', '70%'],
label: {
normal: {
formatter: ' {b|{b}}\n {per|{d}%}',
backgroundColor: '#eee',
borderColor: '#aaa',
borderWidth: 1,
borderRadius: 4,
rich: {
b: {
fontSize: 12,
align: 'left',
lineHeight: 20
},
per: {
align: 'left',
color: '#eee',
backgroundColor: '#334455',
padding: [2, 4],
borderRadius: 2
}
}
}
},
data:function(){
var dataArr = mainscjyjson;
var data=[];
var color=['#76c0cb','#34a3b4','#f7a129','#d45a59','#ba764d','#9db2b7','#258e9e','#9b5f40']
var changenum=0;
for( var k in dataArr){
var item={
name:k,
itemStyle: {
normal: {
color: color[changenum]
}
},
value:dataArr[k][1]
}
data.push(item);
changenum++;
};
var dataArr2 = maindfgcjson;
var changenum2=0
for( var k in dataArr2){
if(changenum2>0){
var item={
name:k,
itemStyle: {
normal: {
color: color[changenum-1+changenum2]
}
},
value:dataArr2[k][1]
}
data.push(item);
}
changenum2++;
};
return data;
}(),
}
]
};
mychart.on('click', function (param) {
var index = param.dataIndex;
if(index==0){
doscjyhtml();
}
});
mychart.clear();
mychart.setOption(option);
}
function dodffx(){
var bizid=unitId;
var showdata=$('#showdata').val();
$.ajax({
type:'GET',
url:"constitute.do?method=getelectricityCostAnalysisFordffx&&math="+Math.random()+"&bizid="+bizid+"&showdata="+showdata,
async: false,
globle:false,
error: function(){
return false;
},
success: function(data){
var data=eval('(' + data + ')');
var mychart=echarts.init(document.getElementById('mycharts3'));
var colors=['#FFA700','#0078E2'];
var legenddata=new Array();
var xdata=new Array();
var series=[];
var datanum=0;
for(var key in data){
legenddata[datanum]=key;
if(datanum==0){
for(var keynum=0;keynum<data[key].length;keynum++){
if(showdata.length>5){
var d = new Date((showdata+"-01").replace(/-/g,"/"));
d.setMonth(d.getMonth()+(-(5-keynum)));
var str = d.getFullYear()+"-"+(d.getMonth()>=9?d.getMonth()+1:"0"+(d.getMonth()+1));
}else{
var d = new Date((showdata+"-01-01").replace(/-/g,"/"));
d.setYear(d.getFullYear()+(-(4-keynum)));
var str = d.getFullYear();
}
// var str = d.getFullYear()+"-"+(d.getMonth()>=9?d.getMonth()+1:"0"+(d.getMonth()+1))+"-"+(d.getDate()>9?d.getDate():"0"+d.getDate());
xdata[keynum]=str;
}
}
series.push({
name: key,
data: data[key],
type: 'bar',
smooth: true
})
datanum++;
}
var option = {
color: colors,
legend: {
data:legenddata,
left:'5%',
top:'3%'
},
tooltip: {
trigger: 'axis',
},
grid: {
left: '2%',
right: '2%',
bottom: '1%',
containLabel: true
},
xAxis: {
type: 'category',
data: xdata,
axisPointer: {
type: 'line'
}
},
yAxis: {
name:"(元)",
type: 'value',
splitLine: {
show: false
},
scale:true
},
series: series
};
mychart.clear();
mychart.setOption(option);
}
});
}
function dodlfx(){
var bizid=unitId;
var showdata=$('#showdata').val();
$.ajax({
type:'GET',
url:"constitute.do?method=getelectricityCostAnalysisFordlfx&&math="+Math.random()+"&bizid="+bizid+"&showdata="+showdata,
async: false,
globle:false,
error: function(){
return false;
},
success: function(data){
var data=eval('(' + data + ')');
var mychart=echarts.init(document.getElementById('mycharts4'));
var colors=['#FFA700','#0078E2'];
var legenddata=new Array();
var xdata=new Array();
var series=[];
var datanum=0;
for(var key in data){
legenddata[datanum]=key;
if(datanum==0){
for(var keynum=0;keynum<data[key].length;keynum++){
if(showdata.length>5){
var d = new Date((showdata+"-01").replace(/-/g,"/"));
d.setMonth(d.getMonth()+(-(5-keynum)));
var str = d.getFullYear()+"-"+(d.getMonth()>=9?d.getMonth()+1:"0"+(d.getMonth()+1));
}else{
var d = new Date((showdata+"-01-01").replace(/-/g,"/"));
d.setMonth(d.getMonth()+(-(4-keynum)));
var str = d.getFullYear();
}
// var str = d.getFullYear()+"-"+(d.getMonth()>=9?d.getMonth()+1:"0"+(d.getMonth()+1))+"-"+(d.getDate()>9?d.getDate():"0"+d.getDate());
xdata[keynum]=str;
}
}
series.push({
name: key,
data: data[key],
type: 'bar',
smooth: true
})
datanum++;
}
var option = {
color: colors,
legend: {
data:legenddata,
left:'5%',
top:'3%'
},
tooltip: {
trigger: 'axis',
},
grid: {
left: '2%',
right: '2%',
bottom: '1%',
containLabel: true
},
xAxis: {
type: 'category',
data: xdata,
axisPointer: {
type: 'line'
}
},
yAxis: {
name:"(元)",
type: 'value',
splitLine: {
show: false
},
scale:true
},
series: series
};
mychart.clear();
mychart.setOption(option);
}
});
}
function showdlfx(){
setTimeout('dodlfx()',300);
}
function doqxlxchange(obj){
if(obj.value=='电费曲线'){
dodfqx();
}else if(obj.value=='吨水电耗'){
dodsdh();
}else if(obj.value=='平均电价'){
dopjdj();
}
}
function showhiddendiv(obj) {
var objDiv = $("#mydiv1");
$(objDiv).css("display","block");
$(objDiv).css("left", event.clientX-70);
$(objDiv).css("top", event.clientY + 10);
}
function dosearch() {
dojfdfhtml();
doscjyhtml();
dodfgchtml();
dodfqx();
doscdfqx();
dodffx();
}
/**
* 日期加减
* @param date 被加或减的日期
* @param num 需要加或减的数字
* @returns {string}
*/
function addMonth(date, num) {
num = parseInt(num);
var sDate = dateToDate(date);
var sYear = sDate.getFullYear();
var sMonth = sDate.getMonth() + 1;
var sDay = sDate.getDate();
var eYear = sYear;
var eMonth = sMonth + num;
var eDay = sDay;
while (eMonth > 12) {
eYear++;
eMonth -= 12;
}
var eDate = new Date(eYear, eMonth - 1, eDay);
while (eDate.getMonth() != eMonth - 1) {
eDay--;
eDate = new Date(eYear, eMonth - 1, eDay);
}
return eDate;
}
function dateToDate(date) {
var sDate = new Date();
if (typeof date == 'object'
&& typeof new Date().getMonth == "function"
) {
sDate = date;
}
else if (typeof date == "string") {
var arr = date.split('-')
if (arr.length == 3) {
sDate = new Date(arr[0] + '-' + arr[1] + '-' + arr[2]);
}
}
return sDate;
}
function number_format(number, decimals, dec_point, thousands_sep,roundtag) {
/*
* 参数说明:
* number要格式化的数字
* decimals保留几位小数
* dec_point小数点符号
* thousands_sep千分位符号
* roundtag:舍入参数,默认 "ceil" 向上取,"floor"向下取,"round" 四舍五入
* */
number = (number + '').replace(/[^0-9+-Ee.]/g, '');
roundtag = roundtag || "ceil"; //"ceil","floor","round"
var n = !isFinite(+number) ? 0 : +number,
prec = !isFinite(+decimals) ? 0 : Math.abs(decimals),
sep = (typeof thousands_sep === 'undefined') ? ',' : thousands_sep,
dec = (typeof dec_point === 'undefined') ? '.' : dec_point,
s = '',
toFixedFix = function (n, prec) {
var k = Math.pow(10, prec);
return '' + parseFloat(Math[roundtag](parseFloat((n * k).toFixed(prec*2))).toFixed(prec*2)) / k;
};
s = (prec ? toFixedFix(n, prec) : '' + Math.round(n)).split('.');
var re = /(-?\d+)(\d{3})/;
while (re.test(s[0])) {
s[0] = s[0].replace(re, "$1" + sep + "$2");
}
if ((s[1] || '').length < prec) {
s[1] = s[1] || '';
s[1] += new Array(prec - s[1].length + 1).join('0');
}
return s.join(dec);
}
window.onload =function(){
dosearch();
}
function dolastview(){
ListForm.method="post";
ListForm.action="constitute.do?method=electricityCostAnalysis&flag=0";
ListForm.submit();
}
function donextview(){
ListForm.method="post";
ListForm.action="constitute.do?method=electricityCostAnalysis&flag=1";
ListForm.submit();
}
</script>
</head>
<body style="overflow:hidden;">
<form id="ListForm" action="constitute.do?method=electricityCostAnalysis"
method="post">
<input name="hlocation" id="hlocation" type="hidden" value="" />
<input name="filename" id="filename" type="hidden" value="" />
<input name="yearormonth" type="hidden" value="${yearormonth }">
<input id="totalpower" name="totalpower" type="hidden" value="${totalpower }">
<input id="ddprice" name="ddprice" type="hidden" value="${ddprice }">
<div class="input-group date" style="padding-top:10px;padding-left:10px;">
<input type="text" class="form-control" id="showdata" value="${showdata }" style="width: 230px;" placeholder="请选择"/>
<button class="btn" style="height: 34px;" onclick="dosearch('1');"><i class="fa fa-search"></i></button>
</div>
</form>
<!-- <div width="100%" height="100%" style="text-align:center;display: none;" class="Loading">
<img src="IMG/NewLoading.gif">
</div> -->
<div id="mydiv1" style="position:absolute;display:none;padding:8px;border:1px solid #a5b6c8;background:#eef3f7;">
<a onclick="dodfgchtml();" style="cursor:pointer;text-decoration:none;">全厂电费构成</a><br>
<a onclick="doscjyhtml();" style="cursor:pointer;text-decoration:none;">生产节约电费</a>
</div>
<div class="floattop_div">
<div class="floattop_div_1">
<table id="jfdfjson" style="width: 100%;height: 100%;"></table>
</div>
<div class="floattop_div_2">
<table style="font-size: 12px;table-layout: fixed;
border-collapse: collapse;width:100%;height:10%" cellspacing="0">
<thead style="background: #E3E4E6;border-bottom:1px solid #d7d8d9;">
<tr >
<th align="left">&nbsp;&nbsp;&nbsp;&nbsp;生产电费构成</th>
</tr>
</thead>
</table>
<div style=" height: 90%;width:95%;margin: 1 auto;">
<div id="mycharts2" style=" height: 100%;width:100% "></div>
</div>
</div>
<div class="floattop_div_3">
<div id="dfgcjson" style="width: 100%;height: 100%;"></div>
</div>
</div>
<div class="floatbottom_div">
<div class="floatbottom_div_1">
<div style=" height: 100%;width:100%;">
<div class="tpt-bar" >
<input type="radio" name="bar" id="tab-1" checked="">
<label for="tab-1">电费</label>
<div class="tpt-bar-con">
<div id="mycharts3" style=" height: 88%;width:100% "></div>
</div>
<input type="radio" name="bar" id="tab-2">
<label for="tab-2" onclick="showdlfx();">电量</label>
<div class="tpt-bar-con" >
<div id="mycharts4" style=" height: 88%;width:100% "></div>
</div>
</div>
</div>
</div>
<div class="floatbottom_div_2">
<div style=" height: 8%;width:90%;margin-left:10px;">
<tr>
<td><img src='IMG/电压.png' /></td>
<td>
<select style="padding:2px;border:1px solid #96c2f1;background:#ffffff;color:#96c2f1;appearance:none;" onchange="doqxlxchange(this);">
<option value="电费曲线">电费曲线</option>
<option value="吨水电耗">吨水电耗</option>
<option value="平均电价">平均电价</option>
</select>
</td>
</tr>
</div>
<div style=" height: 88%;width:100%">
<div id="mycharts1" style=" height: 100%;width:100% "></div>
</div>
</div>
</div>
</div>
</body>
</html:html>