/** * 学校通知 */ Ext.define('school.view.interaction.notice.SchoolNotice', { extend: 'school.view.core.form.FormPanel', xtype: 'interaction-notice-schoolnotice', controller: 'interaction-notice-schoolnotice', // viewModel: 'purchase-purchase-formpanel', //字段属性 _title: '学校通知', _idField: 'notify_id', _codeField: null, // _readUrl: 'http://10.1.80.47:9560/notice/read', _readUrl: '/api/school/notice/read', // _saveUrl: 'http://10.1.80.47:9560/notice/save', _saveUrl: '/api/school/notice/save', _deleteUrl: '/api/school/notice/delete', initId: 0, initComponent: function () { Ext.apply(this, { defaultItems: [{ xtype: 'hidden', name: 'notify_id', fieldLabel: 'id' }, { xtype: "textfield", name: "notify_creator", fieldLabel: "发布人", columnWidth: 0.5 }, { xtype: 'combobox', name: 'notify_status', fieldLabel: '发布状态', displayField: 'name', valueField: 'value', editable: false, readOnly: true, defaultValue: 2, store: Ext.create('Ext.data.ArrayStore', { fields: ['name', 'value'], data: [['未发布', 2], ['已发布', 1]] }), minChars: 0, queryMode: 'local' }, { xtype: 'datefield', name: 'create_date', fieldLabel: '发布时间', columnWidth: 0.5, formatter: 'Y-m-d H:i:s' }, { xtype: "textfield", name: "notify_title", fieldLabel: "标题", columnWidth: 1 }, { xtype: "textareafield",//文本域 name: 'notify_details', fieldLabel: "内容", height: 300, columnWidth: 1, }, { xtype: 'textfield', name: 'fj', fieldLabel: '附件' }], toolBtns: [{ xtype: 'button', text: '发布', bind: { hidden: '{!notify_id}' }, handler: function() { let id = me.getViewModel().data.notify_id; me.setLoading(true); school.util.BaseUtil.request({ url: '/api/school/notice/publish/' + id, method: 'POST' }) .then(function() { me.setLoading(false); school.util.BaseUtil.showSuccessToast('发布成功'); me.getViewModel().set('notify_status', 1); me.clearDirty(); }) .catch(function(e) { me.setLoading(false); school.util.BaseUtil.showErrorToast('发布失败: ' + e.message); }); } }] }); this.callParent(); } });