| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576 |
- Ext.define('school.view.interaction.notice.SchoolNoticeController', {
- extend: 'school.view.core.form.FormPanelController',
- alias: 'controller.interaction-notice-schoolnotice',
- getMySaveParams: function(params) {
- return params.main;
- },
- 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.notify_title + ')';
-
- school.util.BaseUtil.refreshTabTitle(newId, newTitle);
- });
- },
- onPublish: function() {
- let me = this,
- view = me.getView(),
- viewModel = me.getViewModel(),
- id = viewModel.data.notify_id;
- view.setLoading(true);
- school.util.BaseUtil.request({
- // url: 'http://10.1.80.180:9520/api/school/notice/publish/' + id,
- url: '/api/school/notice/publish/' + id,
- method: 'POST'
- })
- .then(function() {
- view.setLoading(false);
- school.util.BaseUtil.showSuccessToast('发布成功');
- viewModel.set('notify_status', 1);
- me.refresh();
- })
- .catch(function(e) {
- view.setLoading(false);
- school.util.BaseUtil.showErrorToast('发布失败: ' + e.message);
- });
- },
- 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) {
- 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);
- classCombo.setValue(classCombo.value);
- combo.setLoading(false);
- });
- }
- }
- });
|