<!DOCTYPE html>
<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>
  <div class='list2' style='margin: 10px;'>
    <a class='you_p' href='#' style='color: #fff'>基本设置</a> 类别:xxx 型号:xxxx SID:xxx
  </div>
  <div class='setbase' style='border: #B0B7BF 1px solid'>
    <table  width='100%'>
    <tr><th><span>监控项描述:</span></th><th style='text-align: left'><input value="描述内容" style="width:250px"></input></th><th>&nbsp;</th></tr>
    <tr><th><span>端  口:</span> </th><th style='text-align: left'><select style="width:150px">
      <option value="1">RS485 A
      <option value="2">RS485 B
      </select></th><th>&nbsp;</th style='text-align: left'></tr>
    <tr><th><span>波特率:</span> </th><th style='text-align: left'><select style="width:150px">
      <option value="1">115200
      <option value="2">57600
      <option value="3">56000
      <option value="4">38400
      <option value="5">19200
      <option value="6">14400
      <option value="7">9600
      <option value="8">4800
      <option value="9">2400
      </select></th><th>默认：9600&nbsp;</th></tr>
    <tr><th><span>数据位:</span> </th><th style='text-align: left'><select style="width:150px">
      <option value="8">8位
      <option value="7">7位
      <option value="6">8位
      <option value="5">9位
      </select></th><th>默认：8&nbsp;</th></tr>
    <tr><th><span>停止位:</span> </th><th style='text-align: left'><select style="width:150px">
      <option value="2">1
      <option value="3">1.5
      <option value="4">2
      </select></th><th>默认：1&nbsp;</th></tr>
    <tr><th><span>校验位:</span> </th><th style='text-align: left'><select style="width:150px">
      <option value="0">无
      <option value="1">奇
      <option value="2">偶
      </select></th><th>默认：无&nbsp;</th></tr>
    <tr><th><span>编址:</span> </th><th style='text-align: left'><input value="12" style="width:150px"></input></th><th>编址范围xx-xx&nbsp;</th></tr>
    </table>
  </div>
  <div class='list2' style='margin: 10px;'>
    <a class='you_p' href='#' style='color: #fff'>参数设置</a>
  </div>
  <div class='setparam' style='border: #B0B7BF 1px solid'>
    <table  width='100%'>
      <tr><th><span>温  度:</span></th><th style='text-align: left'>
        <input value="20" style="width:100px"></input>&nbsp(最低允许温度)&nbsp;&nbsp;&nbsp;
        <input value="33" style="width:100px"></input>(最高允许温度)</th><th>&nbsp;参考范围:20~33</th></tr>
      <tr><th><span>湿  度:</span></th><th style='text-align: left'>
        <input value="20" style="width:100px"></input>&nbsp(最低允许湿度)&nbsp;&nbsp;&nbsp;
        <input value="33" style="width:100px"></input>(最高允许湿度)</th><th>&nbsp;参考范围:46~80</th></tr>
    </table>
  </div>
  <div class='list2' style='margin: 10px;'>
    <a class='you_p' href='#' style='color: #fff'>告警设置</a>
    <span>&nbsp;&nbsp;&nbsp;模板选择：
    <select id="lsKind" style="width:150px">
    <option value="1">不告警
    <option value="2">声光告警
    <option value="3">短信告警
    <option value="4">电话告警
    <option value="5">邮件告警
    <option value="6">声光+短信+电话告警
    <option value="7">自定义告警
    <option value="7">其他告警
    </select></span>
    <span>&nbsp;&nbsp;<input type="checkbox" id="alm_default" checked="checked"/>设为默认(对该类型)</span>
  </div>
  <div class='setalm' style='border: #B0B7BF 1px solid'>
    <table  width='100%'>
      <tr><th><span>预警保持时间(s):</span></th><th style='text-align: left'><input value="5" style="width:100px"></input></th><th>&nbsp;数值范围:0~9999</th></tr>
      <tr><th><span>重复告警间隔(s):</span></th><th style='text-align: left'><input value="900" style="width:100px"></input></th><th>&nbsp;数值范围:0~9999</th></tr>
      <tr><th><span>告警解除通知:</span></th><th style='text-align: left'><input type="checkbox">启用告警解除</input></th><th>&nbsp;</th></tr>
      <tr><th><span>告警发送方式:</span></th><th style='text-align: left'>
        <input type="checkbox">声光</input>&nbsp;&nbsp;
        <input type="checkbox">短信</input>&nbsp;&nbsp;
        <input type="checkbox">彩信</input>&nbsp;&nbsp;
        <input type="checkbox">电话</input>&nbsp;&nbsp;
        <input type="checkbox">邮件</input>&nbsp;&nbsp;
        <input type="checkbox">POST</input></th><th>&nbsp;</th></tr>
      <tr><th><span>告警时段选择:</span></th><th style='text-align: left'>
        <select id="lsKind" style="width:150px">
        <option value="1">全时段
        <option value="2">工作时段
        <option value="3">休息时段
        <option value="4">空时段
        </select></th><th>&nbsp;</th></tr>
      <tr><th><span>告警接收人:</span></th><th style='text-align: left'>
        <input type="checkbox">管理员</input>&nbsp;&nbsp
        <input type="checkbox">用户1</input>&nbsp;&nbsp;
        <input type="checkbox">用户2</input></th><th>&nbsp;</th></tr>
      <tr><th><span>告警短信内容:</span></th><th style='text-align: left'>
        <textarea style='width: 400px'>短信内容</textarea></th><th>&nbsp;</th></tr>
      <tr><th><span>告警电话内容:</span></th><th style='text-align: left'>
        <textarea style='width: 400px'>电话内容</textarea></th><th>&nbsp;</th></tr>
    </table>
  </div>

