<%@ page language="java" contentType="text/html;charset=utf-8"%>
<%@include file="/pages/includes/taglibs.jsp"%>


<html>
	<head>
		<script type="text/javascript"
			src="<%=request.getContextPath()%>/resource/js/jquery.progressbar/js/jquery.progressbar.js">
		</script>

		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<title>功率矩阵</title>
		<style type="text/css">
<!--
body {
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
}
.item_Name {
	font-family: Arial, Helvetica, sans-serif;
	font-size: 14px;
	font-weight: bolder;
	color: #333;
}
.item_Name_Green {	FONT-FAMILY: Arial, Helvetica, sans-serif; COLOR: green; FONT-SIZE: 12px; FONT-WEIGHT: bolder
}
.item_Name_H{	FONT-FAMILY: Arial, Helvetica, sans-serif; #cccccc: green; FONT-SIZE: 12px; FONT-WEIGHT: bolder
}
-->
</style>
<script type="text/javascript">
$(document).ready(function() {

$("#wpId").val('<s:property value="wpId"/>')
$("#wpName").val('<s:property value="wpName"/>')	
	
getDetail();
//window.setInterval(getDetail, 30000);
});
function reback()
{
$("#f1").attr("action", "<%=request.getContextPath() %>/matrix/index.action").submit();
}
function getDetail()
{
 
	var wpId=$("#wpId").val();
	var wpName=$("#wpName").val();
		$.ajax({
			url : "gljzAjax.action?wpId="+wpId,
			type : "post",
			cache : false,
			dataType : "json",
			data : {},
			async : false,
			ifModified : false,
			success : function(res) {
			var html ="<table width='1880' border='0' align='center' cellpadding='0' cellspacing='0'>";
  				html =html+"<tr>";
    			html =html+"<td height='50' background='<%=request.getContextPath()%>/resource/images/system/pictures/gljz_Top.fw.png' class='item_Name'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"+wpName+"<button value='返回' type='button' onclick='reback();' style='position:absolute;top:12px;left: 1700px;width: 60px'>返回</button> </td>";
 				html =html+"</tr>";
				html =html+"</table>";
				html =html+"<table width='1880' border='0' align='center'  cellspacing='0' cellpadding='0'>";
				html =html+createTd(res);
				html =html+"</table>";
				
				$("#content").html(html);
				
				$.each(res,function(i, value) {
				var code=value['windTurbineCode'];
				var percent=value['percent'];
				if(percent>=80)
				{
					$("#"+code).progressBar({ barImage: '<%=request.getContextPath()%>/resource/js/jquery.progressbar/images/progressbg_green.gif', showText: false} );;
					
				}else if(percent>=60 && percent<80)
				{
					$("#"+code).progressBar({ barImage: '<%=request.getContextPath()%>/resource/js/jquery.progressbar/images/progressbg_yellow.gif', showText: false} );;
				
				}else 
				{
					$("#"+code).progressBar({ barImage: '<%=request.getContextPath()%>/resource/js/jquery.progressbar/images/progressbg_red.gif', showText: false} );;
				
				}
				});
			
			}	
			
		});
		
		

}

function createTd(result) {


	var html = "<tr >";
	var num=0;
	
	$.each(result,function(i, value) {
			var code=value['windTurbineCode'];
			var temp=code.substring(code.length-3,code.length);
			var tempnum=temp;
			if(!isNaN(temp))
			{
				temp=temp+"号";
			}else
			{
				temp=code.substring(code.length-2,code.length)+"号";
				tempnum=code.substring(code.length-2,code.length);
			}
			
			html += "<td width='208' height='75' align='center' valign='middle' background='<%=request.getContextPath()%>/resource/images/system/pictures/gljz_Icon.fw.png'>";
		    html += "<table width='208' border='0' cellspacing='0' cellpadding='0'>";
            html += " <tr>";
            html += "<td height='25' colspan='2' valign='bottom' class='item_Name'>&nbsp;&nbsp;"+temp+"</td>";
      		html += "</tr>";
      		html += "<tr>";
       		html += "<td height='25' colspan='2' align='center' valign='bottom' class='item_Name1'>&nbsp;";
			html += "<span class='item_Name_Green'>应&nbsp;发&nbsp;&nbsp;</span>";
			html +="<span class='progressBar' width='20px' id='"+code+"'>"+value['percent']+"</span>"
			html += "<span class='item_Name_H'>&nbsp;&nbsp;实&nbsp;发</span>&nbsp;</td>";
      		html += "</tr>";
      		html += "<tr>";
        	html += "<td width='106' height='25' class='item_Name_Green'>&nbsp;&nbsp;"+value['calwindpower']+"kWh</td>";
        	html += "<td width='102' align='right' class='item_Name_H'>"+value['windpower']+"kWh&nbsp;&nbsp;</td>";
      		html += "</tr>";
    		html += "</table>";
			
			if(num==8)
			{
				
					
				html +="</td>";
				
				html += "</tr><tr>";
				
				num=0;
			}else
			{
				
				
				html +="</td>";
				num++;
			}					
		});
	
	
	html += "</tr>";

	return html;
}
</script>
	</head>
	<body>
	<form action="<%=request.getContextPath() %>/matrix/glindex.action" method="post" id="f1">
	<s:hidden id="wpId"></s:hidden>
	<s:hidden id="wpName"></s:hidden>
		
	
		<div id="content" style="width: 1881px;border: 0;margin: 0;"></div>
	</form>
	</body>
</html>