<%@ page language="java" import="java.util.*" pageEncoding="gbk"%>
<!DOCTYPE html>
<html>
<head lang="en">
	<meta http-equiv="Content-Type" content="text/html; charset=gbk" />
 	<%@include file="../../../frame/assets/header-all.jsp"%>
	<style>
	.form-line .text-content{
		width:120px;
	}
	</style>
</head>
<body class="easyui-layout">
	<div data-options="region:'north'" id='north' style="margin-top:5px;height: 44px;border-bottom: none">
		<div class="form-line clearfix">
			<input id="ycrq" type="button" value="异常日期"/>
			<input id="qbrq" type="button" value="全部日期"/>    	
		</div>
	</div>	
	<div data-options="region:'center',split:false" class="easyui-layout" >		
		 <table id="countGrid"></table>
	</div>
</body>
</html>
<script type="text/javascript">
	var recordstateid = $.getUrlParam("recordstateid");
	//console.log("跳转iframe: ",recordstateid);
	$(function(){
		initGrid();
	})
	$('#ycrq').click(function(){					// 异常日期
		$('#countGrid').datagrid('load',getQueryParams(0));
	})
	$('#qbrq').click(function(){					// 全部日期
		$('#countGrid').datagrid('load',getQueryParams(1));
	})
	
	function initGrid(){
		$('#countGrid').datagrid({
			queryParams:getQueryParams(),
			url : 'ywrecordcurrentstateAction!getYwrecordHisState.do',
			columns : [[
				{field:'countdate',title:'检测日期',hidden:false,width:80},
				{field:'twentyfourstate',title:'0',hidden:false,width:25,
					formatter:function(value,record,num){ 
						return getBlock(value);
					}	
				},
				{field:'onestate',title:'1',hidden:false,width:25,
					formatter:function(value,record,num){ 
						return getBlock(value);
					}
				},
				{field:'twostate',title:'2',hidden:false,width:25,
					formatter:function(value,record,num){ 
						return getBlock(value);
					}
				},
				{field:'threestate',title:'3',hidden:false,width:25,
					formatter:function(value,record,num){ 
						return getBlock(value);
					}
				},
				{field:'fourstate',title:'4',hidden:false,width:25,
					formatter:function(value,record,num){ 
						return getBlock(value);
					}
				},
				{field:'fivestate',title:'5',hidden:false,width:25,
					formatter:function(value,record,num){ 
						return getBlock(value);
					}
				},
				{field:'sixstate',title:'6',hidden:false,width:25,
					formatter:function(value,record,num){ 
						return getBlock(value);
					}
				},
				{field:'sevenstate',title:'7',hidden:false,width:25,
					formatter:function(value,record,num){ 
						return getBlock(value);
					}	
				},
				{field:'eightstate',title:'8',hidden:false,width:25,
					formatter:function(value,record,num){ 
						return getBlock(value);
					}	
				},
				{field:'ninestate',title:'9',hidden:false,width:25,
					formatter:function(value,record,num){ 
						return getBlock(value);
					}	
				},
				{field:'tenstate',title:'10',hidden:false,width:25,
					formatter:function(value,record,num){ 
						return getBlock(value);
					}	
				},
				{field:'elevenstate',title:'11',hidden:false,width:25,
					formatter:function(value,record,num){ 
						return getBlock(value);
					}	
				},
				{field:'twelvestate',title:'12',hidden:false,width:25,
					formatter:function(value,record,num){ 
						return getBlock(value);
					}	
				},
				{field:'thirteenstate',title:'13',hidden:false,width:25,
					formatter:function(value,record,num){ 
						return getBlock(value);
					}
				},
				{field:'fourteenstate',title:'14',hidden:false,width:25,
					formatter:function(value,record,num){ 
						return getBlock(value);
					}	
				},
				{field:'fifteenstate',title:'15',hidden:false,width:25,				
					formatter:function(value,record,num){ 
						return getBlock(value);
					}
				},
				{field:'sixteenstate',title:'16',hidden:false,width:25,
					formatter:function(value,record,num){ 
						return getBlock(value);
					}	
				},
				{field:'seventeenstate',title:'17',hidden:false,width:25,
					formatter:function(value,record,num){ 
						return getBlock(value);
					}	
				},
				{field:'eighteenstate',title:'18',hidden:false,width:25,
					formatter:function(value,record,num){ 
						return getBlock(value);
					}	
				},
				{field:'nineteenstate',title:'19',hidden:false,width:25,
					formatter:function(value,record,num){ 
						return getBlock(value);
					}	
				},
				{field:'twentystate',title:'20',hidden:false,width:25,
					formatter:function(value,record,num){ 
						return getBlock(value);
					}	
				},
				{field:'twentyonestate',title:'21',hidden:false,width:25,
					formatter:function(value,record,num){ 
						return getBlock(value);
					}	
				},
				{field:'twentytwostate',title:'22',hidden:false,width:25,
					formatter:function(value,record,num){ 
						return getBlock(value);
					}	
				},
				{field:'twentythreestate',title:'23',hidden:false,width:25,
					formatter:function(value,record,num){ 
						return getBlock(value);
					}	
				},
				
				
			]]
		})
	}
	
	function getBlock(flag){		// 根据 状态码 1-正常  0-异常  返回红色或绿色块
		if(flag == 1){
			return "<div style='height:13px;width:13px;background-color:green;border-radius:50%;-moz-border-radius: 50%;-webkit-border-radius: 50%;margin:0 auto;'></div>";
		}else{
			return "<div style='height:13px;width:13px;background-color:red;border-radius:50%;-moz-border-radius: 50%;-webkit-border-radius: 50%;margin:0 auto;'></div>";
		}
	}
	
	function getQueryParams(flag){
		var sParam = {"recordstateid":recordstateid,"rq":flag};
//		console.log("查询参数：",sParam);
		return sParam;
	}
</script>
