From e41c8ce514dffeb999d737ea8dbda30ab8b60aa0 Mon Sep 17 00:00:00 2001
From: licp <lichunping@guanfang.com.cn>
Date: 星期五, 28 六月 2024 10:56:17 +0800
Subject: [PATCH] 优化

---
 src/util/excelFountion.js |   12 +++++++++---
 1 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/src/util/excelFountion.js b/src/util/excelFountion.js
index 406c872..d879f8f 100644
--- a/src/util/excelFountion.js
+++ b/src/util/excelFountion.js
@@ -12,6 +12,7 @@
 function MAX(...val){
   let max = 0;
   if(val&&val.length>0){
+    val = val.filter(item=>item!=null&&item!=='')
     max = Math.max(...val)
   }
   return max;
@@ -19,6 +20,7 @@
 function MIN(...val){
   let min = 0;
   if(val&&val.length>0){
+    val = val.filter(item=>item!=null&&item!=='')
     min = Math.min(...val)
   }
   return min;
@@ -26,12 +28,16 @@
 
 function AVERAGE(...val){
   let num = 0;
+  let arr = [];
   if(val&&val.length>0){
-    val.forEach(item=>{
+    arr = val.filter(item=>item!=null&&item!=='')
+    arr.forEach(item=>{
       num+=item;
     })
+    return num/arr.length;
+  }else{
+    return 0;
   }
-  return num/val.length;
 }
 
 function APS(val){
@@ -157,7 +163,7 @@
   // 鑾峰彇鍗曞厓鏍煎搴斿��
   let arr = getAllCell(f)
   for (var a in comValue) {
-    if(comValue[a]){
+    if(comValue[a]!=='undefine'&&comValue[a]!=='null'&&comValue[a]!==undefined){
       arr[a] = comValue[a]
     }
   }

--
Gitblit v1.9.3