Browse Source

成绩发布

zhuth 6 years ago
parent
commit
ecf65c7221

+ 3 - 0
frontend/pc-web/app/store/Ethnicity.js

@@ -1,3 +1,6 @@
+/**
+ * 民族
+ */
 Ext.define('school.store.Ethnicity', {
     extend: 'Ext.data.ArrayStore',
     alias: 'store.store_ethnicity',

+ 34 - 22
frontend/pc-web/app/view/Interaction/score/Detail.js

@@ -2,43 +2,48 @@ Ext.define('school.view.interaction.score.Detail', {
     extend: 'school.view.core.form.FormPanel',
     xtype: 'interaction-score-detail',
 
-    _title: '成绩录入',
-    _idField: 'student_id',
-    _codeField: 'student_number',
+    controller: 'interaction-score-detail',
+    viewModel: 'interaction-score-detail',
 
-    // _readUrl: 'http://10.1.80.47:9560/score/read',
-    _readUrl: '/api/school/score/read',
-    // _saveUrl: 'http://10.1.80.35:8560/api/sale/saledown/update',
-    _saveUrl: '/api/sale/sss/update',
-    // _toSaleUrl: 'http://10.1.80.35:8560/api/sale/saledown/toSale',
-    _toSaleUrl: '/api/sale/sss/toSale',
-    initId: 0,
+    _title: '学生成绩',
+    _idField: 'si_id',
+    _codeField: null,
 
+    // _readUrl: 'http://10.1.80.47:9520/api/school/score/read',
+    _readUrl: '/api/school/score/read',
+    // _saveUrl: 'http://10.1.80.47:9520/api/school/score/save',
+    // _saveUrl: '/api/sale/sss/update',
+    // _deleteUrl: 'http://10.1.80.47:9520/api/school/score/delete',
+    _deleteUrl: '/api/school/score/delete',
+    
     codeInHeader: true,
 
     initComponent: function () {
         let me = this;
         Ext.apply(this, {
             defaultItems: [{
+                xtype: 'hidden',
+                name: 'si_id',
+            }, {
                 xtype: 'textfield',
-                name: 'number',
+                name: 'si_examtitle',
                 fieldLabel: '考试标题'
             }, {
                 xtype: 'textfield',
-                name: 'name',
+                name: 'si_examdate',
                 fieldLabel: '考试时间'
             }, {
                 xtype: 'textfield',
-                name: 'grade',
+                name: 'si_examscope',
                 fieldLabel: '考试范围'
             }, {
-                xtype: 'textfield',
-                name: 'class',
-                fieldLabel: '总分'
+                xtype: 'gradecombo',
+                name: 'si_grade',
+                fieldLabel: '年级'
             }, {
-                xtype: "textfield",
-                name: "jg",
-                fieldLabel: "及格分"
+                xtype: 'classcombo',
+                name: 'si_class',
+                fieldLabel: '班级'
             }, {
                 name: "score",
                 xtype: "detailGridField",
@@ -51,16 +56,23 @@ Ext.define('school.view.interaction.score.Detail', {
                 rowViewModel: {},
                 columns: [{
                     text: '学生编号',
-                    dataIndex: 'number'
+                    dataIndex: 'sd_id'
                 }, {
                     text: '姓名',
-                    dataIndex: 'name'
+                    dataIndex: 'sd_stu'
+                }, {
+                    text: '科目',
+                    dataIndex: 'sd_subject'
                 }, {
                     text: '成绩',
-                    dataIndex: 'score'
+                    dataIndex: 'sd_score'
+                }, {
+                    text: '备注',
+                    dataIndex: 'sd_remark'
                 }]
             }],
         });
         this.callParent();
+        this.setEditable(false);
     }
 });

+ 17 - 0
frontend/pc-web/app/view/Interaction/score/DetailController.js

@@ -0,0 +1,17 @@
+Ext.define('school.view.interaction.score.DetailController', {
+    extend: 'school.view.core.form.FormPanelController',
+    alias: 'controller.interaction-score-detail',
+
+    onAfterSave: function(localJson) {
+        var form = this.getView();
+        var id = localJson.data.id;
+        var code = localJson.data.code;
+        form.initId = id;
+        school.util.FormUtil.loadData(form).then(function(data) {
+            var newId = form.xtype + '-' + id;
+            var newTitle = form._title + '(' + data.main.si_id + ')';
+    
+            school.util.BaseUtil.refreshTabTitle(newId, newTitle);
+        });
+    },
+});

+ 13 - 0
frontend/pc-web/app/view/Interaction/score/DetailModel.js

@@ -0,0 +1,13 @@
+Ext.define('school.view.interaction.score.DetailModel', {
+    extend: 'school.view.core.form.FormPanelModel',
+    alias: 'viewmodel.interaction-score-detail',
+
+    data: {
+        showAddBtn: false,
+        showRefreshBtn: true,
+        showCopyBtn: false,
+        showSaveBtn: false,
+        showDeleteBtn: true,
+        showLogBtn: false
+    },
+});

+ 96 - 70
frontend/pc-web/app/view/Interaction/score/List.js

@@ -7,18 +7,17 @@ Ext.define('school.view.interaction.score.List', {
 
     controller: 'interaction-score-list',
 
-    // dataUrl: 'http://10.1.80.47:9560/score/list',
+    // dataUrl: 'http://10.1.80.47:9520/api/school/score/list',
     dataUrl: '/api/school/score/list',
+    caller: 'ScorePublish',
+    pathKey: 'score',
+
     initComponent: function () {
         var me = this;
         Ext.apply(this, {
             searchField: [{
-                xtype: 'textfield',
-                name: 'term',
-                fieldLabel: '学期'
-            }, {
                 xtype: 'gradecombo',
-                name: 'grade',
+                name: 'si_grade',
                 fieldLabel: '年级',
                 listeners: {
                     select: function (combo, record, eOpts) {
@@ -27,7 +26,7 @@ Ext.define('school.view.interaction.score.List', {
                 }
             }, {
                 xtype: 'classcombo',
-                name: 'class',
+                name: 'si_class',
                 fieldLabel: '班级',
                 listeners: {
                     expand: function (combo, eOpts) {
@@ -49,24 +48,22 @@ Ext.define('school.view.interaction.score.List', {
                         combo.up('form').getForm().findField('grade').setValue(record.get('gradeName'));
                     }
                 }
+            }, {
+                xtype: 'textfield',
+                name: 'keyword',
+                fieldLabel: '学生',
+                getCondition: function (value) {
+                    return ' (sd_stu like\'%' + value + '%\') ';
+                }
             }],
 
-            caller: null,
-            _formXtype: null,
-            _title: null,
-            _deleteUrl: null,
-            _batchOpenUrl: null,
-            _batchCloseUrl: null,
-            _batchDeleteUrl: null,
-
             gridConfig: {
                 addTitle: '成绩录入',
                 addXtype: 'interaction-score-detail',
-                idField: 'score_id',
-                codeField: 'score_num',
-                detailField: null,
+                idField: 'si_id',
+                codeField: 'si_id',
+                detailField: '',
                 dataUrl: me.dataUrl,
-                caller: null,
                 rootProperty: 'data.list',
                 totalProperty: 'data.total',
                 actionColumn: [],
@@ -82,88 +79,117 @@ Ext.define('school.view.interaction.score.List', {
                     text: '新增',
                     handler: 'onAddClick'
                 }, {
-                    xtype: 'button',
-                    text: '导入'
+                    xtype: 'importbutton',
+                    text: '导入',
+                    belong: me,
+                    caller: me.caller,
+                    pathKey: me.pathKey,
+                    onSuccess: function () {
+                        //刷新界面
+                        var g = me.down('grid');
+                        g.store.loadPage(g.store.currentPage);
+                    }
                 }, {
                     xtype: 'button',
-                    text: '删除'
+                    text: '删除',
+                    handler: function() {
+                        let grid = this.up('grid'),
+                        selectedRecords = grid.getSelection();
+                        let data;
+
+                        data = selectedRecords.map(function(r) {
+                            return {
+                                id: r.get('si_id')
+                            };
+                        });
+
+                        if(data.length == 0) {
+                            school.util.BaseUtil.showErrorToast('请先勾选需要删除的记录');
+                            return;
+                        }
+
+                        grid.setLoading(true);
+                        school.util.BaseUtil.request({
+                            // url: 'http://10.1.80.47:9520/api/school/score/batchDelete',
+                            url: '/api/school/score/batchDelete',
+                            method: 'POST',
+                            params: JSON.stringify({
+                                baseDTOs: data
+                            })
+                        }).then(function(res) {
+                            grid.setLoading(false);
+                            school.util.BaseUtil.showSuccessToast('成功删除' + data.length + '条记录');
+                            grid.store.loadPage(grid.store.currentPage);
+                        }).catch(function(e) {
+                            grid.setLoading(false);
+                            school.util.BaseUtil.showErrorToast('删除失败: ' + e.message);
+                        });
+                    }
                 }],
                 columns: [{
                     text: 'ID',
-                    dataIndex: 'score_id',
+                    dataIndex: 'si_id',
                     hidden: true
                 }, {
                     text: '考试标题',
-                    dataIndex: 'score_name'
+                    dataIndex: 'si_examtitle'
                 }, {
                     text: '考试时间',
-                    dataIndex: 'score_date',
+                    dataIndex: 'si_examdate',
                     width: 150
                 }, {
                     text: '考试范围',
-                    dataIndex: 'score_scope'
+                    dataIndex: 'si_examscope'
                 }, {
                     text: '年级',
-                    dataIndex: ''
+                    dataIndex: 'si_grade'
                 }, {
                     text: '班级',
-                    dataIndex: ''
+                    dataIndex: 'si_class'
+                }],
+                supColumns: [{
+                //     text: '学生编号',
+                //     dataIndex: ''
+                // }, {
+                    text: '学生姓名',
+                    dataIndex: 'sd_stu'
+                }, {
+                    text: '科目',
+                    dataIndex: 'sd_subject'
+                }, {
+                    text: '成绩',
+                    dataIndex: 'sd_score'
                 }]
             },
         });
         this.callParent(arguments);
     },
 
-    /**
-     * 处理部分字段值
-     */
-    getConditionValue: function (field, value) {
-        var me = this,
-            xtypes = field.getXTypes().split('/'),
-            conditionValue;
-        if (me.isContainsAny(xtypes, ['datefield'])) {
-            conditionValue = Ext.Date.format(new Date(from), 'Y-m-d H:i:s');
-        } else if (me.isContainsAny(xtypes, ['conmonthfield'])) {
-            var from = value.from,
-                to = value.to;
-
-            conditionValue = from + ',' + to;
-        } else if (me.isContainsAny(xtypes, ['condatefield'])) {
-            var from = value.from,
-                to = value.to;
+    listeners: {
+        load: function(store, grid, panel, condition) {
+            let flag = false,
+            columns = panel.gridConfig.columns;
+            Ext.Array.each(condition, function(c) {
+                if(c.type == 'condition') {
+                    flag = true;
+                }
+            });
+            if(flag) {
+                columns = columns.concat(panel.gridConfig.supColumns);
+            }
 
-            conditionValue = Ext.Date.format(new Date(from), 'Y-m-d 00:00:00') + ',' + Ext.Date.format(new Date(to), 'Y-m-d 23:59:59');
-        } else if (me.isContainsAny(xtypes, ['dbfindtrigger'])) {
-            conditionValue = value;
-        } else if (me.isContainsAny(xtypes, ['combobox', 'combo'])) {
-            conditionValue = value;
-        } else if (me.isContainsAny(xtypes, ['multicombo'])) {
-            conditionValue = value.map ? value.map(function (v) {
-                return v.value;
-            }).join(',') : '';
-        } else {
-            conditionValue = value;
+            grid.reconfigure(store, columns);
+            grid.applyScrollable(true)
         }
-
-        return conditionValue;
     },
-
+    
     getExtraParams: function (store, op, condition) {
         var temp = {};
 
         for (let x = 0; x < condition.length; x++) {
             let c = condition[x];
-            if (c.field == 'keyword') {
-                temp.keyword = c.value;
-            } else if (c.field == 'date') {
-                temp.fromDate = new Date(c.value.split(',')[0]).getTime();
-                temp.endDate = new Date(c.value.split(',')[1]).getTime();
-            } else if (c.field == 'quoted') {
-                temp.quoted = c.value == 'all' ? null : c.value;
-            } else if (c.field == 'closed') {
-                // temp.endDate = c.value == 'all' ? null : (
-                //     c.value == '0' ? 
-                // );
+            if (c.type == 'condition') {
+                temp.mode = 'DETAIL';
             }
         }
         let obj = {

+ 1 - 1
frontend/pc-web/app/view/basic/staff/StaffList.js

@@ -51,7 +51,7 @@ Ext.define('school.view.basic.staff.StaffList', {
                     xtype: 'importbutton',
                     text: '导入',
                     belong: me,
-                    caller: 'ScorePublish',
+                    caller: me.caller,
                     pathKey: me.pathKey,
                     onSuccess: function () {
                         //刷新界面

+ 8 - 0
frontend/pc-web/app/view/core/base/GridPanel.js

@@ -81,6 +81,14 @@ Ext.define('school.view.core.base.GridPanel', {
                         var obj = basePanel.getExtraParams(store, op, condition);
                         var defaultObj = basePanel.getDefaultExtraParams(store, op, condition);
                         Ext.apply(store.proxy.extraParams, obj, defaultObj);
+                    },
+                    load: function(store, records, successful, operation, eOpts) {
+                        var basePanel = me.up('core-base-basepanel');
+                        var condition = basePanel.getConditions();
+                        if (Ext.isEmpty(condition)) {
+                            condition = "";
+                        }
+                        basePanel.fireEvent('load', store, me, basePanel, condition);
                     }
                 }
             });

+ 1 - 1
frontend/pc-web/app/view/core/button/import/Window.js

@@ -84,7 +84,7 @@ Ext.define('school.view.core.button.import.Window', {
             if (id) {
                 form.setLoading(true);
                 Ext.Ajax.request({
-                    // url: 'http://10.1.80.47:9560/' + win.pathKey + '/saveToFormal', //这里是填写需要跨域访问的URL
+                    // url: 'http://10.1.80.47:9520/api/school/' + win.pathKey + '/saveToFormal', //这里是填写需要跨域访问的URL
                     url: '/api/school/' + win.pathKey + '/saveToFormal', //这里是填写需要跨域访问的URL
                     method: 'post',
                     headers: {

+ 2 - 1
frontend/pc-web/app/view/viewport/ViewportController.js

@@ -45,10 +45,11 @@ Ext.define('school.view.viewport.ViewportController', {
 
     showMain: function() {
         var me = this;
+        var schoolId = school.util.BaseUtil.getCurrentUser().school_id;
         //读取学校
         school.util.BaseUtil.request({
             // url:'http://10.1.80.35:9560/school/read/1'
-            url:'/api/school/school/read/1'
+            url:'/api/school/school/read/' + schoolId
         })
         .then(function(res) {
             if(res.success) {

BIN
frontend/pc-web/resources/images/auth-background.jpg


BIN
frontend/pc-web/resources/images/标题.png