From 265e07e56a6abfac6c5aa941397dcbca573d18af Mon Sep 17 00:00:00 2001
From: hdw <496960745@qq.com>
Date: 星期一, 12 十一月 2018 11:42:10 +0800
Subject: [PATCH] 添加面板

---
 gx_tieta/WebRoot/control.jsp             |   45 ++++++++++++--
 gx_tieta/WebRoot/js/elecircle.content.js |   94 ++++++++++++++++++++++++++++++-
 2 files changed, 127 insertions(+), 12 deletions(-)

diff --git a/gx_tieta/WebRoot/control.jsp b/gx_tieta/WebRoot/control.jsp
index 71d3b71..b84c4c2 100644
--- a/gx_tieta/WebRoot/control.jsp
+++ b/gx_tieta/WebRoot/control.jsp
@@ -1799,9 +1799,9 @@
 						
 						var alarmstates = GLOBAL.BTS9100.alarmstates;
 						var lastStopReason = getStateFromIndex(_data.dev_last_captest_stop_type,alarmstates);
-						console.info("涓婁竴娆℃牳瀹规祴璇曞仠姝㈠師鍥狅細"+lastStopReason);
-						console.info("閫氫俊璁℃暟锛�"+_data.dev_commcount);
-						console.info("閫氫俊涓㈠寘鐜囷細"+(_data.dev_commcount==0?0:(_data.dev_errcommcount*100/_data.dev_commcount)));						
+						//console.info("涓婁竴娆℃牳瀹规祴璇曞仠姝㈠師鍥狅細"+lastStopReason);
+						//console.info("閫氫俊璁℃暟锛�"+_data.dev_commcount);
+						//console.info("閫氫俊涓㈠寘鐜囷細"+(_data.dev_commcount==0?0:(_data.dev_errcommcount*100/_data.dev_commcount)));						
 						
 						var nowTime = new Date().getTime();		//褰撳墠鏃堕棿
 						var record = new Date(model.data[0].record_datetime).getTime();
@@ -3457,9 +3457,11 @@
 		});
 	}
 		// 鏍规嵁璁惧淇℃伅鏄剧ず瀵瑰簲鐢佃矾鎷撴墤鍥�
+		
 		function updateEleCircle(batt, data, mygraph) {
 			var status = GLOBAL.circleStatus.status;
-			//console.info(status);
+			var e61850Opts = GLOBAL.circleStatus.e61850Opts;
+			var btsOpts = GLOBAL.circleStatus.btsOpts;
 			// 鍒濆鍖栦簩绾х
 			changeEleCircleOpt(eleCircle, 'diode', {
 				isShowValue: false,
@@ -3477,7 +3479,7 @@
 			// 鎷撴墤鍥惧浘鏍�
 			changeEleCircleOpt(eleCircle, 'DCDC1', {statusImg:-1});	// 鏀剧數鍗曞厓
 			changeEleCircleOpt(eleCircle, 'DCDC2', {statusImg:-1});	// 鍏呯數鍗曞厓
-			
+			console.log(data);
 			// 娌℃湁褰㈠弬灏变笉鍋氫换浣曟搷浣�
 			if(data == undefined) {
 				status.hide();
@@ -3488,6 +3490,7 @@
 			if(regEquipType(data.dev_id, globalPattern.equip61850)) {
 				//console.info(data);
 				var alarms = data.dev_61850alarms.split(',');
+				status.setOpts(e61850Opts);
 				status.show();
 				//alarms = ['true', 'false', 'true', 'true'];
 				// 璁剧疆浜岀骇绠$殑瀵奸�氬帇闄�
@@ -3528,7 +3531,31 @@
 				// 鎷撴墤鍥惧浘鏍�
 				changeEleCircleOpt(eleCircle, 'DCDC1', {statusImg:mygraph.graphtype});	// 鏀剧數鍗曞厓
 				changeEleCircleOpt(eleCircle, 'DCDC2', {statusImg:mygraph.graphtype});	// 鍏呯數鍗曞厓
-			}else {
+			}else if(regEquipType(data.dev_id, globalPattern.BTS)){		// 鍒ゆ柇濡傛灉鏄疊TS9100鐨勮澶�
+				// 璁剧疆鐘舵�佺殑閰嶇疆椤�
+				status.setOpts(btsOpts);
+				
+				// 宸ヤ綔鐘舵��
+				status.setStatus('workstatus', data.dev_workstate);
+				
+				// 璁剧疆鏍稿鍋滄鍘熷洜
+				if(data.dev_workstate == 2) {
+					status.setStatus('stop', 99);
+				}else {
+					status.setStatus('stop', data.dev_last_captest_stop_type);	
+				}
+				
+				// 璁剧疆閫氫俊璁℃暟
+				status.setText('count', "閫氫俊璁℃暟锛�"+data.dev_commcount);
+				
+				// 璁剧疆涓㈠寘鐜�
+				var errorCount = data.dev_errcommcount;
+				var allCount = data.dev_commcount+errorCount;
+				var percent= (allCount==0?0:errorCount/allCount*100).toFixed(3);
+				status.setText('percent', "閫氫俊涓㈠寘鐜囷細"+percent+'%');
+				
+				status.show();
+			}else{
 				status.hide();
 			}
 		}
@@ -4506,7 +4533,8 @@
 			$('#sysSet_read').click(function() {
 				var batt = getBatt();
 				var temp = {
-					dev_id:batt.FBSDeviceId
+					dev_id:batt.FBSDeviceId,
+					num: sysCMD.get
 				};
 				searchSysData(temp, true);
 			});
@@ -4515,7 +4543,8 @@
 			$('#sysSet').click(function() {
 				var batt = getBatt();
 				var temp = {
-					dev_id:batt.FBSDeviceId
+					dev_id:batt.FBSDeviceId,
+					num: sysCMD.get
 				};
 				searchSysData(temp);
 			});
diff --git a/gx_tieta/WebRoot/js/elecircle.content.js b/gx_tieta/WebRoot/js/elecircle.content.js
index 6ae94b9..265753a 100644
--- a/gx_tieta/WebRoot/js/elecircle.content.js
+++ b/gx_tieta/WebRoot/js/elecircle.content.js
@@ -812,7 +812,18 @@
         }
         this.ele.append(_ul);
     };
-
+    
+    // 璁剧疆閰嶇疆椤�
+    _prop.setOpts = function(options) {
+    	this.options = options;
+        
+        this._init();
+        
+        if(this.options.length != 0) {
+            this.show();
+        }
+    };
+    
     // 鏍规嵁閰嶇疆椤圭殑鍊艰幏鍙杔i
     _prop._setLi = function(li, option) {
         var _i, _a = $('<a></a>');
@@ -838,6 +849,9 @@
         	}
         	var list = option.content.list[option.status]?option.content.list[option.status]:'鏈煡';
         	var txt = option.content.text+list;
+        	_a.append(txt);
+        }else if(option.type == 'text') {
+        	var txt = option.content.text;
         	_a.append(txt);
         }
         
@@ -884,6 +898,29 @@
             }
         }
 
+    };
+    
+    // 璁剧疆鏂囨湰鍐呭
+    _prop.setText = function(name, text, notShow) {
+    	var _itemList = this.ele.find('li');
+    	// 閬嶅巻閰嶇疆椤�
+        for(var i =0; i<this.options.length; i++) {
+        	var _opts = this.options[i];    // 鑾峰彇褰撳墠寰幆鐨勫彉閲�
+        	// 鏍规嵁鍚嶇О纭畾鏇存敼鐨勫唴瀹�
+            if(_opts.name == name) {
+                var _tmp = $.extend({}, _opts); // 鑾峰彇鍏ㄦ柊瀵硅薄锛岄伩鍏嶅紩鐢ㄤ紶閫�
+                _tmp.content.text = text;
+                
+                // 璁剧疆鏄惁鏄剧ず
+                if(notShow) {
+                	_tmp.notShow = true;
+                }else {
+                	_tmp.notShow = false;
+                }
+                
+                this._setLi(_itemList.eq(i), _tmp); // 鏇存柊li鐨勫唴瀹�
+            }
+        }
     };
     var options = [
 		{
@@ -935,6 +972,53 @@
         	}
         }
     ];
