<!DOCTYPE html>
<% language=javascript %>
<html>
<head lang="en">
    <meta charset="GB2312">
    <title></title>
    <link href="css/style.css" title="style" rel="stylesheet" type="text/css" />
    <script src="js/jquery-1.6.3.min.js"></script>
    <script type="text/javascript" src="js/highcharts.js"></script>

</head>
<body style="background: #F3F3F3">
<div>
  <table width="98%" style='margin-left: 30px'>
    <tr>
    <td width="300px" style="text-align: center;"><img src="img/ico-batt.png" style="width: 70%;text-align: center;"></td>
    <td>
    <table width='100%'>
        <tr><td style='border: none'> <h1 class='smName'></h1></td></tr>
      <tr><td style='width: 200px;'>基本信息</td><td>SID:<span class='SID1288'></span>&nbsp;&nbsp;&nbsp;编址:<span class='Addr1288'></span>&nbsp;&nbsp;&nbsp;数据端口:<span class='Port1288'></span></td></tr>
      <tr><td style='width: 200px;'>更新时间</td><td><span class='DateUpd1288'></span></td></tr>
      <tr><td style='width: 200px;'>监测项状态</td><td><span class='State1288'></span></td></tr>
    </table>
	<table class="append1" width='100%' style='margin-top: 30px'>
    </table>
	<table class="append2" width='100%' style='margin-top: 30px'>
    </table>
	<table class="append3" width='100%' style='margin-top: 30px'>
    </table>
	<table class="append4" width='100%' style='margin-top: 30px'>
    </table>
	</td>
	</tr>
	</table>
</div>
<a href='javascript:history.back()' class='back' style='color: #fff'>返回</a>
<script>
var itype=1288;
var tescape= 5000,time;
  
<% db_Open("/NandFlash/tmp/dbDat0.db3"); %>
var sid=<% write(sid);%>;
var jbase=<% db_QryAdv("select * from tbSitePro where SID="+sid,0); %>;
var jlist1=<% db_QryAdv("select * from tbSiteProTemHum where SID="+sid,0); %>;
var jlist2=<% db_QryAdv("select * from tbSiteProLeak where SID="+sid,0); %>;
var jlist3=<% db_QryAdv("select * from tbSiteProDi where SID="+sid,0); %>;
var jlist4=<% db_QryAdv("select * from tbSiteProAirc where SID="+sid,0); %>;
var jname = <% db_QryAdv("select Name from tbSM where SID="+sid,0); %>
<% db_Close(); %>

$(".smName").html(jname.recs[0].Name);

$(function(){
    time=setInterval(ajax,tescape)
});
function ajax(){
    $.ajax({
        type: "POST",
        url: "omdev/smdat0.asp",
        data: "itype="+itype+"&sid="+sid+"&batval=0",
        dataType:"json",
        success: function(msg){
            listB(msg)
        }
    });
    $.ajax({
        type: "POST",
        url: "omdev/smdat0.asp",
        data: "itype="+itype+"&sid="+sid+"&batval=1",
        dataType:"json",
        success: function(msg){
            list1(msg)
        }
    });
    $.ajax({
        type: "POST",
        url: "omdev/smdat0.asp",
        data: "itype="+itype+"&sid="+sid+"&batval=2",
        dataType:"json",
        success: function(msg){
            list2(msg)
        }
    });
    $.ajax({
        type: "POST",
        url: "omdev/smdat0.asp",
        data: "itype="+itype+"&sid="+sid+"&batval=3",
        dataType:"json",
        success: function(msg){
            list3(msg)
        }
    });
    $.ajax({
        type: "POST",
        url: "omdev/smdat0.asp",
        data: "itype="+itype+"&sid="+sid+"&batval=4",
        dataType:"json",
        success: function(msg){
            list4(msg)
        }
    });
}

listB(jbase);
list1(jlist1);
list2(jlist2);
list3(jlist3);
list4(jlist4);