</div>
<div class='list2' style='margin: 10px;'>
  <a href='#' class='back' style='background: #8FBA08; color: #fff'>保存设置</a>&nbsp;&nbsp
  <a href='javascript:history.back()' class='back' style='color: #fff'>返回</a>
</div>

<script>
var imode=0;

<% db_Open("/NandFlash/dbCfg.db3"); %>
var itype=<% write(itype);%>;
var sid=<% write(sid);%>;
var jdef=<% db_QryAdv("select * from tbSMDef where Type="+itype+" order by FldDept,Fld",0); %>;
var jdefv=<% db_QryAdv("select * from tbSMDef where Type="+itype+" and SID="+sid,0); %>;
<% db_Close(); %>

$(function(){
    listParam();
});

function listParam() {
  if (jdef.reccnt==0) {
    $(".setparam").html("&nbsp;");
    return;
  }
  var stbl="<table  width='100%'>";
//      <tr><th><span>温  度:</span></th><th style='text-align: left'>
//        <input value="20" style="width:100px"></input>&nbsp(最低允许温度)&nbsp;&nbsp;&nbsp;
//        <input value="33" style="width:100px"></input>(最高允许温度)</th><th>&nbsp;参考范围:20~33</th></tr>
  var ichks = 0;
  $.each(jdef.recs,function(i,n){
    if (n.Fld==0){
      if (ichks==1) stbl+="</th></tr>";
      stbl+="<tr><th style='padding: 10px;background:#E5E9EC'>&nbsp</th><th style='padding: 10px;background:#E5E9EC'>"+n.Note+"</th><th style='padding: 10px;background:#E5E9EC'>&nbsp;</th></tr>";
      ichks = n.vkind;
      if (ichks==1)
      stbl+="<tr><th>"+n.Note+"告警选择</th><th>";
    }
    else if (n.Note!=''){
      if (ichks==1) {
        stbl+="<input type='checkbox'/>"+n.Note+"&nbsp;&nbsp;&nbsp";
      }
      else {
        stbl+="<tr><th>"+n.Note+"</th><th style='text-align: left'>";
        if (n.vmode!=6) {
          stbl+="<select style='width:100px'><option value='0'>不检查<option value='1'>相等<option value='2'>不等<option value='3'>小于<option value='4'>大于</select>&nbsp;&nbsp;<input value='"+(n.vref/n.vfactor)+"' style='width:100px'/>"+n.vtip;
        }
        else {
          stbl+="<input value='"+(n.vref/n.vfactor)+"' style='width:100px'/>"+n.vtip;
          stbl+="&nbsp;&nbsp;&nbsp;<input value='"+(n.vref2/n.vfactor)+"' style='width:100px'/>"+n.vtip2;
        }
        stbl+="</th><th>参考说明...如xxx~xxx</th></tr>";
      }
    }
  })
  if (ichks==1) stbl+="</th><th></th></tr>";
  stbl += "</table>";
  $(".setparam").html(stbl);
}
</script>
</body>
</html>