Pārlūkot izejas kodu

学校通知添加通知对象字段

zhuth 6 gadi atpakaļ
vecāks
revīzija
311ed5278a

+ 20 - 2
frontend/pc-web/app/view/Interaction/notice/SchoolNotice.js

@@ -35,7 +35,7 @@ Ext.define('school.view.interaction.notice.SchoolNotice', {
                 xtype: "textfield",
                 name: "creator",
                 fieldLabel: "发布人",
-                columnWidth: 0.5,
+                columnWidth: 0.25,
                 defaultValue: school.util.BaseUtil.getCurrentUser().username,
                 readOnly: true
             }, {
@@ -57,9 +57,27 @@ Ext.define('school.view.interaction.notice.SchoolNotice', {
                 xtype: 'datefield',
                 name: 'publish_date',
                 fieldLabel: '发布时间',
-                readOnly: true,
                 format: 'Y-m-d H:i:s',
                 readOnly: true
+            }, {
+                xtype: 'combobox',
+                fieldLabel: '通知对象',
+                name: 'notify_class',
+                displayField: 'name',
+                valueField: 'value',
+                editable: false,
+                clearable: false,
+                store: Ext.create('Ext.data.Store', {
+                    fields: ['name', 'value'],
+                    data: [{ name: '全体教师', value: -1 }, { name: '全体家长', value: -2 }]
+                }),
+                defaultValue: -2,
+                minChars: 0,
+                queryMode: 'local',
+                allowBlank: false,
+                listeners: {
+                    expand: 'onNotifyClassComboExpand'
+                }
             }, {
                 xtype: "textfield",
                 name: "notify_title",

+ 16 - 0
frontend/pc-web/app/view/Interaction/notice/SchoolNoticeController.js

@@ -40,5 +40,21 @@ Ext.define('school.view.interaction.notice.SchoolNoticeController', {
             view.setLoading(false);
             school.util.BaseUtil.showErrorToast('发布失败: ' + e.message);
         });
+    },
+
+    onNotifyClassComboExpand: function(combo) {
+        var classStore = Ext.StoreMgr.get('store_class');
+        if(classStore.getCount() === 0 || combo.store.getCount() === 2) {
+            combo.setLoading(true);
+            classStore.load(function(records) {
+                var classData = records.map(function(record) {
+                    var name = record.get('clazz_grade') + ' | '+ record.get('clazz_name');
+                    var value = record.get('clazz_id');
+                    return {name: name, value: value};
+                });
+                combo.store.insert(2, classData);
+                combo.setLoading(false);
+            });
+        }
     }
 });