D:/workspace/chenjingjing/git/gx_tieta/gx_tieta/.gitignore
2019-01-18 2fe250ece8de95b3f70172fe5b45793ab6a3084a
gx_tieta/WebRoot/dischargetest.jsp
@@ -17,6 +17,7 @@
   <link rel="stylesheet" type="text/css" href="font-awesome-4.7.0/css/font-awesome.min.css">
    <link rel="stylesheet" type="text/css" href="font-awesome-4.7.0/css/font-awesome-animation.min.css">
    <link rel="stylesheet" type="text/css" href="css/whyc-ui.css">
    <link href="src/css/layui.css" type="text/css" rel="stylesheet">
   <style>
      .confirm {
         z-index: 999;
@@ -66,6 +67,19 @@
         outline: none !important;
         border: 1px solid #FF0000 !important;
      }
      .page-link {
         cursor: pointer;
      }
      .page-link:hover {
         color: #1495E7;
      }
      .page-link:active {
         color: #FF0000;
      }
      i.fa.f-size16 {
         font-size: 16px;
         vertical-align: middle;
      }
   </style>
  </head> 
  <body>
@@ -85,7 +99,8 @@
               <thead>
                  <tr>
                     <th>省</th>
                     <th>市<!-- 维护区 --></th>
                     <th>市</th>
                     <th>区/县</th>
                     <th><s:text name="Computer_site"/><!-- 机房站点(或机房设备) --></th>
                     <th><s:text name="Battery_name"/><!-- 蓄电池组名称 --></th>
                  </tr>
@@ -98,6 +113,10 @@
                     </td>
                     <td>
                        <select id="city">
                        </select>
                     </td>
                     <td>
                        <select id="county">
                        </select>
                     </td>
                     <td>
@@ -203,7 +222,7 @@
                  </tr>
                  <tr>
                     <th><s:text name="Booster"/><s:text name="Upper_limit"/><!-- 升压上限 -->(V)</th>
                     <th><s:text name="Charging_current"/><!-- 充电电流 -->(A)</th>
                     <th id="ChargeCurrSetLabel"><s:text name="Charging_current"/><!-- 充电电流 -->(<span class="val-range"></span>A)<i class="fa fa-edit page-link f-size16" title="修改充电电流范围"></i></th>
                  </tr>
                  <tr>
                     <td><input id="DCVolHighLimit" type="text" value="0"><i class="fa fa-frown-o error-img" title="数据格式错误"></i></td>
@@ -533,6 +552,7 @@
   <script type="text/javascript" src="js/elecircle.content.js"></script>
   <script type="text/javascript" src="js/mypattern.js"></script>
   <script type="text/javascript" src="js/whyc-jqueryui.js"></script>
   <script type="text/javascript" src="src/layui.all.js"></script>
   <script type="text/javascript">
      var arrTh = new Array();
      var arrTd = new Array();
