소스 검색

数据过滤,null问题

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

+ 3 - 48
app/lib/rpt_data_analysis.js

@@ -49,14 +49,13 @@ const valueCheck = {
         }
     },
     _checkString(ctx, value, condition) {
-        if (!value) return false;
         switch (condition.operate) {
             case '=':
                 return value === condition.value;
             case 'part':
-                return !ctx.helper._.isNil(value) ? value.indexOf(condition.value) >= 0 : false;
+                return value ? value.indexOf(condition.value) >= 0 : false;
             case 'enum':
-                return (!ctx.helper._.isNil(value) && condition.value instanceof Array) ? condition.value.indexOf(value) >= 0 : false;
+                return (value && condition.value instanceof Array) ? condition.value.indexOf(value) >= 0 : false;
             default:
                 return true;
         }
@@ -662,7 +661,6 @@ const gatherChapter = {
             return (x.visible !== undefined && x.visible !== null) ? x.visible : true;
 
         });
-        console.log(data[fieldsKey[0].table])
     },
 };
 const join = {
@@ -785,52 +783,10 @@ const filter = {
         str: '_checkString',
         num: '_checkNumber',
     },
-    _checkBoolean(ctx, value, condition) {
-        switch (condition.value) {
-            case 'true':
-                return !!value;
-            case 'false':
-                return !value;
-            default:
-                return true;
-        }
-    },
-    _checkNumber(ctx, value, condition) {
-        // if (ctx.helper._.isNil(value)) value = 0;
-        switch (condition.operate) {
-            case 'non-zero':
-                return !ctx.helper.checkZero(value);
-            case '=':
-                return !ctx.helper._.isNil(value) ? value === condition.value : false;
-            case '>':
-                return !ctx.helper._.isNil(value) ? value > condition.value : false;
-            case '<':
-                return !ctx.helper._.isNil(value) ? value < condition.value : false;
-            case '>=':
-                return !ctx.helper._.isNil(value) ? value >= condition.value : false;
-            case '<=':
-                return !ctx.helper._.isNil(value) ? value <= condition.value : false;
-            default:
-                return true;
-        }
-    },
-    _checkString(ctx, value, condition) {
-        switch (condition.operate) {
-            case '=':
-                return value === condition.value;
-            case 'part':
-                return !ctx.helper._.isNil(value) ? value.indexOf(condition.value) >= 0 : false;
-            case 'enum':
-                return (!ctx.helper._.isNil(value) && condition.value instanceof Array) ? condition.value.indexOf(value) >= 0 : false;
-            default:
-                return true;
-        }
-    },
     fun(ctx, data, fields, options) {
         if (!options || !options.table || !options.condition) return;
 
-        const fData = data[options.table],
-            self = this;
+        const fData = data[options.table];
         if (!fData) return;
 
         valueCheck.loadTypeFun(options.condition);
@@ -848,7 +804,6 @@ const filter = {
                 return result;
             }
             return true;
-
         });
     },
 };