Browse Source

首页 本月销售额暂无数据判断逻辑与数据展示过滤逻辑统一(只保留大于0的数据)

zhuth 7 years ago
parent
commit
7d6e434bd5

+ 8 - 3
frontend/saas-web/app/view/core/chart/EChartsBase.js

@@ -174,11 +174,11 @@ Ext.define('saas.view.core.EChartsBase', {
 
         me.removeEmptyChart();
 
-        if(dataCount > 0) {
+        if(me.isEmpty(store)) {
+            me.appendEmptyChart();
+        }else {
             option = me.createOption(store);
             me.echarts.setOption(option);
-        }else {
-            me.appendEmptyChart();
         }
     },
 
@@ -204,6 +204,11 @@ Ext.define('saas.view.core.EChartsBase', {
         }
     },
 
+    isEmpty: function(store) {
+        var dataCount = store.getCount();
+        return dataCount <= 0;
+    },
+
     createOption: function(store) {
         return null;
     }

+ 11 - 0
frontend/saas-web/app/view/home/charts/MonthSale.js

@@ -18,6 +18,7 @@ Ext.define('saas.view.home.charts.MonthSale', {
                 bind: {
                     store: '{month_sale}',
                 },
+                isEmpty: me.isEmpty,
                 createOption: me.createOption
             }]
         });
@@ -25,6 +26,16 @@ Ext.define('saas.view.home.charts.MonthSale', {
         me.callParent(arguments);
     },
 
+    isEmpty: function(store) {
+        var index = store.findBy(function(s) {
+            return s.get('y') > 0;
+        });
+        
+        var flag = index == -1;
+
+        return flag;
+    },
+
     createOption: function(store) {
         var fields = [],
         data = [];