From 4697c0980fa5a91ff85f6e8d64e941d49e4e0cd7 Mon Sep 17 00:00:00 2001
From: hdw <hdw@192.168.7.127>
Date: 星期一, 14 一月 2019 15:17:45 +0800
Subject: [PATCH] 批量电池参数设置和批量系统参数设置添加统计选中电池个数/总添加机房个数

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

diff --git a/gx_tieta/WebRoot/pages/js/mylayui.js b/gx_tieta/WebRoot/pages/js/mylayui.js
index e1a8557..86ac70f 100644
--- a/gx_tieta/WebRoot/pages/js/mylayui.js
+++ b/gx_tieta/WebRoot/pages/js/mylayui.js
@@ -543,3 +543,98 @@
     }
 };
 
+//鑾峰彇layui鐨刦orm琛ㄥ崟鐨勫��(鏀寔input鍜宻elect)
+var LayuiForm = function(ele) {
+    this.ele = ele;
+};
+// 瀹氫箟鍘熷瀷鏂规硶
+LayuiForm.prototype = {
+    get: function(callback) {
+        var ele = $('#'+this.ele);
+        var isGood = this._checkForm(ele);
+        if(isGood) {
+            var iptsVals = this._getIpts(ele);
+            var selVals = this._getSels(ele);
+            //  鑾峰彇鎵�鏈夌殑form鍊�
+            var rs = $.extend({}, iptsVals, selVals);
+            callback(rs);
+        }
+    }
+    ,_getIpts: function(ele) {
+        var ipts = ele.find('input');
+        var iptVals = {};
+        ipts.each(function() {
+            var name = $(this).attr('name');
+            if(name) {
+                iptVals[name] = $(this).val();
+            }
+        });
+
+        return iptVals;
+    }
+    ,_getSels: function(ele) {
+        var sels = ele.find('select');
+        var selVals = {};
+        sels.each(function() {
+            var name = $(this).attr('name');
+            if(name) {
+                selVals[name] = $(this).val();
+            }
+        });
+
+        return selVals;
+    }
+
+    ,_checkForm: function(ele) {
+        var isGood = true;
+        var ipts = ele.find('input');
+        var sels = ele.find('select');
+        //  閬嶅巻鎵�鏈夌殑input鏌ヨ鏄惁鏈夋暟鎹笉姝g‘鐨�
+        ipts.each(function() {
+            if($(this).hasClass('layui-form-danger')) {
+                isGood = false;
+            }
+        });
+
+        //  閬嶅巻鎵�鏈夌殑select鏌ヨ鏄惁鏈夋暟鎹笉姝g‘鐨�
+        sels.each(function() {
+            if($(this).hasClass('layui-form-danger')) {
+                isGood = false;
+            }
+        });
+
+        // 杩斿洖缁撴灉
+        return isGood;
+    }
+};
+
+// 缁熻鏁版嵁閫変腑涓暟/鎬讳釜鏁�
+var QuantNumber = function(ele) {
+	this.ele = ele;
+	this.mol = 0;
+	this.den = 0;
+	this._init();
+}
+// 璁剧疆鍘熷瀷鏂规硶
+QuantNumber.prototype = {
+	_init: function() {
+		this._setEleTxt();
+	}
+	,set: function(mol, den) {
+		this.mol = mol;
+		this.den = den;
+		this._setEleTxt();
+	}
+	,setMol: function(val) {
+		this.mol = val;
+		this._setEleTxt();
+	}
+	,setDen: function(val) {
+		this.den = val;
+		this._setEleTxt();
+	}
+	,_setEleTxt: function() {
+		var str = this.mol+'/'+this.den;
+		this.ele.text(str)
+	}
+};
\ No newline at end of file

--
Gitblit v1.9.1