hdw
2018-10-30 702466cfeeb2553182df8d92996b64fe8e9693be
gx_tieta/WebRoot/pages/js/pages/siderbar.js
@@ -188,7 +188,7 @@
   _prop.activeFile = function(container, cla, id, callback) {
      var rsCla = '.sider-menu-file'+'.'+cla;
      var aFiles = container.find(rsCla);
      console.log(aFiles.length);
      //console.log(aFiles.length);
      // 没有获取到内容就返回false
      if(aFiles.length == 0) {
         return false;
@@ -218,6 +218,7 @@
   // 获取当前选中内容(省-市-机房-电池组)
   var province = getQueryString('province');   // 省
   var city = getQueryString('city');          // 市
   var county = getQueryString('county');      // 区/县
   var home = getQueryString('home');         // 机房
   
   //console.log(province);
@@ -304,8 +305,92 @@
   }
   
   
   // 生成 三级导航-机房
   // 生成 三级导航-区/县
   function third(treeView, container, data, spread) {
      // 已经存在
      if(container.find('ul').length !=0) {
         return;
      }
      treeView.addProgress(container);
      $.ajax({
           type: "post",
           url: "BattInfAction!serchStationName5",
           async:true,
           dataType:'json',
           data:"json = "+JSON.stringify(data),
           success: function(data){
              var rs = JSON.parse(data.result);
              treeView.delProgress(container);
              if(rs.code == 1) {
                 var _data= rs.data;
                 var formatData = [];
                 for(var i=0; i<_data.length;i++) {
                    var __data = _data[i];
                    var tmp = treeView.getFolder(__data.StationName5, 'county', __data.StationName5,__data);
                    formatData.push(tmp);
                 }
                 treeView.treeView(container, formatData);
                 if(spread) {
                    treeView.spreadFolder('county', county, thirdSpread, true);
                 }
              }else {
              }
           }
      });
   }
   // 将函数绑定到GLOBAL.pages.siderbar的命名空间下
   gl.pages.siderbar.third = third;
   // 展开三级导航
   function thirdSpread(treeView, container, data) {
      var tmp = {
         StationName1: data.StationName1,
         StationName2: data.StationName2,
         StationName5: data.StationName5,
      };
      fourth(treeView, container, tmp, true);
   }
   // 生成 三级导航-区/县
   function thirdFile(treeView, container, data) {
      // 已经存在
      if(container.find('ul').length !=0) {
         return;
      }
      treeView.addProgress(container);
      $.ajax({
           type: "post",
           url: "BattInfAction!serchStationName5",
           async:true,
           dataType:'json',
           data:"json = "+JSON.stringify(data),
           success: function(data){
              var rs = JSON.parse(data.result);
              treeView.delProgress(container);
              if(rs.code == 1) {
                 var _data= rs.data;
                 var formatData = [];
                 for(var i=0; i<_data.length;i++) {
                    var __data = _data[i];
                    var tmp = treeView.getFile(__data.StationName5, 'county', '',__data);
                    formatData.push(tmp);
                 }
                 treeView.treeView(container, formatData);
              }else {
              }
           }
      });
   }
   // 将函数绑定到GLOBAL.pages.siderbar的命名空间下
   gl.pages.siderbar.thirdFile = thirdFile;
   //生成四级导航-机房
   function fourth(treeView, container, data, spread) {
      // 已经存在
      if(container.find('ul').length !=0) {
         return;
@@ -330,7 +415,7 @@
                 }
                 treeView.treeView(container, formatData);
                 if(spread) {
                    treeView.spreadFolder('home', home, thirdSpread, true);
                    treeView.spreadFolder('home', home, fourthSpread, true);
                 }
              }else {
                 
@@ -340,57 +425,22 @@
   }
   
   // 将函数绑定到GLOBAL.pages.siderbar的命名空间下
   gl.pages.siderbar.third = third;
   gl.pages.siderbar.fourth = fourth;
   
   // 展开三级导航
   function thirdSpread(treeView, container, data) {
   // 展开四级导航
   function fourthSpread(treeView, container, data) {
      var tmp = {
         StationName1: data.StationName1,
         StationName2: data.StationName2,
         StationName5: data.StationName5,
         StationName: data.StationName,
         StationId: data.StationId
      };
      fourth(treeView, container, tmp, true);
      fifth(treeView, container, tmp, true);
   }
   
   // 生成 三级导航-机房
   function thirdFile(treeView, container, data) {
      // 已经存在
      if(container.find('ul').length !=0) {
         return;
      }
      treeView.addProgress(container);
      $.ajax({
           type: "post",
           url: "BattInfAction!serchStationName3",
           async:true,
           dataType:'json',
           data:"json = "+JSON.stringify(data),
           success: function(data){
              var rs = JSON.parse(data.result);
              treeView.delProgress(container);
              if(rs.code == 1) {
                 var _data= rs.data;
                 var formatData = [];
                 for(var i=0; i<_data.length;i++) {
                    var __data = _data[i];
                    var tmp = treeView.getFile(__data.StationName, 'home', '',__data);
                    formatData.push(tmp);
                 }
                 treeView.treeView(container, formatData);
              }else {
              }
           }
      });
   }
   // 将函数绑定到GLOBAL.pages.siderbar的命名空间下
   gl.pages.siderbar.thirdFile = thirdFile;
   // 生成 三级导航-电池组
   function fourth(treeView, container, data, active) {
   // 生成五级导航-电池组
   function fifth(treeView, container, data, active) {
      // 已经存在
      if(container.find('ul').length !=0) {
         return;
@@ -428,10 +478,8 @@
           }
      });
   }
   // 将函数绑定到GLOBAL.pages.siderbar的命名空间下
   gl.pages.siderbar.fourth = fourth;
   gl.pages.siderbar.fifth = fifth;
})(jQuery, window, document, GLOBAL);
@@ -457,6 +505,7 @@
      first(treeView, container);
      homeInfo.StationName1 = data.province;
      homeInfo.StationName2 = data.city;
      homeInfo.StationName5 = data.county;
      homeInfo.StationName = data.home;
      homeInfo.StationId = data.homeid;
      battId = data.battid;
