Detail.js 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213
  1. Ext.define('school.view.interact.timetable.Detail', {
  2. extend: 'school.view.core.form.FormPanel',
  3. xtype: 'interact-timetable-detail',
  4. _title: '学生信息',
  5. _idField: 'student_id',
  6. _codeField: 'student_number',
  7. _statusField: null,
  8. _statusCodeField: null,
  9. _auditmanField: null,
  10. _auditdateField: null,
  11. // _readUrl: 'http://10.1.80.35:8560/api/sale/saledown/read',
  12. _readUrl: '/api/sale/xxxx/read',
  13. // _saveUrl: 'http://10.1.80.35:8560/api/sale/saledown/update',
  14. _saveUrl: '/api/sale/sss/update',
  15. // _toSaleUrl: 'http://10.1.80.35:8560/api/sale/saledown/toSale',
  16. _toSaleUrl: '/api/sale/sss/toSale',
  17. initId: 0,
  18. cls: 'timetable',
  19. codeInHeader: true,
  20. START_TIME: Ext.Date.parse('08:00', 'H:i'), // 开始上课时间
  21. END_TIME: Ext.Date.parse('22:00', 'H:i'), // 结束上课时间
  22. MIN_WHILE: 10, // 一节课最小时间(分钟)
  23. initComponent: function () {
  24. let me = this;
  25. Ext.apply(this, {
  26. defaultItems: [{
  27. xtype: 'textfield',
  28. name: 'number',
  29. fieldLabel: '录入人'
  30. }, {
  31. xtype: 'textfield',
  32. name: 'name',
  33. fieldLabel: '录入时间'
  34. }, {
  35. xtype: 'textfield',
  36. name: 'grade',
  37. fieldLabel: '状态'
  38. }, {
  39. xtype: 'textfield',
  40. name: 'class',
  41. fieldLabel: '课表编号'
  42. }, {
  43. xtype: "textfield",
  44. name: "jg",
  45. fieldLabel: "学期名称"
  46. }, {
  47. xtype: 'textfield',
  48. name: 'mz',
  49. fieldLabel: '课表名称'
  50. }, {
  51. xtype: 'textfield',
  52. name: 'birth',
  53. fieldLabel: '课表班级'
  54. }, {
  55. xtype: "textfield",
  56. name: "address",
  57. fieldLabel: "学期开始时间"
  58. }, {
  59. xtype: 'textfield',
  60. name: 'teacher_zz',
  61. fieldLabel: '学期结束时间'
  62. }, {
  63. xtype: 'textfield',
  64. name: 'zs',
  65. fieldLabel: '周数'
  66. }, {
  67. name: "timetable",
  68. xtype: "detailGridField",
  69. detnoColumn: 'no',
  70. storeModel: 'school.model.Timetable',
  71. deleteDetailUrl: '/api/sale/sale/deleteDetail',
  72. allowEmpty: true,
  73. showCount: false,
  74. emptyRows: 10,
  75. rowViewModel: {},
  76. columns: [{
  77. text: '时间段',
  78. xtype: 'widgetcolumn',
  79. width: 200,
  80. padding: 0,
  81. tdCls: 'x-period-column',
  82. getBindField: function(c) {
  83. return ['period0', 'period1']
  84. },
  85. widget: {
  86. xtype: 'container',
  87. style: {
  88. textAlign: 'center'
  89. },
  90. items: [{
  91. xtype: 'button',
  92. text: '0:00',
  93. bind: {
  94. text: '{record.periodText0}',
  95. },
  96. style: {
  97. margin: '5px',
  98. height: '22px',
  99. width: '74px',
  100. padding: 0
  101. },
  102. handler: function(btn) {
  103. me.currentRecord = btn.ownerCt.$widgetRecord;
  104. },
  105. menu: {
  106. xtype: 'menu',
  107. plain: true,
  108. items: [{
  109. xtype: 'timepicker',
  110. maxHeight: 300,
  111. increment: 5,
  112. format: 'H:i',
  113. minValue: Ext.Date.parse('08:00', 'H:i'),
  114. maxValue: Ext.Date.parse('22:00', 'H:i'),
  115. listeners: {
  116. select: function(model, record, index, eOpts) {
  117. me.onSelectPeriod0(this, this.up(), record);
  118. },
  119. }
  120. }]
  121. },
  122. }, {
  123. xtype: 'button',
  124. text: '0:00',
  125. bind: {
  126. text: '{record.periodText1}',
  127. },
  128. style: {
  129. margin: '5px',
  130. height: '22px',
  131. width: '74px',
  132. padding: 0
  133. },
  134. menu: {
  135. xtype: 'menu',
  136. plain: true,
  137. items: [{
  138. xtype: 'timepicker',
  139. maxHeight: 300,
  140. increment: 10,
  141. format: 'H:i',
  142. minValue: Ext.Date.parse('08:00', 'H:i'),
  143. maxValue: Ext.Date.parse('22:00', 'H:i'),
  144. listeners: {
  145. select: function(model, record, index, eOpts) {
  146. me.onSelectPeriod1(this, this.up(), record);
  147. },
  148. }
  149. }],
  150. listeners: {
  151. beforeshow: function(th, eOpts) {
  152. me.currentRecord = th.ownerCmp.ownerCt.$widgetRecord;
  153. let picker = th.down('timepicker');
  154. let startDate = me.currentRecord.get('period0') || Ext.Date.parse('08:00', 'H:i');
  155. let minValue = Ext.Date.add(startDate, Ext.Date.MINUTE, me.MIN_WHILE);
  156. picker.setMinValue(minValue)
  157. },
  158. }
  159. },
  160. }]
  161. }
  162. }, {
  163. text: '星期一',
  164. dataIndex: 'monday',
  165. xtype: 'subjectcolumn'
  166. }, {
  167. text: '星期二',
  168. dataIndex: 'tuesday',
  169. xtype: 'subjectcolumn'
  170. }, {
  171. text: '星期三',
  172. dataIndex: 'wednesday',
  173. xtype: 'subjectcolumn'
  174. }, {
  175. text: '星期四',
  176. dataIndex: 'thursday',
  177. xtype: 'subjectcolumn'
  178. }, {
  179. text: '星期五',
  180. dataIndex: 'friday',
  181. xtype: 'subjectcolumn'
  182. }, {
  183. text: '星期六',
  184. dataIndex: 'saturday',
  185. xtype: 'subjectcolumn'
  186. }, {
  187. text: '星期日',
  188. dataIndex: 'sunday',
  189. xtype: 'subjectcolumn'
  190. }]
  191. }],
  192. });
  193. this.callParent();
  194. },
  195. onSelectPeriod0: function(picker, menu, record) {
  196. let me = this;
  197. me.currentRecord.set('period0', record.get('date'));
  198. menu.setVisible(false);
  199. },
  200. onSelectPeriod1: function(picker, menu, record) {
  201. let me = this;
  202. me.currentRecord.set('period1', record.get('date'));
  203. menu.setVisible(false);
  204. let classTime = Math.abs(Ext.Date.diff(me.currentRecord.get('period0'), record.get('date'), Ext.Date.MINUTE));
  205. me.CLASS_TIME = classTime;
  206. }
  207. });