CJJ
2018-12-25 94e5b0bddf2b83e1591de425d3e30030fcbb1d23
gx_tieta/WebRoot/mobil/batt-unapproved.html
@@ -87,12 +87,16 @@
          margin: 0;
            padding-top: 0.1em;
            padding-bottom: 0.1em;
            background-color: #dddddd4d!important;
      }
      .ui-table-reflow td .ui-table-cell-label, .ui-table-reflow th .ui-table-cell-label{
          width:35%;
      } 
      .tbl-container td {
            color: #fb0909a3;
        }
        .fr{
            float:right;
        }    
   </style>
   <link rel="stylesheet" href="css/fgpanel.css">
@@ -126,8 +130,8 @@
      </div>  
      <div data-role="popup" id="myPopup" class="ui-content" data-overlay-theme="b">
      <a href="#" data-rel="back" class="ui-btn ui-corner-all ui-shadow ui-btn ui-icon-delete ui-btn-icon-notext ui-btn-right">关闭</a>
        <a href="" id="edit" class="ui-btn ui-corner-all ui-shadow  ui-btn-icon-left ui-icon-edit" >修改</a>
        <a href="" id="delete" class="ui-btn ui-corner-all ui-shadow  ui-btn-icon-left ui-icon-forbidden"  data-icon="delete">删除</a>
        <a href="" id="delete" value="" class="ui-btn ui-corner-all ui-shadow  ui-btn-icon-left ui-icon-check" >确定删除</a>
        <a href="" id="" class="ui-btn ui-corner-all ui-shadow  ui-btn-icon-left ui-icon-forbidden"  data-icon="delete">取消删除</a>
        </div>    
      
    </div>    
