Browse Source

报表过滤条件逻辑完善

zhuth 6 years ago
parent
commit
41f4e8c85a
1 changed files with 14 additions and 10 deletions
  1. 14 10
      src/models/dashboardDesigner.js

+ 14 - 10
src/models/dashboardDesigner.js

@@ -17,6 +17,7 @@ function getTrueFilters(item, filters) {
             column.relations.forEach(re => {
                 if(re.dataSource.code === item.dataSourceCode) {
                     trueFilters.push({
+                        dataSourceCode: re.dataSource.code,
                         name: re.column.name,
                         operator: f.operator,
                         type: f.type,
@@ -27,24 +28,27 @@ function getTrueFilters(item, filters) {
                 }
             });
         }else {
-            trueFilters.push({
-                name: f.name,
-                operator: f.operator,
-                type: f.type,
-                value1: f.value1,
-                value2: f.value2,
-                using: f.using
-            });
+            if(f.dataSource.name === item.dataSourceCode) {
+                trueFilters.push({
+                    dataSourceCode: f.dataSource.name,
+                    name: f.name,
+                    operator: f.operator,
+                    type: f.type,
+                    value1: f.value1,
+                    value2: f.value2,
+                    using: f.using
+                });
+            }
         }
     });
-    console.log(trueFilters);
     return trueFilters;
 }
 
 function getBodyFilters(filters) {
     return filters.filter(f => f.using).map(f => {
-        let { name, operator, type, value1, value2 } = f;
+        let { dataSourceCode, name, operator, type, value1, value2 } = f;
         let bodyFilter = {
+            dataSourceCode,
             columnName: name,
             columnType: type,
             symbol: operator,