From 417c6db1ab7698f625bcc6452c2936981fade14b Mon Sep 17 00:00:00 2001
From: hdw <496960745@qq.com>
Date: 星期四, 06 十二月 2018 12:19:34 +0800
Subject: [PATCH] 打开系统设置面板检测数据的正确性 

---
 gx_tieta/WebRoot/pages/js/common.js |   58 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 58 insertions(+), 0 deletions(-)

diff --git a/gx_tieta/WebRoot/pages/js/common.js b/gx_tieta/WebRoot/pages/js/common.js
index 6587c43..ff2da15 100644
--- a/gx_tieta/WebRoot/pages/js/common.js
+++ b/gx_tieta/WebRoot/pages/js/common.js
@@ -487,6 +487,64 @@
 	
 })(jQuery, window, document, GLOBAL);
 
+// 鏂囨湰妗嗘暟鎹殑楠岃瘉
+;(function($, window, document, gl, undefined) {
+	// 瀹氫箟testVal鐨勫懡鍚嶇┖闂�
+	gl.namespace('testVal');
+	// 楠岃瘉鏁版嵁
+	function check(ele, ptn, callback) {
+		var val = ele.val();
+		var isGood = regVal(val, ptn);
+		setStyle(ele, isGood, ptn, callback);
+	}
+	
+	// 灏嗘暟鎹粦瀹氬埌GLOBAL.testVal涓�
+	gl.testVal.check = check;
+	
+	// 妫�娴嬫暟鎹殑鏈夋晥鎬�
+	function regVal(val, ptn) {
+		var flag = true;
+		var _val = val;
+		
+		// 妫�楠屾暟鎹牸寮忔槸鍚︽湁鏁�
+		if(!ptn.pattern.test(_val)) {
+			flag = false;
+		}
+		
+		// 妫�楠屾暟鎹槸鍚﹀湪鍙栧�煎尯闂�(鍓嶆彁鏄暟鎹牸寮忔纭笖鏈夊尯闂�)
+		if(flag && ptn.regVal) {
+			// val鍊间笉鍦ㄥ彇鍊艰寖鍥�
+			if(val<ptn.min || val>ptn.max) {
+				flag = false;
+			}
+		}
+		
+		return flag;
+	}
+	
+	// 璁剧疆鏂囨湰妗嗙殑鏍峰紡
+	function setStyle(ele, isGood, ptn, callback) {
+		if(isGood) {
+			ele.next('i').removeClass('error-data');
+			ele.myTooltip('hide');
+			ele.removeClass('error-data');
+		}else {
+			ele.next('i').addClass('error-data');
+			ele.myTooltip({
+                position: ptn.position,
+                thing: 'show',
+                update: ptn.update,
+                content: '<span style="color:#FF0000">'+ptn.msg+'</span>'
+			});
+			ele.addClass('error-data');
+		}
+		// 鏄惁鍥炶皟鍑芥暟
+		//console.log(callback);
+		if(isFunction(callback)) {
+			callback();
+		}
+	}
+})(jQuery, window, document, GLOBAL);
 
 // 鐢熸垚闃块噷鍥炬爣鐨勫厓绱�
 function create_ali_font(cla, color, data) {

--
Gitblit v1.9.1