<!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 src="js/omara.js"></script>

</head>
<body style="background: #F3F3F3">
<div class='empty' style=' margin: 10px;'>
  <table width="100%">
    <tr>
    <td width="300px" style="text-align: center;"><img src="img/ico-cyber.png" style="width: 60%;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='SID2097'> </span>&nbsp;&nbsp;&nbsp;编址:<span class='Addr2097'> </span>&nbsp;&nbsp;&nbsp;数据端口:<span class='Port2097'> </span></td></tr>
        <tr><td style='width: 200px;'>更新时间</td><td><span class='DateUpd2097'> </span></td></tr>
        <tr><td style='width: 200px;'>监测项状态</td><td><span class='State2097'> </span></td></tr>
    </table>
    <table width='100%' style='margin-top: 30px'>
        <tr><td style='border: none'> <h1>基本信息</h1></td></tr>
		<tr><td width='25%'>设定温度：<span class='temS2097'></span></td>
		    <td width='25%'>设定湿度：<span class='humS2097'></span></td>
		    <td width='25%'>当前温度：<span class='tem2097'></span></td>
			<td width='25%'>当前湿度：<span class='hum2097'></span></td></tr>
    </table>
    <table width='100%' style='margin-top: 30px'>
        <tr><td style='border: none'> <h1>状态信息</h1></td></tr>
		<tr><td width='25%'>关机/开机：<span class='stXt2097'></span></td>
		    <td width='25%'>制冷状态：<span class='stZl2097'></span></td>
			<td width='25%'>加湿状态：<span class='stJs2097'></span></td>
		    <td width='25%'>除湿状态：<span class='stCs2097'></span></td></tr>
		<tr><td width='25%'>风机状态：<span class='stFj2097'></span></td>
		    <td width='25%'>加热状态：<span class='stZr2097'></span></td>
			<td width='25%'>运行模式：<span class='stRun2097'></span></td>
		    <td width='25%'>制冷需求：<span class='xqZl2097'></span></td></tr>
		<tr><td width='25%'>制热需求：<span class='xqZr2097'></span></td>
		    <td width='25%'>冷源需求<span class='xqCold2097'></span></td>
		    <td width='25%'>除湿需求<span class='xqCs2097'></span></td>
		    <td width='25%'>加湿需求<span class='xqJs2097'></span></td></tr>
	</table>
    </table>
    </td>
    </tr>
  </table>
    <a href='javascript:history.back()' class='back' style='color: #fff'>返回</a>
</div>
<script>
var itype=2097;
var tescape= 5000,time;
  
<% db_Open("/NandFlash/tmp/dbDat0.db3"); %>
var sid=<% write(sid);%>;
var json=<% db_QryAdv("select * from tbCyberPexS 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,
        dataType:"json",
        success: function(msg){
            list3(msg); 
			
        }
    });
}

list3(json);
function list3(data){
	if (data.reccnt == 0)
		return;
    $.each(data.recs,function(i,n){
        $(".SID2097").html(n.SID);
        $(".Addr2097").html(n.Addr);
        $(".Port2097").html(n.Port%256);
        $(".DateUpd2097").html(n.DateUpd);
        $(".State2097").html(parseState(n.State));
		
		$(".temS2097").html((n.temS) + "℃");
		$(".humS2097").html((n.humS) + "％");
		$(".tem2097").html((n.tem) + "℃");
		$(".hum2097").html((n.hum) + "％");
		$(".stXt2097").html((n.stXt) ? "开" : "关");
		$(".stZl2097").html((n.stZl) ? "开" : "关");
		$(".stZr2097").html((n.stZr) ? "开" : "关");
		$(".stJs2097").html((n.stJs) ? "开" : "关");
		$(".stCs2097").html((n.stCs) ? "开" : "关");
		$(".stFj2097").html((n.stFj) ? "开" : "关");
		$(".stRun2097").html((n.stRan) ? "开" : "关");
		$(".xqZl2097").html(n.xqZl+" %");
		$(".xqZr2097").html(n.xqZr+" %");
		$(".xqCold2097").html(n.xqCold+" %");
		$(".xqJs2097").html(n.xqJs+" %");
		$(".xqCs2097").html(n.xqCs+" %");
		
    })

	$("span:contains('故障'),span:contains('告警'),,span:contains('是'),span:contains('开')").addClass("red").removeClass("ger");
    $("span:contains('正常'),span:contains('否'),span:contains('关')").addClass("ger").removeClass("red");
}

function parseAlm(istate){
    if(istate==0) return "正常";
    else   if(istate==1) return "告警";
    else return "无效";
}

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

function alarmState(istate){
    if(istate==0) return "正常";
    else   if(istate==1) return "短路";
    else return "开路";
}

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