zhuth 6 년 전
부모
커밋
ed93865b4e

+ 2 - 10
frontend/pc-web/app/view/home/Home.js

@@ -39,16 +39,11 @@ Ext.define('school.view.home.Home', {
 
         latyout: 'responsivecolumn',
         defaults: {
-            userCls: 'x-home-chart big-50 small-50',
+            userCls: 'x-home-chart big-100 small-100',
         },
         items: [{
-            xtype: 'studentgender',
+            xtype: 'inoutrecord',
             padding: '0 0 0 14',
-            margin: '0 16 0 0',
-        }, {
-            xtype: 'chinessavg',
-            padding: '0 0 0 14',
-            margin: 0,
         }]
     }],
 
@@ -59,18 +54,15 @@ Ext.define('school.view.home.Home', {
 
     listeners: {
         onTabActivate: function(p) {
-            return;
             p.refreshId = window.setInterval((p.refreshStores.bind(p)()).bind(p), p.REFRESH_INTERVALS);
         },
         onTabDeactivate: function(p) {
-            return;
             p.lastTime = 0;
             window.clearInterval(p.refreshId);
         }
     },
 
     refreshStores: function() {
-        return;
         var me = this,
         lastTime = me.lastTime || 0,
         now = Ext.Date.now(),

+ 37 - 0
frontend/pc-web/app/view/home/HomeModel.js

@@ -6,6 +6,43 @@ Ext.define('school.view.home.HomeModel', {
     },
 
     stores: {
+        infoData: {
+            fields: [],
+            autoLoad: true,
+            proxy: {
+                type: 'ajax',
+                // url: 'http://10.1.80.36:9520/api/school/portal/home',
+                url: '/api/school/portal/home',
+                timeout: 8000,
+                actionMethods: {
+                    read: 'GET'
+                },
+                reader: {
+                    type: 'json'
+                },
+                listeners: {
+                    exception: function(proxy, response, operation, eOpts) {
+                        var p = Ext.getCmp('infocard');
+                        p && p.setLoading(false);
+                    }
+                }
+            },
+            listeners: {
+                beforeload: function() {
+                    var p = Ext.getCmp('infocard');
+                        p && p.setLoading(true);
+                },
+                load: function(s, d) {
+                    var p = Ext.getCmp('infocard');
+                        p && p.setLoading(false);
+
+                    if(!d) return;
+                    var res = d[0] ? (d[0].data ? (d[0].data.data || {}) : {}) : {};
+
+                    Ext.getCmp('infocard').addCardItems(res);
+                }
+            }
+        },
         studentgender: {
             fields: ['x', 'y'],
             data: [{

+ 12 - 24
frontend/pc-web/app/view/home/InfoCard.js

@@ -34,15 +34,20 @@ Ext.define('school.view.home.InfoCard', {
 
         Ext.apply(me, {
             cards: {
-                staff: {
-                    title: '职工人数',
+                student: {
+                    title: '学生人数',
+                    color: 'blue',
+                    viewType: 'home-infocardlist-unauditcheckin',
+                },
+                teacher: {
+                    title: '教职工人数',
                     color: 'yellow',
                     viewType: 'home-infocardlist-saleout',
                 },
-                teacher: {
-                    title: '教师人数',
-                    color: 'purple',
-                    viewType: 'home-infocardlist-purchasein',
+                parent: {
+                    title: '家长人数',
+                    color: 'default',
+                    viewType: 'home-infocardlist-unauditsaleout',
                 },
                 grade: {
                     title: '年级',
@@ -53,16 +58,6 @@ Ext.define('school.view.home.InfoCard', {
                     title: '班级',
                     color: 'pink',
                     viewType: 'home-infocardlist-recment',
-                },
-                student: {
-                    title: '学生人数',
-                    color: 'blue',
-                    viewType: 'home-infocardlist-unauditcheckin',
-                },
-                parent: {
-                    title: '家长人数',
-                    color: 'default',
-                    viewType: 'home-infocardlist-unauditsaleout',
                 }
             },
             userCls: 'x-info-card ' + me.userCls,
@@ -97,14 +92,7 @@ Ext.define('school.view.home.InfoCard', {
     },
 
     initCardItems: function() {
-        this.addCardItems({
-            staff: 39,
-            teacher: 89,
-            grade: 6,
-            class: 36,
-            student: 980,
-            parent: 1783
-        });
+        this.addCardItems({});
     },
 
     addCardItems: function(infoData) {

+ 1 - 0
frontend/pc-web/app/view/home/InfoCard.scss

@@ -80,6 +80,7 @@ $card-box-height: 110px;
     }
 
     .x-mask {
+        border: none !important;
         background-color: transparent;
     }
 }

+ 105 - 0
frontend/pc-web/app/view/home/charts/InOutRecord.js

@@ -0,0 +1,105 @@
+Ext.define('school.view.home.charts.InOutRecord', {
+    extend: 'school.view.core.chart.ChartBase',
+    xtype: 'inoutrecord',
+
+    id: 'inoutrecord',
+
+    title: '学生出入校数据',
+
+    initComponent: function () {
+        var me = this;
+
+        Ext.apply(me, {
+            items: [{
+                xtype: 'echartsbase',
+                bind: {
+                    store: '{infoData}',
+                },
+                createOption: me.createOption
+            }]
+        });
+
+        me.callParent(arguments);
+    },
+
+    createOption: function (store) {
+        var inData = [],
+            outData = [];
+
+        Ext.Array.each(store.getData().items[0].data.data.inoutRecord, function (d) {
+            if(d.type == 1) {
+                inData.push([
+                    d.date, d.count
+                ]);
+            }else {
+                outData.push([
+                    d.date, d.count
+                ]);
+            }
+        });
+
+        return {
+            color: [
+                '#64B0E4',
+                '#FF1038'
+            ],
+            tooltip: {
+                trigger: 'axis'
+            },
+            legend: {
+                left: 0,
+                data: ['入校', '出校'],
+                icon: 'rect',
+                itemWidth: 10,
+                itemHeight: 2
+            },
+            grid: {
+                left: 0,
+                right: 16,
+                bottom: 5,
+                top: 40,
+                borderColor: '#E5EAEF',
+                containLabel: true
+            },
+            xAxis: {
+                type: 'time',
+                boundaryGap: false,
+                axisLine: {
+                    lineStyle: {
+                        color: '#E5EAEF',
+                    }
+                },
+                axisLabel: {
+                    color: '#485465'
+                },
+            },
+            yAxis: {
+                type: 'value',
+                axisLine: {
+                    lineStyle: {
+                        color: '#E5EAEF',
+                    }
+                },
+                splitLine: {
+                    lineStyle: {
+                        color: ['#E5EAEF']
+                    }
+                },
+                axisLabel: {
+                    color: '#485465'
+                }
+            },
+            series: [{
+                name: '入校',
+                showSymbol: true,
+                type: 'line',
+                data: inData
+            }, {
+                name: '出校',
+                showSymbol: true,
+                type: 'line',
+                data: outData
+            }]
+        }
+    }
+});