From b8f449dca8e53bbd5c0e424befe07c8207c10032 Mon Sep 17 00:00:00 2001
From: didiyu <1293722656@qq.com>
Date: 星期二, 11 十二月 2018 13:48:50 +0800
Subject: [PATCH] Merge branch 'dev_lxw' of https://didiyu@gitlab.com/whyclxw1/gx_tieta.git into dev_lxw

---
 gx_tieta/WebRoot/ele-param1.jsp |  182 +++++++++++++++++++++++++++++++++++----------
 1 files changed, 140 insertions(+), 42 deletions(-)

diff --git a/gx_tieta/WebRoot/ele-param1.jsp b/gx_tieta/WebRoot/ele-param1.jsp
index c5523e4..aee382c 100644
--- a/gx_tieta/WebRoot/ele-param1.jsp
+++ b/gx_tieta/WebRoot/ele-param1.jsp
@@ -483,20 +483,87 @@
 				
 				// 缂栬緫鐢垫睜缁勪俊鎭�
 				function editBattGroup(obj) {
-					$('#iframeEdit').data('data', obj.data);
-					iframePopup = layer.open({
-						type: 2
-						,area:['1200px', '520px']
-						,resize: false
-						,content: 'iframe/batt-info-edit.html'
-					});
+					//console.log(obj);
+					searchHomeInfoByName(obj.data.StationName);
 				}
+				
+				// 鏍规嵁鏈烘埧鐨勫悕绉版煡璇㈡満鎴跨殑淇℃伅
+				function searchHomeInfoByName(homename) {
+					var temp = {
+						binf:{
+							StationName1: '',					// 鐪�
+							StationName2: '',					// 甯�
+							StationName5: '',					// 鍖�/鍘�
+							StationName: homename		// 鏈烘埧鍚嶇О
+						}
+						,page: {
+							pageCurr: 1
+							,pageSize: 100
+						}
+					};
+					
+					var load = layer.load(1);
+					// 璇锋眰鍚庡彴
+					$.ajax({
+						type: "post", 				
+				        url: "BattInfAction!searchInform",				
+				        async:true,				
+				        dataType:'json',
+				        data:"json="+JSON.stringify(temp),
+				        	
+				        success: function(res){
+				        	var rs = JSON.parse(res.result)
+				        	if(rs.code == 1) {
+				        		var data = rs.data;
+				        		var tmp = {
+				        			btsinfo:[]
+				        		};
+				        		// 閬嶅巻鏌ヨ缁撴灉
+				        		for(var i=0; i<data.length; i++) {
+				        			var _data = data[i];
+				        			// 閬嶅巻缁撴灉闆嗙敓鎴愮壒娈婄殑鏍煎紡鏁版嵁
+				        			var _tmp = {};
+				        			Object.keys(_data).forEach(function(key) {
+				        				if(key == 'GroupIndexInFBSDevice') {		// 璁惧绱㈠紩
+				        					_tmp.GroupIndexInFBSDevice = _data.GroupIndexInFBSDevice;
+				        				}else if(key == 'BattGroupName') {		// 鐢垫睜缁勫悕绉�
+				        					_tmp.BattGroupName = _data.BattGroupName;
+				        				}else if(key == 'BattGroupId') {	// 鐢垫睜缁処D
+				        					_tmp.BattGroupId = _data.BattGroupId;
+				        				}else {
+				        					tmp[key] = _data[key];
+				        				}
+				        			});
+				        			
+				        			tmp.btsinfo.push(_tmp);
+				        		}
+				        		
+				        		//console.log(tmp);
+				        		$('#iframeEdit').data('data', tmp);
+								iframePopup = layer.open({
+									type: 2
+									,title: '淇敼鐢垫睜缁�'
+									,area:['1200px', '520px']
+									,resize: false
+									,content: 'iframe/batt-info-edit.html'
+								});
+				        	}else {
+				        		layer.msg('鑾峰彇鏁版嵁澶辫触锛�')
+				        	}
+				        },
+			        	complete: function() {
+			        		layer.close(load);
+			        	}
+				   });
+				}
+				
 				
 				// 鍒犻櫎鐢垫睜缁�
 				function delBattGroup(obj) {
 					//console.log(obj);
 					var data = obj.data;
-					var content = '鏄惁纭鍒犻櫎<span style="font-weight: bold; color: #FF5722">'+data.StationName3+'</span>'
+					var content = '鏄惁纭鍒犻櫎<span style="font-weight: bold; color: #FF5722">'+data.StationName3+
+									'-'+data.BattGroupName+'</span>'
 					layer.confirm(content,{
 						icon: 2
 						,title: '鎻愮ず'
@@ -509,12 +576,12 @@
 						var bts = data.StationName4;			// 璁惧鍚嶇О
 						data.StationName = province+'-'+city+'-'+home+'-'+bts;
 						var temp = [data];
-						delBatt(temp);
+						delBatt(temp, obj);
 					});
 				}
 				
 				//鍒犻櫎澶氫釜鐢垫睜缁�
