<!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='type514 empty' style=' margin: 10px;'>
  <table width="100%">
    <tr>
    <td width="300px" style="text-align: center;"><img src="img/ico-elecsw.png" style="width: 80%;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='SID514'> </span>&nbsp;&nbsp;&nbsp;编址:<span class='Addr514'> </span>&nbsp;&nbsp;&nbsp;数据端口:<span class='Port514'> </span></td></tr>
        <tr><td style='width: 200px;'>更新时间</td><td><span class='DateUpd514'> </span></td></tr>
        <tr><td style='width: 200px;'>监测项状态</td><td><span class='State514'> </span></td></tr>
		<tr><td style='width: 200px;' id='adi1'>时控开关1</td><td><span class='di1514'> </span></td></tr>
		<tr><td style='width: 200px;' id='adi2'>时控开关2</td><td><span class='di2514'> </span></td></tr>
		<tr><td style='width: 200px;' id='adi3'>时控开关3</td><td><span class='di3514'> </span></td></tr>
		<tr><td style='width: 200px;' id='adi4'>时控开关4</td><td><span class='di4514'> </span></td></tr>
		<tr><td style='width: 200px;' id='adi5'>时控开关5</td><td><span class='di5514'> </span></td></tr>
		<tr><td style='width: 200px;' id='adi6'>时控开关6</td><td><span class='di6514'> </span></td></tr>
		<tr><td style='width: 200px;' id='adi7'>时控开关1</td><td><span class='di7514'> </span></td></tr>
		<tr><td style='width: 200px;' id='adi8'>时控开关2</td><td><span class='di8514'> </span></td></tr>
		<tr><td style='width: 200px;' id='adi9'>时控开关3</td><td><span class='di9514'> </span></td></tr>
		<tr><td style='width: 200px;' id='adi10'>时控开关4</td><td><span class='di10514'> </span></td></tr>
		<tr><td style='width: 200px;' id='adi11'>时控开关5</td><td><span class='di11514'> </span></td></tr>
		<tr><td style='width: 200px;' id='adi12'>时控开关6</td><td><span class='di12514'> </span></td></tr>
    </table>
    </td>
    </tr>
  </table>
    <a href='javascript:history.back()' class='back' style='color: #fff'>返回</a>
</div>
<script>
var itype=514;
var tescape= 5000,time;

<% db_Open("/NandFlash/tmp/dbDat0.db3"); %>
var sid=<% write(sid);%>;
var json=<% db_QryAdv("select * from tbElecSwTime12 where SID="+sid,0); %>;
var jdefv=<% db_QryAdv("select Fld,ANote from tbSMDefVal where SID="+sid,0); %>;
<% db_Close(); %>
	
$(function(){
  time=setInterval(ajax,tescape)
  if(jdefv.reccnt>0){
    var snote="";
    $.each(jdefv.recs, function(i, n) {
      snote="时控开关"+(n.Fld);
      if(n.ANote!="")
        snote+="("+n.ANote+")";
      $("#adi"+n.Fld).html(snote);
    });
  }
});

  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.sd1 == 0) n.di1="关"; else n.di1="开";
      if (n.sd2 == 0) n.di1="关"; else n.di2="开";
      if (n.sd3 == 0) n.di1="关"; else n.di3="开";
      if (n.sd4 == 0) n.di1="关"; else n.di4="开";
      if (n.sd5 == 0) n.di1="关"; else n.di5="开";
      if (n.sd6 == 0) n.di1="关"; else n.di6="开";
      if (n.sd7 == 0) n.di1="关"; else n.di7="开";
      if (n.sd8 == 0) n.di1="关"; else n.di8="开";
      if (n.sd9 == 0) n.di1="关"; else n.di9="开";
      if (n.sd10 == 0) n.di1="关"; else n.di10="开";
      if (n.sd11 == 0) n.di1="关"; else n.di11="开";
      if (n.sd12 == 0) n.di1="关"; else n.di12="开";
      $(".SID514").html(n.SID);
      $(".Addr514").html(n.Addr);
      $(".Port514").html(n.Port % 256);
      $(".DateUpd514").html(n.DateUpd);
      $(".State514").html(window.parent.parseState(n.State));
      $(".di1514").html(n.di1);
      $(".di2514").html(n.di2);
      $(".di3514").html(n.di3);
      $(".di4514").html(n.di4);
      $(".di5514").html(n.di5);
      $(".di6514").html(n.di6);
      $(".di7514").html(n.di7);
      $(".di8514").html(n.di8);
      $(".di9514").html(n.di9);
      $(".di10514").html(n.di10);
      $(".di11514").html(n.di11);
      $(".di12514").html(n.di12);
    })
    $("span:contains('故障'),span:contains('告警'),span:contains('闭合'),span:contains('关闭')").addClass("red").removeClass("ger");
    $("span:contains('正常')").addClass("ger").removeClass("red");
  }
</script>
</body>
</html>