Browse Source

成绩发布状态控制

zhuth 6 năm trước cách đây
mục cha
commit
cd563d59db

+ 31 - 0
frontend/pc-web/app/view/Interaction/score/Detail.js

@@ -44,6 +44,21 @@ Ext.define('school.view.interaction.score.Detail', {
                 xtype: 'classcombo',
                 name: 'si_class',
                 fieldLabel: '班级'
+            }, {
+                xtype: 'combobox',
+                name: 'si_publish',
+                fieldLabel: '发布状态',
+                displayField: 'name',
+                valueField: 'value',
+                editable: false,
+                readOnly: true,
+                defaultValue: 0,
+                store: Ext.create('Ext.data.ArrayStore', {
+                    fields: ['name', 'value'],
+                    data: [['未发布', 0], ['已发布', 1]]
+                }),
+                minChars: 0,
+                queryMode: 'local'
             }, {
                 name: "score",
                 xtype: "detailGridField",
@@ -71,6 +86,22 @@ Ext.define('school.view.interaction.score.Detail', {
                     dataIndex: 'sd_remark'
                 }]
             }],
+            applyBtns: [{
+                apply: true,
+                text: '删除',
+                bind: {
+                    hidden: '{!showDeleteBtn || !si_id || si_publish == 1}'
+                },
+            }],
+            toolBtns: [{
+                xtype: 'button',
+                text: '发布',
+                hidden: true,
+                bind: {
+                    hidden: '{!si_id || si_publish == 1}'
+                },
+                handler: 'onPublish'
+            }]
         });
         this.callParent();
         this.setEditable(false);

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

@@ -14,4 +14,27 @@ Ext.define('school.view.interaction.score.DetailController', {
             school.util.BaseUtil.refreshTabTitle(newId, newTitle);
         });
     },
+
+    onPublish: function() {
+        let me = this,
+        view = me.getView(),
+        viewModel = me.getViewModel(),
+        id = viewModel.data.si_id;
+        view.setLoading(true);
+        school.util.BaseUtil.request({
+            // url: 'http://10.1.80.180:9520/api/school/score/publish/' + id,
+            url: '/api/school/score/publish/' + id,
+            method: 'POST'
+        })
+        .then(function() {
+            view.setLoading(false);
+            school.util.BaseUtil.showSuccessToast('发布成功');
+            viewModel.set('si_publish', 1);
+            me.refresh();
+        })
+        .catch(function(e) {
+            view.setLoading(false);
+            school.util.BaseUtil.showErrorToast('发布失败: ' + e.message);
+        });
+    }
 });