/** * 作业发布 */ Ext.define('school.view.interaction.homework.Release', { extend: 'school.view.core.form.FormPanel', xtype: 'interaction-homework-release', controller: 'interaction-homework-release', // viewModel: 'purchase-purchase-formpanel', //字段属性 _title: '作业发布', _idField: 'task_id', _codeField: null, // _readUrl: 'http://10.1.80.47:9560/homework/read', _readUrl: '/api/school/homework/read', // _saveUrl: 'http://10.1.80.47:9560/homework/save', _saveUrl: '/api/school/homework/save', _deleteUrl: '/api/school/homework/delete', initId: 0, initComponent: function () { Ext.apply(this, { defaultItems: [{ xtype: 'hidden', name: 'task_id', fieldLabel: 'id' }, { xtype: "textfield", name: "task_creator", fieldLabel: "发布人", columnWidth: 0.5 }, { xtype: 'textfield', name: 'njid', fieldLabel: '年级id', hidden: true }, { xtype: 'textfield', name: 'nj', fieldLabel: '年级' }, { xtype: 'textfield', name: 'bjid', fieldLabel: '班级id', hidden: true }, { xtype: 'textfield', name: 'bj', fieldLabel: '班级' }, { xtype: 'datefield', name: 'start_date', fieldLabel: '开始时间', columnWidth: 0.5, defaultValue: new Date() }, { xtype: 'datefield', name: 'end_date', fieldLabel: '截止时间', columnWidth: 0.5 }, { xtype: "textfield", name: "task_title", fieldLabel: "标题", columnWidth: 1 }, { xtype: "textareafield", name: 'task_context', fieldLabel: "内容", columnWidth: 1, height: 250 }, { xtype: 'textfield', name: 'fj', fieldLabel: '附件' }], toolBtns: [{ xtype: 'button', text: '发布', bind: { hidden: '{!task_id}' }, handler: function() { let id = me.getViewModel().data.task_id; me.setLoading(true); school.util.BaseUtil.request({ url: '/api/school/homework/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(); } });