@@ -725,46 +745,160 @@
               };   // 充电电流
               
               $('.popup.fbs9100 .popup-tbl td i').removeClass('error-data');
               $('.popup.fbs9100 .popup-tbl input[type=text]').removeClass('error-data');
            }
         });
      })(jQuery);
      
      // 更改放电面板的值后
      $(function() {
         $('.popup.fbs9100 .popup-tbl td i').tooltip();
         // 监测面板中的input改变触发$.checkTestInfor()事件
         $('.popup.fbs9100 .popup-tbl').on('input propertychange', 'input', function() {
         // 放电电流
         $('#discurr').testVal({
            pattern: /^[0-9]+(\.[0-9]*)?$/,
            regVal: true,
            min: 0,
            max: 1000,
            msg: '取值范围0~1000A'
         });
         // 放电小时率
         $('#hourrate').testVal({
            pattern: /^[0-9]+$/,
            regVal: false,
            msg: '输入的数据格式不正确'
         });
         // 放电电容
         $('#discap').testVal({
            pattern: /^[0-9]+$/,
            regVal: true,
            min: 0,
            max: 90000,
            msg: '取值范围0~90000AH'
         });
         // 放电时长
         $('#distime').testVal({
            pattern: /^[0-9]+$/,
            regVal: true,
            min: 0,
            max: 5940,
            msg: '取值范围0~5940分钟'
         });
         // 单体下限阀值
         $('#MonomerVol_low').testVal({
            pattern: /^[0-9]+(\.[0-9]*)?$/,
            regVal: true,
            min: 0,
            max: 20,
            msg: '取值范围0~20V'
         });
         // 组端下限阀值GroupVol_low
         $('#GroupVol_low').testVal({
            pattern: /^[0-9]+(\.[0-9]*)?$/,
            regVal: true,
            min: 0,
            max: 60,
            msg: '取值范围0~60V'
         });
         // 单体下限数量
         $('#MonomerlowCount').testVal({
            pattern: /^[0-9]+$/,
            regVal: false,
            msg: '输入的数据格式不正确'
         });
         // 升压上限
         $('#MonomerlowCount').testVal({
            pattern: /^[0-9]+(\.[0-9]*)?$/,
            regVal: false,
            msg: '输入的数据格式不正确'
         });
         // 充电电流
         $('#ChargeCurrSet').testVal({
            pattern: /^[0-9]+(\.[0-9]*)?$/,
            regVal: false,
            msg: '输入的数据格式不正确'
         });
         // 温度上限
         $('#TempUpHighLimit').testVal({
            pattern: /^[0-9]+$/,
            regVal: false,
            msg: '输入的数据格式不正确'
         });
         // bts面板充电电流编辑
         $('#ChargeCurrSetLabel .fa-edit').click(function() {
            var battGroupId = $('#battgroupname').find('option:selected').attr('battgroupid');
            //console.log(batt);
            // 设置面板
            layer.open({
               type: 1
               ,title: '设置充电电流阀值'
               , content: '<div style="width:300px; height: 50px;"><div style="margin-top: 20px;margin-left: 8px; margin-right: 8px;">'+
                        '<input type="text" style="width: 100%; height:32px; border: 1px solid #ccc;" id="setChargeCurrVal" value="">'+
                        '</div></div>'
               ,btn:['设置', '取消']
               ,yes: function(index) {
                  var chargeCurrVal = $('#setChargeCurrVal').val();
                  var num = Number(chargeCurrVal);
                  if(isNaN(num) || num==0) {
                     layer.msg('请输入数字');
                     return;
                  }
                  var tmp = {
                     charge_curr_max: num
                     ,BattGroupId: battGroupId
                  };
                  var load;
                  // 请求设置电流的后台
                  $.ajax({
                     type: 'post'
                     ,async: true
                     ,url: 'BattInfAction!update_charge'
                     ,data: 'json='+JSON.stringify(tmp)
                     ,dataType: 'json'
                     ,beforeSend: function(){
                        load = layer.load(1);
                     }
                     ,success: function(res) {
                        var rs = JSON.parse(res.result);
                        // 关闭等待框
                        layer.close(load);
                        //console.log(rs);
                        if(rs.code == 1) {
                           // 设置弹出框信息
                           layer.msg('设置成功!');
                           layer.close(index);
                           // 充电电流
                           $('#ChargeCurrSet').testVal('option', 'allOpts', {
                              regVal: true
                              ,update: true
                              ,min: 0
                              ,max: num
                              ,msg: '取值范围0~'+num+'A'
                           });
                           // 设置文本值
                           $('#ChargeCurrSetLabel .val-range').text('0~'+num);
                        }else {
                           layer.msg('设置失败!请重新设置');
                        }
                     }
                  });
               }
            });
         });
         $('.popup.fbs9100').on('input propertychange', 'input[type=text]', function() {
            $.checkTestInfor();
            var bool = $.regPositiveNum($(this).val());
            if(bool) {
               // 读取放电参数成功执行
               if($.disTestInfor.success) {
                  paramsBtn.ensure(true);
               }
               $(this).next('i').removeClass('error-data');
               $(this).myTooltip('hide');
            }else {
               paramsBtn.ensure(false);
               //var errorImg = $('<i class="fa fa-frown-o error-img"></i>');
               $(this).next('i').addClass('error-data');
               $(this).myTooltip({
                       position: 'top',
                       thing: 'show',
                       content: '<span style="color:#FF0000">数据格式错误(请输入正数)</span>'
                   });
            }
         });
         // 当文本框获取焦点时
         $('.popup.fbs9100 .popup-tbl').on('focus', 'input', function() {
            if($(this).next('i').hasClass('error-data')) {
               $(this).myTooltip('show');
            }
         });
         // 文本框失去焦点
         $('.popup.fbs9100 .popup-tbl').on('blur', 'input', function() {
            $(this).myTooltip('hide');
         });
         
         $('.popup.fbs9100').on('change', 'select', function() {
@@ -1121,13 +1255,26 @@
                  $('#DCVolHighLimit').val(list[i].fsparam.DCVolHighLimit);
                  $('#ChargeCurrSet').val(list[i].fsparam.ChargeCurrSet);
                  $('#TempUpHighLimit').val(list[i].fsparam.MonomerTmp_High);
                  // 充电电流
                  $('#ChargeCurrSet').testVal('option', 'allOpts', {
                     regVal: true,
                     min: 0,
                     max: list[0].binf.charge_curr_max,
                     msg: '取值范围0~'+list[0].binf.charge_curr_max+'A'
                  });
                  // 设置文本值
                  $('#ChargeCurrSetLabel .val-range').text('0~'+list[0].binf.charge_curr_max);
               }            
            }
         }
      }
      
      // 省-市-机房-电池组
      var filterLoad;
      $(document).ready(function(){
         filterLoad = layer.load();
         //页面加载时查询维护区中的枢纽类型
         $.post("BattInfAction!serchAllStation",null,function(data){
            data=data.result;
@@ -1152,10 +1299,16 @@
      });
      
      // 根据维护区的内容查询市
      function findCity() {
      function findCity(isLoad) {
         var data = {
            StationName1: $("#station_name1").val()
         };
         // 是否添加等待
         if(isLoad) {
            filterLoad = layer.load();
         }
         // 请求获取当前省下的市
         $.ajax({    
              type: "post",             
@@ -1180,7 +1333,8 @@
                 }else {
                    $select.text('').html('<option>暂无可测市</option>');
                 }
                 findStationNamebyStationname1();
                 // 查询区/县
                 findCounty();
              }
          });
      }
@@ -1189,20 +1343,72 @@
      
      //当维护区的值变换时更新市
      $('#station_name1').change(function(){
         findCity();
         findCity(true);
      });
      
      //当市的值变换时更新机房站点
      $('#city').change(function(){
         findStationNamebyStationname1();
         findCounty(true);
      });
      
      //根据维护区查询站点
      function findStationNamebyStationname1(){
      //当区/县的值变换时更新机房站点
      $('#county').change(function(){
         findStationNamebyStationname1(true);
      });
      // 查询区/县
      function findCounty(isLoad) {
         var tmp = {
            StationName1:$("#station_name1").val(),
            StationName2:$("#city").val()
            StationName2:$("#city").val(),
         };
         // 是否添加等待
         if(isLoad) {
            filterLoad = layer.load();
         }
         // 查询区县
         $.ajax({
            type: 'post',
            async: true,
            url: "BattInfAction!serchStationName5",
            data: "json="+JSON.stringify(tmp),
            success:function(data) {
               var rs = JSON.parse(data.result);
               var $select = $("#county");
               if(rs.code==1){
                  var _data = rs.data;
                  // 根据数据构造生成下拉列表的数据
                  var optsList = [];
                  for(var i=0;i<_data.length;i++){
                     var __data = _data[i];
                     var _attr = {
                        StationId: __data.StationId
                     };
                     var tmp = getOptionsData(__data.StationName5, __data.StationName5, __data, _attr);
                     optsList.push(tmp);
                  }
                  // 根据数据生成下拉列表
                  createOptions($select, optsList, true);
               }else{
                  $select.text('').html('<option>暂无可测机房站点</option>');
               }
               findStationNamebyStationname1();
            }
         });
      }
      //根据维护区查询站点
      function findStationNamebyStationname1(isLoad){
         var tmp = {
            StationName1:$("#station_name1").val(),
            StationName2:$("#city").val(),
            StationName5: $("#county").val()
         };
         // 是否添加等待
         if(isLoad) {
            filterLoad = layer.load();
         }
         //var selectvalue=$("#station_name1 option:selected").val();
         //alert(selectvalue);
         $.post("BattInfAction!serchStationName3","json="+JSON.stringify(tmp),function(data){
@@ -1217,7 +1423,7 @@
                  var _attr = {
                     StationId: __data.StationId
                  };
                  var tmp = getOptionsData(__data.StationName3, __data.StationName3, __data, _attr);
                  var tmp = getOptionsData(__data.StationName3, __data.StationName, __data, _attr);
                  optsList.push(tmp);
               }
               
@@ -1231,20 +1437,24 @@
      }
      
      $('#station_name').change(function(){
         findserchByBattGroupNamebystationname();
         findserchByBattGroupNamebystationname(true);
      });
      
      //根据维护区和机房查询蓄电池组
      function findserchByBattGroupNamebystationname(){
      function findserchByBattGroupNamebystationname(isLoad){
         var stationid = $("#station_name").find('option:selected').attr('stationid')?$("#station_name").find('option:selected').attr('stationid'):'';
         // 构造查询条件
         var tmp = {
            StationName1:$("#station_name1").val(),
            StationName2:$("#city").val(),
            StationName3: $("#station_name").val(),
            StationName5:$("#county").val(),
            StationName: $("#station_name").val(),
            StationId: stationid
         };
         // 是否添加等待
         if(isLoad) {
            filterLoad = layer.load();
         }
         //var station_name1=$("#station_name1 option:selected").val();
         //var station_name=$("#station_name option:selected").val();
         
@@ -1274,6 +1484,8 @@
            }else{
               $("#battgroup_name").text('').html('<option>暂无可测蓄电池组</option>');
            }
            layer.close(filterLoad);
         });
      }
      // 隐藏表格功能按钮列表
@@ -1418,9 +1630,9 @@
            if(regEquipType(dev_id, globalPattern.LD9) || regEquipType(dev_id, globalPattern.BTS)) {
               if(confirm("确认停止"+dev_id+"设备的测试吗?")){
                  if(regEquipType(dev_id, globalPattern.LD9)){
                     sendLD9DischargeParam(CMD_Stop);
                     sendLD9DischargeParam(CMD_Stop,true);
                  }else if(regEquipType(dev_id, globalPattern.BTS)){            
                     checkDischargeParam(CMD_Stop);
                     checkDischargeParam(CMD_Stop,true);
                  }            
               }
            }
@@ -1483,7 +1695,8 @@
         loading.showLoading();
         flushDischargeParam({
            num:CMD_GetDischargeParm,
            dev_id:$('#dev_id').val()
            dev_id:$('#dev_id').val(),
            TestCmd:0,
         });
      });
      
@@ -1586,13 +1799,16 @@
      }
      
      //向客户端发送指定的命令
      function checkDischargeParam(cmd){
      function checkDischargeParam(cmd,stop){
         var dev_id = $('#main .tbl-body tbody tr.active').find('td').eq(2).text();
         loading.showLoading($('#main'));
         var distype = stop?0:$('#discharge_type').val();
         var param = {
            num:cmd,
            dev_id:dev_id
            dev_id:dev_id,
            TestCmd:distype
         };   
         $.ajax({    
              type: "post",             
              url:"Fbs9100_setparamAction_action_serchbyDev_id",            
@@ -1837,6 +2053,7 @@
                  updateUserDevinfo();         //设置放电参数成功后修改用户添加的放电设备信息
                  flushDischargeParam({
                     num:CMD_GetDischargeParm,
                     TestCmd:$('#discharge_type').val(),
                     dev_id:$('#dev_id').val()
                  });
                  paramsBtn.startTest(true);