Prechádzať zdrojové kódy

班级组织接口对接

zhuth 6 rokov pred
rodič
commit
75d31df4bd

+ 2 - 2
frontend/pc-web/app/view/basic/class/ClassInfoController.js

@@ -114,8 +114,8 @@ Ext.define('school.view.basic.class.ClassInfoController', {
         id = data.id,
         type = data.type;
 
-        var title = type == 'school' ? '新增年级' : '新增班级';
-        var sumType = type == 'school' ? 'grade' : 'class';
+        var title = type == 'SCHOOL' ? '新增年级' : '新增班级';
+        var sumType = type == 'SCHOOL' ? 'GRADE' : 'CLASS';
         if(!win) {
             win = Ext.create('Ext.window.Window', {
                 width: 300,

+ 1 - 1
frontend/pc-web/app/view/basic/class/ListCard.js

@@ -50,7 +50,7 @@ Ext.define('school.view.basic.class.ListCard', {
         classDetail = refs.classdetail,
         list, cardList;
 
-        if(node.data.type == 'class') {
+        if(node.data.type == 'CLASS') {
             currentlist.removeAll();
             listCard.setVisible(false);
             classDetail.setVisible(true);

+ 18 - 215
frontend/pc-web/app/view/viewport/ViewportModel.js

@@ -40,229 +40,32 @@ Ext.define('school.view.viewport.ViewportModel', {
             }],
             proxy: {
                 type: 'ajax',
-                // url: 'http://10.1.80.35:9560/grade/read/1',
+                // url: 'http://10.1.80.35:9520/grade/read/1',
                 url: '/grade/read/1',
                 reader: {
-                    type: 'json'
+                    transform: {
+                        fn: function(data) {
+                            let schools = data.data.children;
+                            schools.map(function(s) {
+                                s.id = 'school-' + s.id;
+                                let classes = s.children;
+                                classes.map(function(c) {
+                                    c.id = 'class-' + c.id;
+                                    return c;
+                                });
+                                return s;
+                            });
+                            return schools;
+                        },
+                        scope: this
+                    }
                 }
             },
             root: {
                 text: '全年级',
-                type: 'school',
+                type: 'SCHOOL',
                 expanded: true
             },
-            data1: [{
-                id: 'g1',
-                text: '一年级',
-                // grade_id: '1',
-                // grade_name: '一年级',
-                // grade_status: '1',
-                // grade_remarks: 'beizhu',
-                // grade_adress: '值dadada dad',
-                // school_id: '1',
-                type: 'grade',
-                children: [{
-                    id: 'c11',
-                    text: '一年级1班',
-                    type: 'class',
-                    leaf: true
-                }, {
-                    id: 'c12',
-                    text: '一年级2班',
-                    type: 'class',
-                    leaf: true
-                }, {
-                    id: 'c13',
-                    text: '一年级3班',
-                    type: 'class',
-                    leaf: true
-                }, {
-                    id: 'c14',
-                    text: '一年级4班',
-                    type: 'class',
-                    leaf: true
-                }, {
-                    id: 'c15',
-                    text: '一年级5班',
-                    type: 'class',
-                    leaf: true
-                }]
-            }, {
-                id: 'g2',
-                text: '二年级',
-                type: 'grade',
-                children: [{
-                    id: 'c21',
-                    text: '二年级1班',
-                    type: 'class',
-                    leaf: true
-                }, {
-                    id: 'c22',
-                    text: '二年级2班',
-                    type: 'class',
-                    leaf: true
-                }, {
-                    id: 'c23',
-                    text: '二年级3班',
-                    type: 'class',
-                    leaf: true
-                }, {
-                    id: 'c24',
-                    text: '二年级4班',
-                    type: 'class',
-                    leaf: true
-                }]
-            }, {
-                id: 'g3',
-                text: '三年级',
-                type: 'grade',
-                children: [{
-                    id: 'c31',
-                    text: '三年级1班',
-                    type: 'class',
-                    leaf: true
-                }, {
-                    id: 'c32',
-                    text: '三年级2班',
-                    type: 'class',
-                    leaf: true
-                }, {
-                    id: 'c33',
-                    text: '三年级3班',
-                    type: 'class',
-                    leaf: true
-                }, {
-                    id: 'c34',
-                    text: '三年级4班',
-                    type: 'class',
-                    leaf: true
-                }, {
-                    id: 'c35',
-                    text: '三年级5班',
-                    type: 'class',
-                    leaf: true
-                }, {
-                    id: 'c36',
-                    text: '三年级6班',
-                    type: 'class',
-                    leaf: true
-                }]
-            }, {
-                id: 'g4',
-                text: '四年级',
-                type: 'grade',
-                children: [{
-                    id: 'c41',
-                    text: '四年级1班',
-                    type: 'class',
-                    leaf: true
-                }, {
-                    id: 'c42',
-                    text: '四年级2班',
-                    type: 'class',
-                    leaf: true
-                }, {
-                    id: 'c43',
-                    text: '四年级3班',
-                    type: 'class',
-                    leaf: true
-                }, {
-                    id: 'c44',
-                    text: '四年级4班',
-                    type: 'class',
-                    leaf: true
-                }, {
-                    id: 'c45',
-                    text: '四年级5班',
-                    type: 'class',
-                    leaf: true
-                }, {
-                    id: 'c46',
-                    text: '四年级6班',
-                    type: 'class',
-                    leaf: true
-                }]
-            }, {
-                id: 'g5',
-                text: '五年级',
-                type: 'grade',
-                children: [{
-                    id: 'c51',
-                    text: '五年级1班',
-                    type: 'class',
-                    leaf: true
-                }, {
-                    id: 'c52',
-                    text: '五年级2班',
-                    type: 'class',
-                    leaf: true
-                }, {
-                    id: 'c53',
-                    text: '五年级3班',
-                    type: 'class',
-                    leaf: true
-                }, {
-                    id: 'c54',
-                    text: '五年级4班',
-                    type: 'class',
-                    leaf: true
-                }, {
-                    id: 'c55',
-                    text: '五年级5班',
-                    type: 'class',
-                    leaf: true
-                }, {
-                    id: 'c56',
-                    text: '五年级6班',
-                    type: 'class',
-                    leaf: true
-                }]
-            }, {
-                id: 'g6',
-                text: '六年级',
-                type: 'grade',
-                children: [{
-                    id: 'c61',
-                    text: '六年级1班',
-                    type: 'class',
-                    leaf: true
-                }, {
-                    id: 'c62',
-                    text: '六年级2班',
-                    type: 'class',
-                    leaf: true
-                }, {
-                    id: 'c63',
-                    text: '六年级3班',
-                    type: 'class',
-                    leaf: true
-                }, {
-                    id: 'c64',
-                    text: '六年级4班',
-                    type: 'class',
-                    leaf: true
-                }, {
-                    id: 'c65',
-                    text: '六年级5班',
-                    type: 'class',
-                    leaf: true
-                }, {
-                    id: 'c66',
-                    text: '六年级6班',
-                    type: 'class',
-                    leaf: true
-                }, {
-                    id: 'c6y1',
-                    text: '六年级扬帆班',
-                    type: 'class',
-                    leaf: true
-                }]
-            }, {
-                id: 'gn',
-                text: '新的年级',
-                type: 'grade',
-                children: []
-            }]
         }
     }
 });