<%@ 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"%>
 	<link rel="stylesheet" href="../../css/count.css">
	<style>
	.form-line .text-content{
		width:120px;
	}
	.pagination > table{
		border-top:none !important;
	}
	.pagination-info{
		line-height:30px !important;
	}
	td{height: 30px;font-size:12px;}
	</style>
</head>
<body class="easyui-layout">
	
	<div style="height: 436px;text-align: center;font-size: 14px; overflow: auto;    padding: 0 6px;">
		 <table  cellspacing="0"  width="100%"  cellpadding="0"  border="1"  align="center"  style="border:1px solid #827d7d;text-align:center;margin: 10px auto;">
     		 <thead>
      			<tr>
					<td colspan="6" style="font-size:14px;font-weight:bold;border:none" id="titName">未联网监控点列表</td>
				</tr>
      			<tr style="border-top: 1px solid #827d7d;">
					<td colspan="6" style="text-align:right;border:none;padding:0 15px;" id="zbsj"></td>
				</tr>
 				<tr>
 					<td>序号</td>
					<td>设备名称</td>
					<td>设备IP</td>
					<td>告警总数</td>
					<td>已恢复数</td>
					<td>恢复率</td>
 				</tr>    					
      		 </thead>
        	 <tbody id="nonet">
         	 </tbody>
         </table>
	</div>
        <div id="pp" style="background: #F9FAF9;margin:0 6px;"></div>
</body>
</html>

<script type="text/javascript">
	var winId	= $.getUrlParam("winId");
	var records = top.$("#"+winId).panel("options").data;
	var flag=true;
	$(function(){
		$('#titName').html(records.xzmc+" 设备列表")
		$('#zbsj').html(records.zbsj);	
		
		getData();
	})	

	// 统计 区域下 告警设备
	function getData(page,rows){
		var params = {};		
		if(page == undefined || page==null){       // 页码
			page = 1;
		} 
		if(rows == undefined || rows==null){       //每页10条
			rows = 10;
		} 
		params.page = page;			
		params.rows = rows;			
		params.areacode = records.xzbh;
		params.networkproperty = 1;
		params.timeStart = records.timeStart;
		params.timeEnd = records.timeEnd;
		
//		console.log(params)
		$.ajax({
			type:'post',
			dataType : 'json',
			url:'ywalarmcountAction!listAlarmAreaByPage.do',
			data : params,
			success : function(res){
				console.log("结果：",res);
				var html = "";
				res.rows.forEach(function(item,index){
					var sbip = item.sbip==null?'':item.sbip;
					var zs = item.zcount==null?0:item.zcount;
					var hf = item.hfcount==null?0:item.hfcount;
					var hfl = 0;
					if(zs!=0){
						hfl = hf/zs;
					}
					if(hfl != 0){
						 hfl = hfl*100; 
		        		 hfl = hfl.toFixed(2)+"%";
					}
					html += "<tr>" + 
								"<td>"+(index+1)+"</td>" +
								"<td>"+item.tdmc+"</td>" + 
								"<td>"+sbip+"</td>" +
								"<td>"+zs+"</td>" +
								"<td>"+hf+"</td>" +
								"<td>"+hfl+"</td>" +
							"</tr>"
					})
				$('#nonet').html(html);
				if(flag){
						$('#pp').pagination({
						    total:res.total,
						    showRefresh:true,
						    pageSize:10,
						    pageList:[10,20,30,50,80,100],
							onSelectPage:function(pageNumber, pageSize){
								$(this).pagination('loading');
								$(this).pagination('loaded');
								getData(pageNumber,pageSize)
							}
						});
						flag=false;
				}
			}
		})
	}
</script>