@@ -143,15 +147,30 @@
 <script type="text/javascript">
          /* 获取点击的是哪个按钮   */
          function getButIndex(t){
             //console.warn($(t).attr("but-index"));
             var index = $(t).attr("but-index");
               setcookiedit(index);
             return ;
         }
        /* 获取点击的是哪个按钮   */
    function getDeleteButIndex(t){
       console.warn($(t).attr("but-index")+' 删除');
       var index = $(t).attr("but-index");
       //delindex = index;
        $("#delete").attr("value",index);
       //setCookie("delindex",index);
         //setcookiedit(index);
         //delparm = battDeleteparm(index);
         //var parm = battDeleteparm();
        //console.info(parm);
        //delBatt(parm);
       return ;
   }
   function getEditButIndex(t){
       console.warn($(t).attr("but-index")+' 修改');
       var index = $(t).attr("but-index");
         setcookiedit(index);
         //window.location.href="batt-infor-unapproved-edit.html";
       return ;
   }
    
    var delindex=0;
    var arrTd=new Array();      //当前表格td数据
    var tblCon = $('.tbl-container');
    var Page = {
@@ -159,24 +178,14 @@
      pageCurr:1,              //当前页码数
      pageAll:0,
   };
    $("#edit").click(function(){
       //searchHomeInfoByName(homename);
        window.location.href="batt-infor-unapproved-edit.html";
    });
    $("#delete").click(function(){  //删除电池组
       var temp = getCookie("eleparm");
       temp = JSON.parse(temp);
       console.info(temp);
        var parm = getUpdateArr(temp);
        delBatt(parm);
       // window.location.href="batt-infor-conf-delete.html";
    $("#delete").click(function(delindex){  //删除电池组
        var delindex = $("#delete").val();
        //console.info($("#delete").val());
        //console.info(delindex);
          battDeleteparm(delindex);
    });
     
    var arrTh = [ '机房编号', '省', '城市','区县','机房名称','设备名称','机房IP','FBS设备ID(重要)','FBS设备IP(重要)','子网掩码','网关','FBS设备名称','FBS电池索引(0-3)','电池组ID','机房内电池组编号','电池组名称','浮充电压阀值(V)','离线电压阀值(V)','浮充电流阀值(A)','单体数量','标称容量(AH)','标称单体电压(V)','标称单体内阻(mΩ)','标称单体电导','单体电压次低偏移量(V)','负载电流(A)','最大核容电流(A)','基站号码','电池品牌','电池型号','电池生产日期','投入使用日期','安装人员','操作'];
    var arrTh = [ '机房编号', '省', '城市','区县','机房名称','设备名称','机房IP','FBS设备ID(重要)','FBS设备IP(重要)','子网掩码','网关','FBS设备名称','FBS电池索引(0-3)','电池组ID','机房内电池组编号','电池组名称','浮充电压阀值(V)','离线电压阀值(V)','浮充电流阀值(A)','单体数量','标称容量(AH)','标称单体电压(V)','标称单体内阻(mΩ)','标称单体电导','单体电压次低偏移量(V)','负载电流(A)','最大核容电流(A)','基站号码','电池品牌','电池型号','电池生产日期','投入使用日期','安装人员',''];
   dataArr = [];
    var startTime = "1980-01-01";
    var endTime = new Date().format('yyyy-MM-dd');
@@ -198,7 +207,7 @@
   }
   // 查询内容
   function searchBattLife(){
      var temp = JSON.stringify(getcreatArr());
       var temp = JSON.stringify(getcreatArr());
      console.info(temp);
      arrTd = new Array();
       var index = 0;
@@ -247,22 +256,24 @@
                arrTd[index++] = data[i].binf.BattProductDate.substr(0,10);
                arrTd[index++] = data[i].binf.BattInUseDate.substr(0,10);
                arrTd[index++] = data[i].binf.install_user;
                arrTd[index++] = '<a onclick="getButIndex(this)" href="#myPopup" id="butt" data-rel="popup" class="ui-btn ui-btn-inline ui-corner-all operat-but" data-position-to="window"'+'but-index='+i+'>修改或删除</a>';continue;
                }
                arrTd[index++]='<a onclick="getEditButIndex(this)"  id="edit" class="ui-btn ui-btn-inline ui-corner-all operat-but" data-position-to="window"'+'but-index='+i+'>修改</a>'+'<a onclick="getDeleteButIndex(this)" href="#myPopup" id="" data-rel="popup"  class="ui-btn ui-btn-inline ui-corner-all operat-but fr" data-position-to="window"'+'but-index='+i+'>删除</a>';
                }
             }
          
          setPage();
          createTbl(tblCon, arrTh, arrTd);
          createTbl(tblCon, arrTh, arrTd);
          }
       });
   }
       });
    }
   //查询当前机房有几个电池组,并set入COOKIE
      function searchHomeInfoByName(id) {
               var groupName = new Array();
               var index = 0;
               //var index = 0;
               var num =new Array();
               var index1 = 0;
               var groupId = new Array();
               var eleditparm = new Array();
               //var index1 = 0;
               var temp = {
                  binf:{
                     StationId:id,               // 省   
@@ -282,20 +293,37 @@
                    success: function(data){
                       var data = JSON.parse(data.result)
                       console.info(data);
                       data = data.data;
                       for(var i=0;i<data.length;i++){
                       console.info(data[i]);
                        groupName[index++] = data[i].binf.BattGroupName;
                        num[index1++] = data[i].num;
                       }
                       if(data.code!=0){
                          data = data.data;
                          for(var i=0;i<data.length;i++){
                             console.info(data[i]);
                             groupName[i] = data[i].binf.BattGroupName;
                             num[i] = data[i].num;
                             groupId[i] = data[i].binf.BattGroupId;
                             var eleditparmarr={
                                groupname : data[i].binf.BattGroupName,
                                num : data[i].num,
                                groupId :data[i].binf.BattGroupId,
                             }
                             eleditparm.push(eleditparmarr);
                          }
                           console.info(eleditparm);
                       }
                    var json = JSON.stringify(groupName);
                    var json1 =JSON.stringify(num);
                  setCookie("eleparmindex",json);
                  setCookie("eleparmnum",json1);
                  console.info(groupName);
                    var json1 =JSON.stringify(num);
                    var json2 = JSON.stringify(groupId);
                    //console.info(eleditparm)
                    var jsonedit = JSON.stringify(eleditparm);
                    setCookie("eleditparm",jsonedit);
                  setCookie("eleparmindex",json);             //电池组名称
                  setCookie("eleparmnum",json1);            //电池组编号
                  console.info(groupName);
                  setCookie("elegroupid",json2);
                  console.info(json2);
                  window.location.href="batt-infor-unapproved-edit.html";
                    }
                })
                });
      }                    
   function setcookiedit(index){
             var arrcookie = new Array();   
@@ -305,22 +333,191 @@
                  value = Math.floor(value+i);
                if(i==13){//新建功能,电池组ID默认为当页最后一个电池组ID号加1
                   var groupid = Math.floor(arrTd[value]+1);
                   //console.info(groupid);
                   arrcookie.push(groupid);
                }else{
                     //console.info(value);
                     arrcookie.push(arrTd[value]);
                  }
               }
            //   console.info($("#newbattnum").val());
               arrcookie.push($("#newbattnum").val());
               var id = arrcookie[0];
               console.info(id);
               searchHomeInfoByName(id);
               var id = arrcookie[0];   //机房ID
               //console.info(id);
               var json=window.JSON.stringify(arrcookie);
               setCookie("eleparm",json);  //这里setcookie,若有上一条cookie则清空上一笔
               searchHomeInfoByName(id);
       }
    function delBatt(parm){
       $.ajax({
         type: "post",
         url: "Battinf_applyAction!del",
         async:true,
         dataType:'json',
         data:"json="+JSON.stringify(parm),
         success: function(data){
            console.info(data);
            data = JSON.parse(data.result);
            if(data.code==1){
               alert("删除成功");
               window.location.href="batt-unapproved.html";
            }else{
               alert("删除失败");
               window.location.href="batt-unapproved.html";
            }
         }
      });
    }
   function battDeleteparm(index){
      console.info(arrTh.length);
      console.info(index);
      var delindex = Math.ceil(arrTh.length*index);
      var stationid = arrTd[delindex];
      console.info(stationid);
      searchdelnum(stationid,index,delindex);
      /*var arr = new Array();
      var temp = getCookie("eleparm");
       var tempindex = getCookie("eleparmindex");
      var tempnum = getCookie("eleparmnum");
      var tempgroupid = getCookie("elegroupid");
      temp=JSON.parse(temp);
      tempindex = JSON.parse(tempindex);
      tempnum =JSON.parse(tempnum);
      tempid = JSON.parse(tempgroupid);
      console.info(temp[12]);
      //for(var i=0;i<tempindex.length;i++){
         //console.info(battString);
         var obj = {
            //apply_date : new Date().format("yyyy-MM-dd hh:mm:ss"),
            num : tempnum[temp[12]],
            binf:{
               StationId : temp[0],   // 机房编号
               StationName : (temp[1]+"-"+temp[2]+"-"+temp[4]+"-"+temp[5]),   // 拼接机房名称
               StationName1 :temp[1],      // 省
               StationName2 : temp[2],      // 市
               StationName5 : temp[3],      // 区/县
               StationName3 : temp[4],      // 机房名称
               StationName4 :temp[5],      // 设备名称
               StationIp : temp[6],            //机房ip
               FBSDeviceId : temp[7],            //设备id
               FbsDeviceIp : temp[8],            //设备ip
               FbsDeviceIp_YM : temp[9],         // 设备掩码
               FbsDeviceIp_WG : temp[10],         // 网关
               FBSDeviceName : temp[11],         //设备名称
               GroupIndexInFBSDevice : temp[12],   //fbs设备索引
               BattGroupId : tempid[temp[12]],            //电池组id
               BattGroupNum : temp[14],         //机房内电池组编号
               BattGroupName : temp[15],        //电池组索引
               FloatVolLevel : temp[16],         //浮充电压阀值
               OfflineVolLevel : temp[17],         //离线电压阀值
               BattFloatCurrent : temp[18],      //浮充电流阀值
               MonCount : temp[19],            //单体数量
               MonCapStd : temp[20],            //标称容量
               MonVolStd : temp[21],            //标称电压
               MonResStd : temp[22],            //标称内阻
               MonSerStd : temp[23],            //标称电导
               MonVolLowToAvg : temp[24],         //单体电压次低偏移量
               Load_curr : temp[25],            //负载电流
               DisCurrMax : temp[26],            //最大核容电流
               station_phone : temp[27],         //基站号码
               BattProducer : temp[28],         //电池品牌
               BattModel : temp[29],            //电池型号
               BattProductDate :  temp[30]+" 00:00:00",      //电池生产日期
               BattInUseDate :  temp[31]+" 00:00:00",         //电池使用日期
               install_user : temp[32],         //安装人员
            }
         }
         arr.push(obj);
      //}
      //console.info(arr);
      return arr;*/
   }
   
   function searchdelnum(id,index,delindex) {
               var groupName = new Array();
               //var index = 0;
               var num =new Array();
               var groupId = new Array();
               //var index1 = 0;
               var temp = {
                  binf:{
                     StationId:id,
                  }
                  ,page: {
                     pageCurr: 1
                     ,pageSize: 100
                  }
               };
               // 请求后台
               $.ajax({
                  type: "post",
                    url: "Battinf_applyAction!serchbystationId",
                    async:true,
                    dataType:'json',
                    data:"json="+JSON.stringify(temp),
                    success: function(data){
                       var data = JSON.parse(data.result)
                       console.info(data);
                       if(data.code!=0){
                       data = data.data;
                       for(var i=0;i<data.length;i++){
                          console.info(data[i]);
                           groupName[i] = data[i].binf.BattGroupName;
                           num[i] = data[i].num;
                           groupId[i] = data[i].binf.BattGroupId;
                       }
                       var arr = new Array();
                     var obj = {
                        //apply_date : new Date().format("yyyy-MM-dd hh:mm:ss"),
                        num : num[arrTd[delindex+12]],
                        binf:{
                           StationId : arrTd[delindex++],   // 机房编号
                           StationName : (arrTd[delindex]+"-"+arrTd[delindex+1]+"-"+arrTd[delindex+3]+"-"+arrTd[delindex+4]),   // 拼接机房名称
                           StationName1 :arrTd[delindex++],      // 省
                           StationName2 : arrTd[delindex++],      // 市
                           StationName5 : arrTd[delindex++],      // 区/县
                           StationName3 : arrTd[delindex++],      // 机房名称
                           StationName4 :arrTd[delindex++],      // 设备名称
                           StationIp : arrTd[delindex++],            //机房ip
                           FBSDeviceId : arrTd[delindex++],            //设备id
                           FbsDeviceIp : arrTd[delindex++],            //设备ip
                           FbsDeviceIp_YM : arrTd[delindex++],         // 设备掩码
                           FbsDeviceIp_WG : arrTd[delindex++],         // 网关
                           FBSDeviceName : arrTd[delindex++],         //设备名称
                           GroupIndexInFBSDevice : arrTd[delindex++],   //fbs设备索引
                           BattGroupId : arrTd[delindex++],            //电池组id
                           BattGroupNum : arrTd[delindex++],         //机房内电池组编号
                           BattGroupName : arrTd[delindex++],        //电池组索引
                           FloatVolLevel : arrTd[delindex++],         //浮充电压阀值
                           OfflineVolLevel : arrTd[delindex++],         //离线电压阀值
                           BattFloatCurrent : arrTd[delindex++],      //浮充电流阀值
                           MonCount : arrTd[delindex++],            //单体数量
                           MonCapStd : arrTd[delindex++],            //标称容量
                           MonVolStd : arrTd[delindex++],            //标称电压
                           MonResStd : arrTd[delindex++],            //标称内阻
                           MonSerStd : arrTd[delindex++],            //标称电导
                           MonVolLowToAvg : arrTd[delindex++],         //单体电压次低偏移量
                           Load_curr : arrTd[delindex++],            //负载电流
                           DisCurrMax : arrTd[delindex++],            //最大核容电流
                           station_phone : arrTd[delindex++],         //基站号码
                           BattProducer : arrTd[delindex++],         //电池品牌
                           BattModel : arrTd[delindex++],            //电池型号
                           BattProductDate :  arrTd[delindex++]+" 00:00:00",      //电池生产日期
                           BattInUseDate :  arrTd[delindex++]+" 00:00:00",         //电池使用日期
                           install_user : arrTd[delindex++],         //安装人员
                        }
                     }
                     arr.push(obj);
                     console.info(arr);
                     delBatt(arr);
                    }
                    }
                })
      }
   $(function() {
      //点击上一页
      $('.pre-page').on('click', 'a', function() {
@@ -363,6 +560,7 @@
      }else{
         $('.pre-page').show();
      }
      var pageNum = Math.ceil(Page.pageAll/Page.pageSize);
      
      if(Page.pageCurr < pageNum){
@@ -375,4 +573,4 @@
   
    
   </script>
</html>
</html>