소스 검색

数据预处理调整

MaiXinRong 4 년 전
부모
커밋
0eac68aa0c
1개의 변경된 파일6개의 추가작업 그리고 5개의 파일을 삭제
  1. 6 5
      app/lib/rpt_data_analysis.js

+ 6 - 5
app/lib/rpt_data_analysis.js

@@ -49,6 +49,7 @@ const valueCheck = {
         }
     },
     _checkString(ctx, value, condition) {
+        if (!value) return false;
         switch (condition.operate) {
             case '=':
                 return value === condition.value;
@@ -65,15 +66,15 @@ const valueCheck = {
             c.fun = this._typeFun[c.type];
         }
     },
-    checkData(data, condition) {
+    checkData(ctx, data, condition) {
         if (condition.length > 0) {
             let con = condition[0];
-            let result = this[con.fun](ctx, d[con.field], con);
+            let result = this[con.fun](ctx, data[con.field], con);
             for (let i = 1, iLen = condition.length; i < iLen; i++) {
                 con = condition[i];
                 result = (con.rela && con.rela === 'or')
-                    ? (result || this[con.fun](ctx, d[con.field], con))
-                    : (result && this[con.fun](ctx, d[con.field], con));
+                    ? (result || this[con.fun](ctx, data[con.field], con))
+                    : (result && this[con.fun](ctx, data[con.field], con));
             }
             return result;
         }
@@ -1695,7 +1696,7 @@ const treeFilter = {
     },
     _checkPath(matchPath, full_path) {
         for (const mp of matchPath) {
-            if (full_path.indexOf(mp) === 1) return true;
+            if (full_path.indexOf(mp) === 0) return true;
         }
         return false;
     },