|
|
@@ -16,10 +16,16 @@ Ext.define('school.view.interact.timetable.Detail', {
|
|
|
// _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',
|
|
|
@@ -65,34 +71,143 @@ Ext.define('school.view.interact.timetable.Detail', {
|
|
|
name: "timetable",
|
|
|
xtype: "detailGridField",
|
|
|
detnoColumn: 'no',
|
|
|
- storeModel: 'school.model.basic.Student',
|
|
|
+ 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'
|
|
|
+ dataIndex: 'monday',
|
|
|
+ xtype: 'subjectcolumn'
|
|
|
}, {
|
|
|
text: '星期二',
|
|
|
- dataIndex: 'tuesday'
|
|
|
+ dataIndex: 'tuesday',
|
|
|
+ xtype: 'subjectcolumn'
|
|
|
}, {
|
|
|
text: '星期三',
|
|
|
dataIndex: 'wednesday',
|
|
|
+ xtype: 'subjectcolumn'
|
|
|
}, {
|
|
|
text: '星期四',
|
|
|
- dataIndex: 'thursday'
|
|
|
+ dataIndex: 'thursday',
|
|
|
+ xtype: 'subjectcolumn'
|
|
|
}, {
|
|
|
text: '星期五',
|
|
|
- dataIndex: 'friday'
|
|
|
+ dataIndex: 'friday',
|
|
|
+ xtype: 'subjectcolumn'
|
|
|
}, {
|
|
|
text: '星期六',
|
|
|
- dataIndex: 'saturday'
|
|
|
+ dataIndex: 'saturday',
|
|
|
+ xtype: 'subjectcolumn'
|
|
|
}, {
|
|
|
text: '星期日',
|
|
|
- dataIndex: 'sunday'
|
|
|
+ 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;
|
|
|
+ }
|
|
|
});
|