Ext.define('school.view.interact.timetable.Detail', { extend: 'school.view.core.form.FormPanel', xtype: 'interact-timetable-detail', _title: '学生信息', _idField: 'student_id', _codeField: 'student_number', _statusField: null, _statusCodeField: null, _auditmanField: null, _auditdateField: null, // _readUrl: 'http://10.1.80.35:8560/api/sale/saledown/read', _readUrl: '/api/sale/xxxx/read', // _saveUrl: 'http://10.1.80.35:8560/api/sale/saledown/update', _saveUrl: '/api/sale/sss/update', // _toSaleUrl: 'http://10.1.80.35:8560/api/sale/saledown/toSale', _toSaleUrl: '/api/sale/sss/toSale', initId: 0, cls: 'timetable', codeInHeader: true, START_TIME: Ext.Date.parse('08:00', 'H:i'), // 开始上课时间 END_TIME: Ext.Date.parse('22:00', 'H:i'), // 结束上课时间 MIN_WHILE: 10, // 一节课最小时间(分钟) initComponent: function () { let me = this; Ext.apply(this, { defaultItems: [{ xtype: 'textfield', name: 'number', fieldLabel: '录入人' }, { xtype: 'textfield', name: 'name', fieldLabel: '录入时间' }, { xtype: 'textfield', name: 'grade', fieldLabel: '状态' }, { xtype: 'textfield', name: 'class', fieldLabel: '课表编号' }, { xtype: "textfield", name: "jg", fieldLabel: "学期名称" }, { xtype: 'textfield', name: 'mz', fieldLabel: '课表名称' }, { xtype: 'textfield', name: 'birth', fieldLabel: '课表班级' }, { xtype: "textfield", name: "address", fieldLabel: "学期开始时间" }, { xtype: 'textfield', name: 'teacher_zz', fieldLabel: '学期结束时间' }, { xtype: 'textfield', name: 'zs', fieldLabel: '周数' }, { name: "timetable", xtype: "detailGridField", detnoColumn: 'no', storeModel: 'school.model.Timetable', deleteDetailUrl: '/api/sale/sale/deleteDetail', allowEmpty: true, showCount: false, emptyRows: 10, rowViewModel: {}, columns: [{ text: '时间段', xtype: 'widgetcolumn', width: 200, padding: 0, tdCls: 'x-period-column', getBindField: function(c) { return ['period0', 'period1'] }, widget: { xtype: 'container', style: { textAlign: 'center' }, items: [{ xtype: 'button', text: '0:00', bind: { text: '{record.periodText0}', }, style: { margin: '5px', height: '22px', width: '74px', padding: 0 }, handler: function(btn) { me.currentRecord = btn.ownerCt.$widgetRecord; }, menu: { xtype: 'menu', plain: true, items: [{ xtype: 'timepicker', maxHeight: 300, increment: 5, format: 'H:i', minValue: Ext.Date.parse('08:00', 'H:i'), maxValue: Ext.Date.parse('22:00', 'H:i'), listeners: { select: function(model, record, index, eOpts) { me.onSelectPeriod0(this, this.up(), record); }, } }] }, }, { xtype: 'button', text: '0:00', bind: { text: '{record.periodText1}', }, style: { margin: '5px', height: '22px', width: '74px', padding: 0 }, menu: { xtype: 'menu', plain: true, items: [{ xtype: 'timepicker', maxHeight: 300, increment: 10, format: 'H:i', minValue: Ext.Date.parse('08:00', 'H:i'), maxValue: Ext.Date.parse('22:00', 'H:i'), listeners: { select: function(model, record, index, eOpts) { me.onSelectPeriod1(this, this.up(), record); }, } }], listeners: { beforeshow: function(th, eOpts) { me.currentRecord = th.ownerCmp.ownerCt.$widgetRecord; let picker = th.down('timepicker'); let startDate = me.currentRecord.get('period0') || Ext.Date.parse('08:00', 'H:i'); let minValue = Ext.Date.add(startDate, Ext.Date.MINUTE, me.MIN_WHILE); picker.setMinValue(minValue) }, } }, }] } }, { text: '星期一', dataIndex: 'monday', xtype: 'subjectcolumn' }, { text: '星期二', dataIndex: 'tuesday', xtype: 'subjectcolumn' }, { text: '星期三', dataIndex: 'wednesday', xtype: 'subjectcolumn' }, { text: '星期四', dataIndex: 'thursday', xtype: 'subjectcolumn' }, { text: '星期五', dataIndex: 'friday', xtype: 'subjectcolumn' }, { text: '星期六', dataIndex: 'saturday', xtype: 'subjectcolumn' }, { text: '星期日', dataIndex: 'sunday', xtype: 'subjectcolumn' }] }], }); this.callParent(); }, onSelectPeriod0: function(picker, menu, record) { let me = this; me.currentRecord.set('period0', record.get('date')); menu.setVisible(false); }, onSelectPeriod1: function(picker, menu, record) { let me = this; me.currentRecord.set('period1', record.get('date')); menu.setVisible(false); let classTime = Math.abs(Ext.Date.diff(me.currentRecord.get('period0'), record.get('date'), Ext.Date.MINUTE)); me.CLASS_TIME = classTime; } });