function listB(data){
    $.each(data.recs,function(i,n){
        $(".SID1288").html(n.SID);
        $(".Addr1288").html(n.Addr);
        $(".Port1288").html(n.Port%256);
        $(".DateUpd1288").html(n.DateUpd);
        $(".State1288").html(window.parent.parseState(n.State));
    });
}
function list1(data){
    var q1='';
	
	q1 += "<tr><td style='border: none'> <h1>温度(监测量)</h1></td></tr>"
    $.each(data.recs,function(i,n){
		for (var ix=0;ix < n.Cnt; ix+=2)
		{
			var vTem="Tem"+ix;
			var vHum="Hum"+ix;
			var vTem1="Tem"+(ix+1);
			var vHum1="Hum"+(ix+1);
			q1+="<tr><td>温度"+(ix+1)+":&nbsp;&nbsp;<span  class='Tem"+(ix)+"1288'>"+(n[vTem]/10)+"</span></td> <td>湿度"+(ix+1)+":&nbsp;&nbsp;<span  class='Hum"+(ix)+"1288'>"+(n[vHum]/10)+"</span></td>"
			if ((ix+1) < n.Cnt)
				q1+="<td >温度"+(ix+2)+":&nbsp;&nbsp;<span  class='Tem"+(ix+1)+"1288'>"+(n[vTem1]/10)+"</span></td> <td>湿度"+(ix+2)+":&nbsp;&nbsp;<span  class='Hum"+(ix+1)+"1288'>"+(n[vHum1]/10)+"</span></td></tr>"
		}
	});
    $(".append1").html(q1);
	
    $("span:contains('故障'),span:contains('告警'),span:contains('未')").addClass("red").removeClass("ger");
    $("span:contains('正常')").addClass("ger").removeClass("red");
}
function list2(data){
    var q1='';
	
	q1 += "<tr><td style='border: none'> <h1>漏水(监测量)</h1></td></tr>"

    $.each(data.recs,function(i,n){
		for (var ix=0;ix < n.Cnt; ix++)
		{
			var vlocate="locate"+ix;
			var vcable="cable"+ix;
			var vStComm="StComm"+ix;
			var vLineCut="LineCut"+ix;
			var vStLeak="StLeak"+ix;
			var vHwFault="HwFault"+ix;
			var vmaintain="maintain"+ix;
			var vLineFault="LineFault"+ix;
			q1+="<tr><td >泄漏位置"+(ix+1)+":&nbsp;&nbsp;<span  class='locate"+(ix)+"1288'>"+(n[vlocate]/10)+"</span></td> <td>线缆长度"+(ix+1)+":&nbsp;&nbsp;<span  class='cable"+(ix)+"1288'>"+(n[vcable]/10)+"</span></td>";
			q1+="<td >通讯状态"+(ix+1)+":&nbsp;&nbsp;<span  class='StComm"+(ix)+"1288'>"+(n[vStComm]?"在线":"离线")+"</span></td> <td>检测线断线"+(ix+1)+":&nbsp;&nbsp;<span  class='LineCut"+(ix)+"1288'>"+(n[vLineCut]?"是":"否")+"</span></td></tr>";
			q1+="<tr><td >漏水状态"+(ix+1)+":&nbsp;&nbsp;<span  class='StLeak"+(ix)+"1288'>"+(n[vStLeak]?"是":"否")+"</span></td> <td>硬件故障"+(ix+1)+":&nbsp;&nbsp;<span  class='HwFault"+(ix)+"1288'>"+(n[vHwFault]?"是":"否")+"</span></td>";
			q1+="<td >维护中"+(ix+1)+":&nbsp;&nbsp;<span  class='maintain"+(ix)+"1288'>"+(n[vmaintain]?"是":"否")+"</span></td> <td>感应线污染"+(ix+1)+":&nbsp;&nbsp;<span  class='LineFault"+(ix)+"1288'>"+(n[vLineFault]?"是":"否")+"</span></td></tr>";
		}
	});
	$(".append2").html(q1);
	
    $("span:contains('故障'),span:contains('告警'),span:contains('未')").addClass("red").removeClass("ger");
    $("span:contains('正常')").addClass("ger").removeClass("red");
}
function list3(data){
    var q1='';
	
	q1 += "<tr><td style='border: none'> <h1>开关量(监测量)</h1></td></tr>"

    $.each(data.recs,function(i,n){
		for (var ix=0;ix < n.Cnt; ix+=4)
		{
			var vdi1="di"+ix;
			var vdi2="di"+ix+1;
			var vdi3="di"+ix+2;
			var vdi4="di"+ix+3;
			q1+="<tr><td >开关量"+(ix+1)+":&nbsp;&nbsp;<span  class='di"+(ix)+"1288'>"+(n[vdi1]?"闭合":"断开")+"</span></td> <td>开关量"+(ix+2)+":&nbsp;&nbsp;<span  class='di"+(ix+1)+"1288'>"+(n[vdi2]?"闭合":"断开")+"</span></td>"
			q1+="<td >开关量"+(ix+3)+":&nbsp;&nbsp;<span  class='di"+(ix+2)+"1288'>"+(n[vdi3]?"闭合":"断开")+"</span></td> <td>开关量"+(ix+4)+":&nbsp;&nbsp;<span  class='di"+(ix+3)+"1288'>"+(n[vdi4]?"闭合":"断开")+"</span></td></tr>"
		}
	});
    $(".append3").html(q1);
	
    $("span:contains('故障'),span:contains('告警'),span:contains('未')").addClass("red").removeClass("ger");
    $("span:contains('正常')").addClass("ger").removeClass("red");
}
function list4(data){
    var q1='';
	
	q1 += "<tr><td style='border: none'> <h1>通用空调(监测量)</h1></td></tr>"

    $.each(data.recs,function(i,n){
		for (var ix=0;ix < n.Cnt; ix++)
		{
			var TemRet="TemRet"+ix;
			var HumRet="HumRet"+ix;
			var StComm="StComm"+ix;
			var AlmTemHigh="AlmTemHigh"+ix;
			var AlmHumHigh="AlmHumHigh"+ix;
			var AlmTemLow="AlmTemLow"+ix;
			var AlmHumLow="AlmHumLow"+ix;
			var StLeak="StLeak"+ix;
			var StFan="StFan"+ix;
			var StHumer="StHumer"+ix;
			var StPow="StPow"+ix;
			q1+="<tr><td >回风温度"+(ix+1)+":&nbsp;&nbsp;<span  class='TemRet"+(ix)+"1288'>"+(n[TemRet]/10)+"</span></td> <td>回风湿度"+(ix+1)+":&nbsp;&nbsp;<span  class='HumRet"+(ix)+"1288'>"+(n[HumRet]/10)+"</span></td>";
			q1+="<td >通讯故障"+(ix+1)+":&nbsp;&nbsp;<span  class='StComm"+(ix)+"1288'>"+(n[StComm]?"是":"否")+"</span></td> <td>风机故障"+(ix+1)+":&nbsp;&nbsp;<span  class='StFan"+(ix)+"1288'>"+(n[StFan]?"是":"否")+"</span></td></tr>";
			q1+="<tr><td >加湿器故障"+(ix+1)+":&nbsp;&nbsp;<span  class='StHumer"+(ix)+"1288'>"+(n[StHumer]?"是":"否")+"</span></td> <td>电源故障"+(ix+1)+":&nbsp;&nbsp;<span  class='StPow"+(ix)+"1288'>"+(n[StPow]?"是":"否")+"</span></td>";
			q1+="<td >高温报警"+(ix+1)+":&nbsp;&nbsp;<span  class='AlmTemHigh"+(ix)+"1288'>"+(n[AlmTemHigh]?"是":"否")+"</span></td> <td>低温报警"+(ix+1)+":&nbsp;&nbsp;<span  class='AlmTemLow"+(ix)+"1288'>"+(n[AlmTemLow]?"是":"否")+"</span></td></tr>";
			q1+="<tr><td >高湿报警"+(ix+1)+":&nbsp;&nbsp;<span  class='AlmHumHigh"+(ix)+"1288'>"+(n[AlmHumHigh]?"是":"否")+"</span></td> <td>低湿报警"+(ix+1)+":&nbsp;&nbsp;<span  class='AlmHumLow"+(ix)+"1288'>"+(n[AlmHumLow]?"是":"否")+"</span></td>";
			q1+="<td >漏水报警"+(ix+1)+":&nbsp;&nbsp;<span  class='StLeak"+(ix)+"1288'>"+(n[StLeak]?"是":"否")+"</span></td> <td>&nbsp;&nbsp;<span  class='1288'></span></td></tr>";
		}
	});
	$(".append4").html(q1);
	
    $("span:contains('故障'),span:contains('告警'),span:contains('未')").addClass("red").removeClass("ger");
    $("span:contains('正常')").addClass("ger").removeClass("red");
}
</script>
</body>
</html>