<!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>

</head>
<body style="background: #F3F3F3">
<div class='type1797 empty' style=' margin: 10px;'>
  <table width="100%">
    <tr>
    <td width="300px" style="text-align: center;"><img src="img/ico-envir.png" style="width: 50%;text-align: center;"></td>
    <td>
    <table width='100%'>
        <tr><td style='border: none'> <h1>电气接点无线温度变送器(OM-T3)</h1></td></tr>
        <tr><td style='width: 200px;'>基本信息</td><td>SID:<span class='SID1797'> </span>&nbsp;&nbsp;&nbsp;编址:<span class='Addr1797'> </span>&nbsp;&nbsp;&nbsp;数据端口:<span class='Port1797'> </span></td></tr>
        <tr><td style='width: 200px;'>更新时间</td><td><span class='DateUpd1797'> </span></td></tr>
        <tr><td style='width: 200px;'>监测项状态</td><td><span class='State1797'> </span></td></tr>
    </table>
    <table width='100%' style='margin-top: 30px'>
        <tr><td style='border: none'> <h1>监测量</h1></td></tr>
        <tr><td >开关机:<span  class='StOnOff1797'></span></td> <td>模式:<span  class='StMode1797'></span></td></tr>
        <tr><td >风速:<span  class='StFan1797'></span></td> <td><span  class='1797'></span></td></tr>
        <tr><td >设定温度:<span  class='TemSet1797'></span></td> <td>室内温度:<span  class='Tem1797'></span></td></tr>
        <tr><td >摆风打开:<span  class='StWind1797'></span></td> <td>过滤网清洗:<span  class='StFilter1797'></span></td></tr>
        <tr><td >压缩机打开:<span  class='StComp1797'></span></td> <td>换气打开:<span  class='StAir1797'></span></td></tr>
        <tr><td >遥控锁定:<span  class='StRemote1797'></span></td> <td>故障代码:<span  class='StFaultCode1797'></span></td></tr>
    </table>
    </td>
    </tr>
  </table>
    <a href='javascript:history.back()' class='back' style='color: #fff'>返回</a>
</div>
<script>
var itype=1797;
var tescape= 5000,time;
  
<% db_Open("/NandFlash/tmp/dbDat0.db3"); %>
var sid=<% write(sid);%>;
var json=<% db_QryAdv("select * from tbAircMitsubishi where SID="+sid,0);%>;
<% db_Close(); %>
	
$(function(){
   time=setInterval(ajax,tescape)
});
function ajax(){
    $.ajax({
        type: "POST",
        url: "omdev/smdat0.asp",
        data: "itype="+itype+"&sid="+sid,
        dataType:"json",
        success: function(msg){
            list3(msg);
        }
    });
}
list3(json);
function list3(data){
    $.each(data.recs,function(i,n){
        if(n.iTem==0){n.iTem="正常";}
        if(n.iHum==0){n.iHum="正常";}
        if(n.iTem==1){n.iTem="告警";}
        if(n.iHum==1){n.iHum="告警";}
        if(n.iTem<0||n.iTem>1){n.iTem="故障";}
        if(n.iHum<0||n.iHum>1){n.iHum="故障";}
        $(".SID1797").html(n.SID);
        $(".Addr1797").html(n.Addr);
        $(".Port1797").html(n.Port%256);
        $(".DateUpd1797").html(n.DateUpd);
        $(".State1797").html(parseState(n.State));

        $(".StOnOff1797").html(n.StOnOff ? "关机" : "开机");
		if (n.StMode == 1)
			n.StMode = "除湿";
		else if (n.StMode == 2)
			n.StMode = "自动";
		else if (n.StMode == 3)
			n.StMode = "制热";
		else if (n.StMode == 4)
			n.StMode = "送风";
		else if (n.StMode == 7)
			n.StMode = "制冷";
		else
			n.StMode = "未知";

        $(".StMode1797").html(n.StMode);
		if (n.StFan == 1)
			n.StFan = "超高风";
		else if (n.StFan == 2)
			n.StFan = "高风";
		else if (n.StFan == 3)
			n.StFan = "中风";
		else if (n.StFan == 5)
			n.StFan = "低风";
		else
			n.StFan = "未知";
        $(".StFan1797").html(n.StFan);
		
        $(".TemSet1797").html(n.TemSet+"℃");
        $(".Tem1797").html(n.Tem+"℃");
        $(".StWind1797").html(n.StWind ? "是" : "否");
        $(".StFilter1797").html(n.StFilter ? "是" : "否");
        $(".StComp1797").html(n.StComp ? "是" : "否");
        $(".StAir1797").html(n.StAir ? "是" : "否");
        $(".StRemote1797").html(n.StRemote ? "是" : "否");
        $(".StFaultCode1797").html(n.StFaultCode);
    })
    $("span:contains('故障'),span:contains('告警'),span:contains('闭合'),span:contains('关闭')").addClass("red").removeClass("ger");
    $("span:contains('正常')").addClass("ger").removeClass("red");
}


function parseState(istate){
    if(istate==0) return "正常";
    else   if(istate==1) return "告警";
    else return "故障";
}

</script>
</body>
</html>