From 7cb06e1b369e7d79b314a8a3573b215aa078c4c5 Mon Sep 17 00:00:00 2001
From: wtt <1985833171@qq.com>
Date: 星期二, 03 二月 2026 11:33:48 +0800
Subject: [PATCH] Merge branch 'master' of http://101.37.171.70:10101/r/MES-WEB-LayUI
---
WebTM/layuiadmin/common.js | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++--
1 files changed, 57 insertions(+), 2 deletions(-)
diff --git a/WebTM/layuiadmin/common.js b/WebTM/layuiadmin/common.js
index f4f6ddd..68b2fd1 100644
--- a/WebTM/layuiadmin/common.js
+++ b/WebTM/layuiadmin/common.js
@@ -20,8 +20,63 @@
}, delay);
// 閰嶇疆绔嬪嵆鎵ц
- if(callNow) {
+ if(callNow == true) {
func.apply(context, args)
}
};
-}
\ No newline at end of file
+}
+
+// 鍒ょ┖鍑芥暟
+function isEmpty(value, zeroIsEmpty = false, falseIsEmpty = false){
+ let val = value
+ // 妫�鏌ユ槸鍚︿负null 鎴栬�� undefind
+ if(val === null || val === undefined){
+ return true;
+ }
+ //濡傛灉瀛楃涓插叏閮ㄦ槸鐢辨暟瀛楁瀯鎴愮殑锛屽垯杞寲涓烘暟瀛楀瀷
+ if(isAllDigits(val) === true){
+ val = Number(val)
+ }
+
+ // 鏄惁鏄瓧绗︿覆绫诲瀷
+ if(typeof val === 'string') {
+ return val.trim().length === 0;
+ }
+
+ // 鏄惁鏄暟缁�
+ if(Array.isArray(val)) {
+ return val.length === 0;
+ }
+
+ //鏄惁鏄璞�
+ if(typeof val === 'object') {
+ return Object.keys(val).length === 0;
+ }
+
+ // 鏁板瓧绫诲瀷榛樿涓嶄负绌�
+ if(typeof val === 'number'){
+ // 鏁板瓧涓�0瑙嗕负绌�
+ if(zeroIsEmpty == true){
+ if(val === 0){
+ return true
+ }
+ }
+ return false
+ }
+
+ // 甯冨皵绫诲瀷榛樿涓嶄负绌�
+ if (typeof val === 'boolean') {
+ // false鍊艰涓虹┖
+ if(falseIsEmpty == true){
+ if(val === 0){
+ return true
+ }
+ }
+ return false;
+ }
+}
+
+// 鍒ゆ柇鏄惁鍏ㄦ槸鏁板瓧
+function isAllDigits(str) {
+ return /^\d+$/.test(str);
+}
--
Gitblit v1.9.1