| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227 |
- Ext.define('school.view.interaction.timetable.Detail', {
- extend: 'school.view.core.form.FormPanel',
- xtype: 'interaction-timetable-detail',
- controller: 'interaction-timetable-detail',
- _title: '课程表',
- _idField: 'id',
- _codeField: null,
- // _readUrl: 'http://10.1.80.35:8560/api/sale/saledown/read',
- _readUrl: '/api/school/curriculum/read',
- // _saveUrl: 'http://10.1.80.36:9520/api/school/curriculum/save',
- _saveUrl: '/api/school/curriculum/save',
- _deleteUrl: '/api/school/curriculum/delete',
- initId: 0,
- cls: 'timetable',
- 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: 'hidden',
- name: 'id',
- fieldLabel: 'id'
- }, {
- xtype: 'numberfield',
- name: 'gradeId',
- fieldLabel: '年级(id)',
- allowBlank: false
- }, {
- xtype: 'numberfield',
- name: 'clazzId',
- fieldLabel: '班级(id)',
- allowBlank: false
- }, {
- xtype: 'textfield',
- name: 'creatorName',
- fieldLabel: '录入人'
- }, {
- xtype: 'datefield',
- name: 'createTime',
- fieldLabel: '录入时间',
- format: 'Y-m-d H:i:s'
- }, {
- xtype: 'textfield',
- name: 'status',
- fieldLabel: '状态'
- }, {
- xtype: 'textfield',
- name: 'code',
- fieldLabel: '课表编号'
- }, {
- xtype: "textfield",
- name: "termName",
- fieldLabel: "学期名称"
- }, {
- xtype: 'textfield',
- name: 'name',
- fieldLabel: '课表名称'
- }, {
- xtype: "datefield",
- name: "termStart",
- fieldLabel: "学期开始时间",
- format: 'Y-m-d'
- }, {
- xtype: 'datefield',
- name: 'termEnd',
- fieldLabel: '学期结束时间',
- format: 'Y-m-d'
- }, {
- xtype: 'numberfield',
- name: 'weekNum',
- fieldLabel: '周数'
- }, {
- name: "timetable",
- xtype: "detailGridField",
- idColumn: 'id',
- detnoColumn: 'lessons',
- storeModel: 'school.model.Timetable',
- deleteDetailUrl: '/api/school/curriculum/deleteDetail',
- allowEmpty: true,
- showCount: false,
- emptyRows: 10,
- rowViewModel: {},
- columns: [{
- text: 'id',
- dataIndex: 'id',
- hidden: true
- }, {
- text: '时间段',
- xtype: 'widgetcolumn',
- width: 200,
- padding: 0,
- tdCls: 'x-period-column',
- getBindField: function(c) {
- return ['startTime', 'endTime']
- },
- widget: {
- xtype: 'container',
- style: {
- textAlign: 'center'
- },
- items: [{
- xtype: 'button',
- text: '0:00',
- bind: {
- text: '{record._timeText1}',
- },
- 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._timeText2}',
- },
- 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('_time1') || Ext.Date.parse('08:00', 'H:i');
- let minValue = Ext.Date.add(startDate, Ext.Date.MINUTE, me.MIN_WHILE);
- picker.setMinValue(minValue)
- },
- }
- },
- }]
- }
- }, {
- text: '星期一',
- dataIndex: 'mon',
- xtype: 'subjectcolumn'
- }, {
- text: '星期二',
- dataIndex: 'tues',
- xtype: 'subjectcolumn'
- }, {
- text: '星期三',
- dataIndex: 'wed',
- xtype: 'subjectcolumn'
- }, {
- text: '星期四',
- dataIndex: 'thur',
- xtype: 'subjectcolumn'
- }, {
- text: '星期五',
- dataIndex: 'fri',
- xtype: 'subjectcolumn'
- }, {
- text: '星期六',
- dataIndex: 'sat',
- xtype: 'subjectcolumn'
- }, {
- text: '星期日',
- dataIndex: 'sunday',
- xtype: 'subjectcolumn'
- }]
- }],
- });
- this.callParent();
- },
- onSelectPeriod0: function(picker, menu, record) {
- let me = this;
- me.currentRecord.set('startTime', Ext.Date.format(record.get('date'), 'H:i:s'));
- menu.setVisible(false);
- },
- onSelectPeriod1: function(picker, menu, record) {
- let me = this;
- me.currentRecord.set('endTime', Ext.Date.format(record.get('date'), 'H:i:s'));
- menu.setVisible(false);
- let classTime = Math.abs(Ext.Date.diff(me.currentRecord.get('_time1'), record.get('date'), Ext.Date.MINUTE));
- me.CLASS_TIME = classTime;
- }
- });
|