<!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='type1280 empty' style=' margin: 10px;'>
  <table width="100%">
    <tr>
    <td width="300px" style="text-align: center;"><img src="img/ico-1314.png" style="width: 50%;text-align: center;"></td>
    <td>
    <table width='100%'>
        <tr><td style='border: none'> <h1>水位监测</h1></td></tr>
        <tr><td style='width: 200px;'>基本信息</td><td>SID:<span class='SID1280'> </span>&nbsp;&nbsp;&nbsp;编址:<span class='Addr1280'> </span>&nbsp;&nbsp;&nbsp;数据端口:<span class='Port1280'> </span></td></tr>
        <tr><td style='width: 200px;'>更新时间</td><td><span class='DateUpd1280'> </span></td></tr>
        <tr><td style='width: 200px;'>监测项状态</td><td><span class='State1280'> </span></td></tr>
    </table>
    <table width='100%' style='margin-top: 30px'>
        <tr><td style='border: none'> <h1>水位值</h1></td></tr>
        <tr><td >水位:<span class='press_1310'></span><span class='kpa_1310'></span> </td></tr>
    </table>

    </td>
    </tr>
  </table>
    <a href='javascript:history.back()' class='back' style='color: #fff'>返回</a>
</div>
<script>
var itype=1314;
var tescape= 5000,time;
  
<% db_Open("/NandFlash/tmp/dbDat0.db3"); %>
var sid=<% write(sid);%>;
var json=<% db_QryAdv("select * from tbEnvirPress 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){
	var iv;
    $.each(data.recs,function(i,n){
        
        
        $(".SID1280").html(n.SID);
        $(".Addr1280").html(n.Addr);
        $(".Port1280").html(n.Port%256);
        $(".DateUpd1280").html(n.DateUpd);
        $(".State1280").html(parseState(n.State));
        
		
        switch(n.dot)
        {
			case 0: 
			{
				iv=n.press;
				iv.toFixed(1);
				$(".press_1310").html(iv); break;
			}
			case 1: 
			{
				iv=n.press/10;
				iv.toFixed(1);
				$(".press_1310").html(iv); break;
			}
			//$(".press_1310").html(n.press/10); break;
			case 2: 
			{
				iv=n.press/100;
				iv.toFixed(2);
				$(".press_1310").html(iv); break;
			}
			//$(".press_1310").html(n.press/100); break;
			case 3: 
			{
				iv=n.press/1000;
				iv.toFixed(3);
				$(".press_1310").html(iv); break;
			}
			//$(".press_1310").html(n.press/1000); break;
        }
        switch(n.kpa)
        {
			case 1: $(".kpa_1310").html("CM"); break;
			case 2: $(".kpa_1310").html("MM"); break;
			case 3: $(".kpa_1310").html("MPa"); break;
			case 4: $(".kpa_1310").html("Pa"); break;
			case 5: $(".kpa_1310").html("Kpa"); break;
			case 6: $(".kpa_1310").html("MA"); break;
        }
    })
    $("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>