+    // 61850閰嶇疆椤�
+    gl.circleStatus.e61850Opts = options;
+    
+    var optionsBts = [
+		{
+			name: 'workstatus',
+			type: 'list',
+			notShow: false,
+			imgCallback: gl.statusImg.getImg,
+			status: 0,
+			content: {
+				list:gl.BTS9100.workstates,
+				text: '璁惧鐘舵��:'
+			}
+		},
+		{
+			name: 'stop',
+			type: 'list',
+			status: 0,
+			notShow: false,
+			content: {
+				list:gl.BTS9100.alarmstates,
+				text: '涓婁竴娆℃牳瀹圭粓姝㈠師鍥狅細'
+			}
+		},
+		{
+			name: 'count',
+			type: 'text',
+			status: 0,
+			notShow: false,
+			content: {
+				text: '閫氫俊璁℃暟:'
+			}
+		},
+		{
+			name: 'percent',
+			type: 'text',
+			status: 0,
+			notShow: false,
+			content: {
+				text:'閫氫俊涓㈠寘鐜�:'
+			}
+		}
+    ];
+    // bts9100閰嶇疆椤�
+    gl.circleStatus.btsOpts = optionsBts;
+    
     var status = new Status($('#eleCircleStatus'), options);
     gl.circleStatus.status = status;
     
@@ -955,9 +1039,6 @@
     		var data = model.data[0];
         	var alarmstatus = data.dev_alarmstate;	//[0:'鏃�',1:'鏆傚仠',2:'鏀剧數娴嬭瘯',3:'鏀剧數绛夊緟',4:'闄愭祦鍏呯數',5:'鐩存祦鍏呯數',6:'鍏呯數绛夊緟',7:'娴嬭瘯鏃堕棿鍒�',8:'娴嬭瘯瀹归噺鍒�',9:'鍗曚綋涓嬮檺鍒�',10:'缁勭涓嬮檺鍒�',11:'甯傜數寮傚父',12:'瀛樺偍鍗′笉瓒�',13:'璐熻浇娓╁害楂�',14:'鐢垫祦寮傚父',15:'杩滅▼閫氫俊鍧�',16:'璐熻浇閫氫俊鍧�',17:'閫夋嫨閫氫俊鍧�',18:'璐熻浇鐢垫祦鍧�',19:'鍐呭瓨鐢宠鍧�',20:'鏈煡'];
     		var workstatus =parseInt(data.dev_workstate) ;	//[0:'鍦ㄧ嚎鐩戞祴',1:'鏀剧數娴嬭瘯',2:'鍏呯數娴嬭瘯',3:'鍐呴樆娴嬭瘯',4:'鏈煡'];
-        	if(typeof callback == 'function') {
-        		callback.call({}, data);
-        	}
         	// 鍒ゆ柇workstatus
         	switch(workstatus) {
         		case 0:	{	// 娴厖鐘舵��
@@ -1020,6 +1101,11 @@
         		}
         		break;
         	}
+        	
+        	// 璁剧疆宸︿笂鏂瑰唴瀹�
+        	if(typeof callback == 'function') {
+        		callback.apply({}, [batt, data, mygraph]);
+        	}
     	}else {
     		mygraph.graphtype = 4 ;
 			_str = '(鏈繛鎺�)';

--
Gitblit v1.9.1