Sfoglia il codice sorgente

学校通知通知对象字段请求下拉数据逻辑调整

zhuth 6 anni fa
parent
commit
b0320e930d

+ 1 - 0
frontend/pc-web/app/view/Interaction/notice/SchoolNotice.js

@@ -76,6 +76,7 @@ Ext.define('school.view.interaction.notice.SchoolNotice', {
                 queryMode: 'local',
                 allowBlank: false,
                 listeners: {
+                    boxready: 'onNotifyClassComboReady',
                     expand: 'onNotifyClassComboExpand'
                 }
             }, {

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

@@ -42,6 +42,21 @@ Ext.define('school.view.interaction.notice.SchoolNoticeController', {
         });
     },
 
+    onNotifyClassComboReady: function(classCombo) {
+        var classStore = Ext.StoreMgr.get('store_class');
+        if(classStore.getCount() === 0 || classCombo.store.getCount() === 2) {
+            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};
+                });
+                classCombo.store.insert(2, classData);
+                classCombo.setValue(classCombo.value); // 重新触发一次setValue以正确显示值
+            });
+        }
+    },
+
     onNotifyClassComboExpand: function(combo) {
         var classStore = Ext.StoreMgr.get('store_class');
         if(classStore.getCount() === 0 || combo.store.getCount() === 2) {
@@ -53,6 +68,7 @@ Ext.define('school.view.interaction.notice.SchoolNoticeController', {
                     return {name: name, value: value};
                 });
                 combo.store.insert(2, classData);
+                classCombo.setValue(classCombo.value);
                 combo.setLoading(false);
             });
         }