-				function delBatt(temp){
+				function delBatt(temp, obj){
 					var load = layer.load(1);
 					$.ajax({
 						type: "post", 				
@@ -528,7 +595,8 @@
 							//console.info(model);
 							if(model.code ==1){
 								layer.msg('鍒犻櫎鎴愬姛锛�');
-								$('#paging .search').click();
+								obj.del();
+								//$('#paging .search').click();
 							}else{
 								layer.msg('鍒犻櫎澶辫触锛�');
 							}
@@ -585,36 +653,67 @@
 					if(len) {
 						_rsData = tOptions.data[len-1];
 					}
-					 
-					// 鎵撳紑闈㈡澘璁剧疆鏂板缓鐢垫睜缁勪釜鏁�
-					layer.open({
-						type: 1
-						,title: '閫夋嫨鏂板缓鐢垫睜缁勪釜鏁�'
-						,content: addGroupContent
-						,fixed: true
-						,resize: false
-						,btn:['纭畾', '鍙栨秷']
-						,yes: function(index) {
-							var groupNum = $('#addGroupnum').val();
-							layer.close(index);
-							// 鐢熸垚鏁扮粍
-							var _arr = [];
-							for(var i=0; i<groupNum; i++) {
-								_arr.push(i+1);
+					getMaxDevId(function(id) {
+						// 鎵撳紑闈㈡澘璁剧疆鏂板缓鐢垫睜缁勪釜鏁�
+						layer.open({
+							type: 1
+							,title: '閫夋嫨鏂板缓鐢垫睜缁勪釜鏁�'
+							,content: addGroupContent
+							,fixed: true
+							,resize: false
+							,btn:['纭畾', '鍙栨秷']
+							,yes: function(index) {
+								var groupNum = $('#addGroupnum').val();
+								layer.close(index);
+								// 鐢熸垚鏁扮粍
+								var _arr = [];
+								for(var i=0; i<groupNum; i++) {
+									_arr.push(i+1);
+								}
+								
+								_rsData.addGroupNum = _arr;
+								_rsData.FBSDeviceId = id;
+								$('#iframeEdit').data('data', _rsData);
+								
+								iframePopup = layer.open({
+									type: 2
+									,title: '鏂板缓鐢垫睜缁�'
+									,area:['1200px', '520px']
+									,resize: false
+									,content: 'iframe/batt-info-add.html'
+								});
 							}
-							
-							_rsData.addGroupNum = _arr;
-							$('#iframeEdit').data('data', _rsData);
-							
-							iframePopup = layer.open({
-								type: 2
-								,area:['1200px', '520px']
-								,resize: false
-								,content: 'iframe/batt-info-add.html'
-							});
-						}
-					});
+						});
+					}); 
+					
 				});
+				
+				// 鑾峰彇鏈�澶ц澶噄d
+				function getMaxDevId(callback) {
+					var load = layer.load(1);
+					// 鏌ヨ鍚庡彴
+					$.ajax({
+						type: 'post'
+						,async: true
+						,url: 'BattInfAction!searchmaxdev_id'
+						,data:null
+						,dataType: 'json'
+						,success:function(res) {
+							var rs = JSON.parse(res.result);
+							if(rs.data.length != 0) {
+								if(isFunction(callback)) {
+									callback(rs.data);
+								}
+							}else {
+								layer.msg('璁$畻璁惧id澶辫触锛�')
+							}
+						}
+						,complete: function() {
+							layer.close(load);
+						}
+						
+					});
+				}
 				
 				
 				// 鏌ヨ鐢垫睜缁勪俊鎭�
@@ -692,7 +791,6 @@
 				
 				//棣栭〉
 				$('#page_home').click(function(){
-					alert(123);
 					if(Page != undefined){
 						if(Page.curr != 1){
 							Page.setCurr(1);
@@ -724,7 +822,7 @@
 				//灏鹃〉
 				$('#page_last').click(function(){
 					if(Page != undefined){
-						if(Page.pageCurr < Page.num){
+						if(Page.curr < Page.num){
 							Page.setCurr(Page.num);
 							search(createSearchParam(), true);
 						}
@@ -736,7 +834,7 @@
 					var value=$('#number').val();
 					//褰撹緭鍏ョ殑鏁板ぇ浜�0鏃�
 					if(value>0){
-						if(value != Page.pageSize){
+						if(value != Page.size){
 							Page.setSize(parseInt(value));
 							Page.setCurr(1);
 						}

--
Gitblit v1.9.1