zhuth 7 years ago
parent
commit
c47c5638bc

+ 4 - 4
frontend/saas-web/app/view/home/Home.js

@@ -32,10 +32,10 @@ Ext.define('saas.view.home.Home', {
     }, {
         xtype: 'panel',
         title: '2018年11月经营分析',
-        latyout: 'column',
+        latyout: 'responsivecolumn',
         // items: [{
         //     xtype: 'core-chart-pie',
-        //     columnWidth: 0.33,
+        //     userCls: 'big-33 small-50',
         //     chartConfig: {
         //         captions: {
         //             credits: {
@@ -47,10 +47,10 @@ Ext.define('saas.view.home.Home', {
         //     }
         // }, {
         //     xtype: 'core-chart-bar',
-        //     columnWidth: 0.33
+        //     userCls: 'big-33 small-50',
         // }, {
         //     xtype: 'core-chart-gauge',
-        //     columnWidth: 0.33
+        //     userCls: 'big-33 small-50',
         // }]
     }, {
         title: '2018年11月经营分析',

+ 16 - 17
frontend/saas-web/app/view/home/Home.scss

@@ -134,37 +134,36 @@ $unaudit-purc-container-color: dynamic(#e91e63);
 
 .x-responsivecolumn {
     padding: 0;
-    display: block;
 }
 
 .big-100 {
-    width: 100%;
-    // @include responsivecolumn-item(100%);
+    // width: 100%;
+    @include responsivecolumn-item(100%);
 }
 
 .big-60 {
-    width: 60%;
-    // @include responsivecolumn-item(60%);
+    // width: 60%;
+    @include responsivecolumn-item(60%);
 }
 
 .big-50 {
-    width: 50%;
-    // @include responsivecolumn-item(50%);
+    // width: 50%;
+    @include responsivecolumn-item(50%);
 }
 
 .big-40 {
-    width: 40%;
-    // @include responsivecolumn-item(40%);
+    // width: 40%;
+    @include responsivecolumn-item(40%);
 }
 
 .big-33 {
-    width: 30%;
-    // @include responsivecolumn-item(33.33%);
+    // width: 33.33%;
+    @include responsivecolumn-item(33.33%);
 }
 
 .big-20 {
-    width: 20%;
-    // @include responsivecolumn-item(20%);
+    // width: 20%;
+    @include responsivecolumn-item(20%);
 }
 
 //--------------------------------------------------------
@@ -172,12 +171,12 @@ $unaudit-purc-container-color: dynamic(#e91e63);
 
  .x-responsivecolumn-small {
      > .small-100 {
-        width: 100%;
-        // @include responsivecolumn-item(100%);
+        // width: 100%;
+        @include responsivecolumn-item(100%);
      }
 
      > .small-50 {
-        width: 50%;
-        // @include responsivecolumn-item(50%);
+        // width: 50%;
+        @include responsivecolumn-item(50%);
      }
 }

+ 2 - 38
frontend/saas-web/app/view/home/HomeModel.js

@@ -26,45 +26,9 @@ Ext.define('saas.view.home.HomeModel', {
                 load: function(s, d) {
                     Ext.getCmp('infocard').setLoading(false);
 
-                    var titles = {
-                        unship: {
-                            text: '七天内待出货销售',
-                            color: 'yellow'
-                        },
-                        unstorage: {
-                            text: '七天内待入库采购',
-                            color: 'purple'
-                        },
-                        unpay: {
-                            text: '七天内代付款',
-                            color: 'red'
-                        },
-                        unreceive: {
-                            text: '七天内代收款',
-                            color: 'pink'
-                        },
-                        unauditcheck: {
-                            text: '未审核验收',
-                            color: 'blue'
-                        },
-                        unauditship: {
-                            text: '未审核出货',
-                            color: ''
-                        }
-                    };
-                    var res = d[0].data.data;
-                    var data = [];
-                    if(res) {
-                        for(var k in res) {
-                            data.push({
-                                title: titles[k].text,
-                                content: res[k] + '件',
-                                color: titles[k].color
-                            });
-                        }
-                    }
+                    var res = d[0].data.data || {};
 
-                    Ext.getCmp('infocard').addCardItems(data);
+                    Ext.getCmp('infocard').addCardItems(res);
                 }
             }
         },

+ 46 - 5
frontend/saas-web/app/view/home/InfoCard.js

@@ -29,6 +29,33 @@ Ext.define('saas.view.home.InfoCard', {
         '</div>'
     ],
 
+    cards: {
+        unship: {
+            title: '七天内待出货销售',
+            color: 'yellow'
+        },
+        unstorage: {
+            title: '七天内待入库采购',
+            color: 'purple'
+        },
+        unpay: {
+            title: '七天内代付款',
+            color: 'red'
+        },
+        unreceive: {
+            title: '七天内代收款',
+            color: 'pink'
+        },
+        unauditcheck: {
+            title: '未审核验收',
+            color: 'blue'
+        },
+        unauditship: {
+            title: '未审核出货',
+            color: ''
+        }
+    },
+
     initComponent: function () {
         var me = this;
 
@@ -55,25 +82,39 @@ Ext.define('saas.view.home.InfoCard', {
         me.callParent(arguments);
     },
 
+    listeners: {
+        boforerender: function(m) {
+            m.addCardItems();
+        }
+    },
+
     addCardItems: function(infoData) {
+        infoData = infoData || {};
         var me = this,
         p = me.up('home'),
-        // viewModel = p.getViewModel(),
-        // infoData = viewModel.get('infoData'),
+        cards = me.cards,
         datas = [],
         items = [];
         size = Math.ceil(me.body.el.getBox().width / 235);
 
         me.removeAll();
-        for(var x = 0; x < infoData.length;) {
+
+        var cl = Ext.Object.getAllKeys(cards);
+
+        for(var x = 0; x < cl.length;) {
             var d = [];
-            for(var y = 0; y < size && x < infoData.length; y++) {
-                d.push(infoData[x]);
+            for(var y = 0; y < size && x < cl.length; y++) {
+                var key = cl[x];
+                d.push(Ext.merge(cards[key], {
+                    content: infoData[key] || 0
+                }));
                 x++;
             }
             datas.push(d);
         }
 
+        console.log(datas);
+
         Ext.Array.each(datas, function(d, i) {
 
             var store = Ext.create('Ext.data.Store', {

+ 0 - 26
frontend/saas-web/resources/json/info.json

@@ -1,26 +0,0 @@
-[{
-    "title": "七天内待出货销售",
-    "content": "168件",
-    "color": "yellow"
-}, {
-    "title": "七天内待入库采购",
-    "content": "168件",
-    "color": "purple"
-}, {
-    "title": "七天内代付款",
-    "content": "168件",
-    "color": "red"
-}, {
-    "title": "七天内代收款",
-    "content": "168件",
-    "color": "yellow"
-}, {
-    "title": "未审核验收",
-    "content": "168件"
-}, {
-    "title": "七天内待出货销售",
-    "content": "168件"
-}, {
-    "title": "未审核出货",
-    "content": "168件"
-}]