<!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='type513 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='SID513'> </span>&nbsp;&nbsp;&nbsp;编址:<span class='Addr513'> </span>&nbsp;&nbsp;&nbsp;数据端口:<span class='Port513'> </span></td></tr>
        <tr><td style='width: 200px;'>更新时间</td><td><span class='DateUpd513'> </span></td></tr>
        <tr><td style='width: 200px;'>监测项状态</td><td><span class='State513'> </span></td></tr>
	</table>
	
    <table width='100%'>
        <tr><td style='border: none'> <h1>监测量</h1></td></tr>
		<tr><td style='width: 20%;' id='adi1'>干接点1</td><td><span class='di1513'> </span></td>
			<td style='width: 20%;' id='adi2'>干接点2</td><td><span class='di2513'> </span></td></tr>
		<tr><td style='width: 20%;' id='adi3'>干接点3</td><td><span class='di3513'> </span></td>
			<td style='width: 20%;' id='adi4'>干接点4</td><td><span class='di4513'> </span></td></tr>
		<tr><td style='width: 20%;' id='adi5'>干接点5</td><td><span class='di5513'> </span></td>
			<td style='width: 20%;' id='adi6'>干接点6</td><td><span class='di6513'> </span></td></tr>
		<tr><td style='width: 20%;' id='adi7'>市电1</td><td><span class='sd1513'> </span></td>
			<td style='width: 20%;' id='adi8'>市电2</td><td><span class='sd2513'> </span></td></tr>
		<tr><td style='width: 20%;' id='adi9'>市电3</td><td><span class='sd3513'> </span></td>
			<td style='width: 20%;' id='adi10'>市电4</td><td><span class='sd4513'> </span></td></tr>
		<tr><td style='width: 20%;' id='adi11'>市电5</td><td><span class='sd5513'> </span></td>
			<td style='width: 20%;' id='adi12'>市电6</td><td><span class='sd6513'> </span></td></tr>
		<tr><td style='width: 20%;' id='adi13'>市电7</td><td><span class='sd7513'> </span></td>
			<td style='width: 20%;' id='adi14'>市电8</td><td><span class='sd8513'> </span></td></tr>
    </table>
    </td>
    </tr>
  </table>
    <a href='javascript:history.back()' class='back' style='color: #fff'>返回</a>
</div>
<script>
var itype=513;
var tescape= 5000,time;

<% db_Open("/NandFlash/tmp/dbDat0.db3"); %>
var sid=<% write(sid);%>;
var json=<% db_QryAdv("select * from tbElcSwA1086 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="";
      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) {
      $(".SID513").html(n.SID);
      $(".Addr513").html(n.Addr);
      $(".Port513").html(n.Port % 256);
      $(".DateUpd513").html(n.DateUpd);
      $(".State513").html(window.parent.parseState(n.State));
      $(".di1513").html(n.di1 ? "闭合" : "断开");
      $(".di2513").html(n.di2 ? "闭合" : "断开");
      $(".di3513").html(n.di3 ? "闭合" : "断开");
      $(".di4513").html(n.di4 ? "闭合" : "断开");
      $(".di5513").html(n.di5 ? "闭合" : "断开");
      $(".di6513").html(n.di6 ? "闭合" : "断开");
      $(".sd1513").html(n.sd1 ? "已接入" : "未接入");
      $(".sd2513").html(n.sd2 ? "已接入" : "未接入");
      $(".sd3513").html(n.sd3 ? "已接入" : "未接入");
      $(".sd4513").html(n.sd4 ? "已接入" : "未接入");
      $(".sd5513").html(n.sd5 ? "已接入" : "未接入");
      $(".sd6513").html(n.sd6 ? "已接入" : "未接入");
      $(".sd7513").html(n.sd7 ? "已接入" : "未接入");
      $(".sd8513").html(n.sd8 ? "已接入" : "未接入");
    })
    $("span:contains('故障'),span:contains('告警'),span:contains('闭合'),span:contains('已接入')").addClass("red").removeClass("ger");
    $("span:contains('正常'),span:contains('断开'),span:contains('未接入')").addClass("ger").removeClass("red");
  }
</script>
</body>
</html>