81041
2019-01-02 b2f21d080425b0ab6e5e6170914ca2c615e5d185
gx_tieta/WebRoot/iframe/setcurr.html
@@ -9,10 +9,37 @@
    <link rel="stylesheet" type="text/css" href="../pages/css/mylayui.css">
</head>
<body>
    <table id="pageTbl" lay-filter="pageTbl"></table>
   <div class="layui-page-container">
      <!-- 页面主题内容 -->
        <div class="layui-page-content" style="position: relative;">
           <div class="layui-tbl-filter">
               <div class="layui-form layui-form-pane"  lay-filter="tblFilter">
                  <button class="layui-btn layui-btn-sm" id="startTest">批量启动测试</button>
               </div>
            </div>
            <table id="pageTbl" lay-filter="pageTbl"></table>
        </div>
   </div>
    <script type="text/html" id="OnlineLowActionText">
       {{# if(d.OnlineLowAction == 0){ }}
          停止测试
       {{# }else { }}
          继续测试
       {{# } }}
    </script>
    <script type="text/html" id="setStatus">
      {{# if(d.setCurr == 1){ }}
         <button class="layui-btn layui-btn-sm">设置成功</button>
      {{# }else if(d.setCurr == 2){ }}
            <button class="layui-btn layui-btn-sm layui-btn-danger">设置失败</button>
      {{# }else { }}
         <button class="layui-btn layui-btn-sm layui-btn-normal">未设置</button>
      {{# } }}
   </script>
    <script type="text/javascript" src="../js/jquery-1.8.3.js"></script>
    <script type="text/javascript" src="../js/base.js"></script>
    <script type="text/javascript" src="../src/layui.js"></script>
    <script type="text/javascript" src="../pages/js/common.js"></script>
    <script type="text/javascript" src="../pages/js/mylayui.js"></script>
    <script  type="text/javascript">
        layui.use(['form', 'laytpl', 'jquery', 'element', 'laydate', 'table'], function() {
@@ -29,34 +56,102 @@
            // 表格模块
         var tOptions = {
            elem: '#pageTbl'
            ,toolbar: false
            ,toolbar: true
            ,defaultToolbar: []
            ,cellMinWidth: 80
            ,cols: [[
               {field:'dev_id', title:'设备ID', align:'center', width: 140}
               ,{field:'BattGroupNum', title:'单体数量', align:'center', width: 140}
               ,{field:'HourRate', title:'放电小时率', align:'center', width: 160}
               ,{field:'DisCurr', title:'放电电流', align:'center', width: 160}
               ,{field:'DisCap', title:'放电电容', align:'center', width: 160}
               ,{field:'DisTime', title:'放电时长', align:'center', width: 160}
               ,{field:'GroupVol_Low', title:'组端电压下限', align:'center', width: 220}
               ,{field:'MonomerVol_Low', title:'单体电压下限', align:'center', width: 220}
               {type:'checkbox',fixed: 'left'}
               ,{field:'dev_id', title:'设备ID', align:'center', width: 140}
               ,{field:'StationName', title:'机房名称', align:'center', width: 480}
               ,{field:'BattGroupNum', title:'电池组索引', align:'center', width: 140}
               ,{field:'DisCurr', title:'放电电流(A)', align:'center', width: 160}
               ,{field:'DisCap', title:'放电容量(AH)', align:'center', width: 160}
               ,{field:'DisTime', title:'放电时长(分钟)', align:'center', width: 160}
               ,{field:'GroupVol_Low', title:'组端电压下限(V)', align:'center', width: 220}
               ,{field:'MonomerVol_Low', title:'单体电压下限(V)', align:'center', width: 220}
               ,{field:'MonomerLowCount', title:'单体数量下限', align:'center', width: 220}
               ,{field:'MonomerTmp_High', title:'温度上限', align:'center', width: 140}
               ,{field:'OnlineLowAction', title:'在线电压低处理', align:'center', width: 240}
               ,{field:'ChargeCurrSet', title:'充电电流', align:'center', width: 140}
               ,{field:'DCVolHighLimit', title:'升压上限', align:'center', width: 140}
               ,{field:'MonomerTmp_High', title:'温度上限(℃)', align:'center', width: 140}
               ,{field:'OnlineLowAction', title:'在线电压低处理', templet: '#OnlineLowActionText', align:'center', width: 240}
               ,{field:'ChargeCurrSet', title:'充电电流(A)', align:'center', width: 140}
               ,{field:'DCVolHighLimit', title:'升压上限(V)', align:'center', width: 140}
               ,{field:'doThings', fixed: 'right', title: '设置状态', toolbar: '#setStatus', align: 'center', width: 140}
             ]]
            ,data: []
            ,limit: 20
             ,page: true
            ,limit: 10000
             ,page: false
             ,height: 'full-11'
         };
         for(var i=0; i<setCurr.length; i++) {
            tOptions.data.push(setCurr[i]);
            var _setCurr = setCurr[i];
            if(_setCurr.num==1) {
                 _setCurr.setCurr = 1;
              }else {
                 _setCurr.setCurr = 2;
              }
            tOptions.data.push(_setCurr);
         }
         // 渲染表格
         table.render(tOptions);
         var btsCmd = GLOBAL.CMD.BTS;      // 获取BTS的CMD
         var startTest = btsCmd.start;      // 获取BTS启动测试的CMD
         // 点击启动测试
         $('#startTest').click(function() {
            var checkStatus = table.checkStatus('pageTbl');
            var data = checkStatus.data;
            if(data.length == 0) {
               layer.msg('请选择要启动的机房');
               return;
            }
            // 是否确定启动
            layer.confirm('是否确定启动测试', {icon: 3, title: '系统提示'}, function(index) {
               var param = getStartTestParam(data);
               // 启动测试
               ajaxStartTest(param);
            });
         });
         // 构造启动测试的参数
         function getStartTestParam(param) {
            for(var i=0; i<param.length; i++) {
               param[i].op_cmd = startTest;
               param[i].num = 0;
            }
            return param;
         }
         // 启动测试请求
         function ajaxStartTest(param) {
            var load = layer.load(1)
            // 请求后台
               $.ajax({
                  type: 'post'
                  ,async: true
                  ,url: 'Fbs9100_setparamAction_action_updatePro_dis'
                  ,data: 'json='+JSON.stringify(param)
                  ,dataType: 'json'
                  ,success: function(res) {
                     var rs = JSON.parse(res.result);
                     if(rs.code == 1) {
                        var data = rs.data;
                        layer.msg('启动成功');
                     }else {
                        layer.msg('启动失败');
                     }
                  }
                  ,complete: function() {
                     layer.close(load);
                  }
               });
         }
        });
    </script>
</body>