@@ -540,13 +589,56 @@
   }
   
   
   // 生成 三级导航-机房
   // 生成 三级导航-区/县
   function third(treeView, container, data, spread) {
      // 已经存在
      if(container.find('ul').length !=0) {
         location.hash="#"+homeInfo.StationName5;
          location.hash="";
          treeView.spreadFolder('county', homeInfo.StationName5, thirdSpread, true);
         return;
      }
      treeView.addProgress(container);
      $.ajax({
           type: "post",
           url: "BattInfAction!serchStationName5",
           async:true,
           dataType:'json',
           data:"json = "+JSON.stringify(data),
           success: function(data){
              var rs = JSON.parse(data.result);
              treeView.delProgress(container);
              if(rs.code == 1) {
                 var _data= rs.data;
                 var formatData = [];
                 for(var i=0; i<_data.length;i++) {
                    var __data = _data[i];
                    var tmp = treeView.getFolder(__data.StationName5, 'county', __data.StationName5, __data);
                    formatData.push(tmp);
                 }
                 treeView.treeView(container, formatData);
                 if(spread) {
                    location.hash="#"+homeInfo.StationName5;
                     location.hash="";
                    treeView.spreadFolder('county', homeInfo.StationName5, thirdSpread, true);
                 }
              }
           }
      });
   }
   // 展开三级导航
   function thirdSpread(treeView, container, data) {
      fourth(treeView, container, homeInfo, true);
   }
   // 生成 四级导航-机房
   function fourth(treeView, container, data, spread) {
      // 已经存在
      if(container.find('ul').length !=0) {
         location.hash="#"+homeInfo.StationName;
          location.hash="";
          treeView.spreadFolder('home', homeInfo.StationName, thirdSpread, true);
          treeView.spreadFolder('home', homeInfo.StationName, fourthSpread, true);
         return;
      }
      treeView.addProgress(container);
@@ -571,20 +663,23 @@
                 if(spread) {
                    location.hash="#"+homeInfo.StationName;
                     location.hash="";
                    treeView.spreadFolder('home', homeInfo.StationName, thirdSpread, true);
                    treeView.spreadFolder('home', homeInfo.StationName, fourthSpread, true);
                 }
              }
           }
      });
   }
   
   // 展开三级导航
   function thirdSpread(treeView, container, data) {
      fourth(treeView, container, homeInfo, true);
   function fourthSpread(treeView, container, data) {
      fifth(treeView, container, homeInfo, true);
   }
   
   // 生成 三级导航-电池组
   function fourth(treeView, container, data, active) {
   // 生成 五级导航-电池组
   function fifth(treeView, container, data, active) {
      // 已经存在
      if(container.find('ul').length !=0) {
         container.addClass('sider-menu-open');