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

180 lines
8.5 KiB
Plaintext

<%@ page language="java" pageEncoding="UTF-8"%>
<script type="text/javascript">
$(function() {
var windowghight=$(window).height();
$('#DetailViewMainDiv').attr("style","height:"+(windowghight-200)+"px;width:100%;");
setTimeout(getEcharts, 1000);
getTable();
});
function getTable(){
$.post(ext.contextPath + '/efficiency/constitute/getDetailTableData.do', {id:"${param.id}",unitId:unitId,sdt:"${param.sdt}",edt:"${param.edt}"} , function(result) {
var html="";
html+="<table style='height:100%;width: 100%;border-collapse: collapse;'>";
html+="<tr style='width:100%;height:40px;background-color:#E3E4E6;'>";
html+="<td align='center' style='width: 20%;border: 1px solid #e4e4e4;'>用能单位</td>";
html+="<td align='center' style='width: 10%;border: 1px solid #e4e4e4;'>电量实际值(A)</td>";
html+="<td align='center' style='width: 10%;border: 1px solid #e4e4e4;'>电量基准值(A)</td>";
html+="<td align='center' style='width: 10%;border: 1px solid #e4e4e4;'>电量节约值(A)</td>";
html+="<td align='center' style='width: 10%;border: 1px solid #e4e4e4;'>电量节约率(%)</td>";
html+="<td align='center' style='width: 10%;border: 1px solid #e4e4e4;'>吨水电耗(kwh/t)</td>";
html+="<td align='center' style='width: 10%;border: 1px solid #e4e4e4;'>吨水电耗基准值(kwh/t)</td>";
html+="<td align='center' style='width: 10%;border: 1px solid #e4e4e4;'>效率(%)</td>";
html+="<td align='center' style='width: 10%;border: 1px solid #e4e4e4;'>效率基准值(%)</td>";
html+="</tr>";
for(var i=0;i<result.length;i++){
var value=Number(result[i].value).toFixed(2);
var lastvalue=Number(result[i].lastvalue).toFixed(2);
var diffvalue = 0;
if(lastvalue>0){
diffvalue = (lastvalue - value).toFixed(2);
}
let outValue = 0;
if (lastvalue > 0) {
outValue = (((lastvalue - value) / lastvalue) * 100).toFixed(2);
}
html+="<tr style='width:100%;height:60px;'>";
html+=" <td align='center' style='width: 20%;border: 1px solid #e4e4e4;cursor: pointer;' >"+result[i].name+"</td> ";
html+=" <td align='center' style='width: 10%;border: 1px solid #e4e4e4;'>"+value+"</td> ";
html+=" <td align='center' style='width: 10%;border: 1px solid #e4e4e4;'>"+lastvalue+"</td> ";
html+=" <td align='center' style='width: 10%;border: 1px solid #e4e4e4;'>"+diffvalue+"</td> ";
html+=" <td align='center' style='width: 10%;border: 1px solid #e4e4e4;'>"+outValue+"</td> ";
html+=" <td align='center' style='width: 10%;border: 1px solid #e4e4e4;'>"+Number(result[i].dsValue).toFixed(4)+"</td> ";
html+=" <td align='center' style='width: 10%;border: 1px solid #e4e4e4;'>"+Number(result[i].dslastValue).toFixed(4)+"</td> ";
html+=" <td align='center' style='width: 10%;border: 1px solid #e4e4e4;'>"+Number(result[i].xlValue).toFixed(2)+"</td> ";
html+=" <td align='center' style='width: 10%;border: 1px solid #e4e4e4;'>"+Number(result[i].xllastValue).toFixed(2)+"</td> ";
html+="</tr>";
}
html+="</table>";
$('#detailTable').html(html);
},'json');
}
function getEcharts(){
$.post(ext.contextPath + '/efficiency/constitute/getDetailData.do', {id:"${param.id}",unitId:unitId,sdt:"${param.sdt}",edt:"${param.edt}"} , function(result) {
var series=[];
var yAxis=[];
var legenddata=[];
for(var i=0;i<result.length;i++){
series.push({
data:result[i].data,
symbol:'none',
name:result[i].name,
type:'line',
lineStyle:{
width:2
}
})
legenddata.push(result[i].name);
}
yAxis.push({
type : 'value',
name : false,
splitLine: {
show: false//是否显示分隔线。默认数值轴显示,类目轴不显示。
},
scale:true//设置成 true 后坐标刻度不会强制包含零刻度。
});
var myChart = echarts.init(document.getElementById("chart"));
var option = {
color:color,
animation:false,
legend: {
data: legenddata,
left: 'center'
},
grid:{
left: '4%', // 与容器左侧的距离
right: '4%', // 与容器右侧的距离
top: '8%', // 与容器顶部的距离
//bottom: '5%', // 与容器底部的距离
containLabel:true
},
toolbox: {
feature: {
saveAsImage: {show: true}
}
},
xAxis: {
type: 'time'
},
yAxis: yAxis,
series: series,
tooltip: {
trigger: 'axis',
formatter: function (params, ticket, callback) {
var htmlStr = '';
for(var i=0;i<params.length;i++){
var param = params[i];
// console.log(param);
var xName = param.name;//x轴的名称
var seriesName = param.seriesName;//图例名称
var xvalue = param.value[0].substring(0,10);//x轴值
var yvalue = param.value[1];//y轴值
var remarkvalue = param.value[2];//备注轴值
var color = param.color;//图例颜色
var dataIndex=param.dataIndex;
var seriesIndex=param.seriesIndex;
htmlStr +='<div>';
if(i==0){
htmlStr += xvalue + '<br/>' ;
}
htmlStr += '<span style="margin-right:5px;display:inline-block;width:10px;height:10px;border-radius:5px;background-color:'+color+';"></span>';
htmlStr += seriesName+':'+ yvalue + '';
htmlStr += '</div>';
}
return htmlStr;
}
// alwaysShowContent:true,
},
dataZoom: [{
type: 'inside',
start: 0,
end: 100
}, {
start: 0,
end: 100,
handleIcon: 'M10.7,11.9v-1.3H9.3v1.3c-4.9,0.3-8.8,4.4-8.8,9.4c0,5,3.9,9.1,8.8,9.4v1.3h1.3v-1.3c4.9-0.3,8.8-4.4,8.8-9.4C19.5,16.3,15.6,12.2,10.7,11.9z M13.3,24.4H6.7V23h6.6V24.4z M13.3,19.6H6.7v-1.4h6.6V19.6z',
handleSize: '60%',
handleStyle: {
color: '#fff',
shadowBlur: 3,
shadowColor: 'rgba(0, 0, 0, 0.6)',
shadowOffsetX: 2,
shadowOffsetY: 2
}
}]
};
// console.log(option);
myChart.setOption(option,true);
},'json');
}
</script>
<div class="modal fade" id="detailDataModal">
<div style="padding: 20px;">c
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
<h4 class="modal-title">详细数据</h4>
</div>
<div class="modal-body">
<div id="DetailViewMainDiv">
<div id="chart" style="float: left;width: 100%;height: 50%;"></div>
<div style="float: left;width: 100%;height: 50%;">
<div id="detailTable" style="height:100%;width: 100%;overflow:auto;"></div>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
</div>
</div>
</div>
</div>