List.js 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  1. /**
  2. * 课程表
  3. */
  4. Ext.define('school.view.interact.timetable.List', {
  5. extend: 'school.view.core.base.BasePanel',
  6. xtype: 'interact-timetable-list',
  7. controller: 'interact-timetable-list',
  8. dataUrl: '/api/interact/timetable/list',
  9. initComponent: function() {
  10. var me = this;
  11. Ext.apply(this, {
  12. searchField: [{
  13. xtype: 'textfield',
  14. name: 'term',
  15. fieldLabel: '学期'
  16. }, {
  17. xtype: 'textfield',
  18. name: 'grade',
  19. fieldLabel: '年级'
  20. }, {
  21. xtype: 'textfield',
  22. name: 'class',
  23. fieldLabel: '班级'
  24. }],
  25. caller: null,
  26. _formXtype: null,
  27. _title: null,
  28. _deleteUrl: null,
  29. _batchOpenUrl: null,
  30. _batchCloseUrl: null,
  31. _batchDeleteUrl: null,
  32. gridConfig: {
  33. idField: null,
  34. codeField: null,
  35. statusCodeField: null,
  36. dataUrl: me.dataUrl,
  37. caller: null,
  38. rootProperty: 'data.list',
  39. totalProperty: 'data.total',
  40. actionColumn: [],
  41. selModel: {
  42. checkOnly:true,
  43. type:'checkboxmodel',
  44. mode : "MULTI" ,
  45. ignoreRightMouseSelection : false
  46. },
  47. hiddenTools: false,
  48. toolBtns: [{
  49. xtype: 'button',
  50. text: '下载模板'
  51. }, {
  52. xtype: 'button',
  53. text: '上传课表'
  54. }, {
  55. xtype: 'button',
  56. text: '添加',
  57. handler: 'onAddClick'
  58. }, {
  59. xtype: 'button',
  60. text: '删除'
  61. }],
  62. columns : [{
  63. text: '编号',
  64. dataIndex: 'code',
  65. width: 150
  66. }, {
  67. text: '学期',
  68. dataIndex: 'name',
  69. width: 120
  70. }, {
  71. text: '性别',
  72. dataIndex: 'gender',
  73. width: 120
  74. }, {
  75. text: '年级',
  76. dataIndex: 'grade'
  77. }, {
  78. text: '班级',
  79. dataIndex: 'class'
  80. }, {
  81. text: '出生日期',
  82. dataIndex: 'birth',
  83. width: 120
  84. }, {
  85. text: '年龄',
  86. dataIndex: 'open'
  87. }, {
  88. text: '状态',
  89. dataIndex: 'status'
  90. }],
  91. listeners: {
  92. itemclick: function(view, record, item, index, e, eOpts) {
  93. school.util.BaseUtil.openTab('interact-timetable-detail', '课程表', 'interact-timetable-detail'+record.get('id'), {
  94. initId: record.get('id')
  95. });
  96. }
  97. }
  98. },
  99. });
  100. this.callParent(arguments);
  101. },
  102. /**
  103. * 处理部分字段值
  104. */
  105. getConditionValue: function (field, value) {
  106. var me = this,
  107. xtypes = field.getXTypes().split('/'),
  108. conditionValue;
  109. if (me.isContainsAny(xtypes, ['datefield'])) {
  110. conditionValue = Ext.Date.format(new Date(from), 'Y-m-d H:i:s');
  111. } else if (me.isContainsAny(xtypes, ['conmonthfield'])) {
  112. var from = value.from,
  113. to = value.to;
  114. conditionValue = from + ',' + to;
  115. } else if (me.isContainsAny(xtypes, ['condatefield'])) {
  116. var from = value.from,
  117. to = value.to;
  118. conditionValue = Ext.Date.format(new Date(from), 'Y-m-d 00:00:00') + ',' + Ext.Date.format(new Date(to), 'Y-m-d 23:59:59');
  119. } else if (me.isContainsAny(xtypes, ['dbfindtrigger'])) {
  120. conditionValue = value;
  121. } else if (me.isContainsAny(xtypes, ['combobox', 'combo'])) {
  122. conditionValue = value;
  123. } else if (me.isContainsAny(xtypes, ['multicombo'])) {
  124. conditionValue = value.map ? value.map(function (v) {
  125. return v.value;
  126. }).join(',') : '';
  127. } else {
  128. conditionValue = value;
  129. }
  130. return conditionValue;
  131. },
  132. getExtraParams: function(store, op, condition) {
  133. var temp = {};
  134. for(let x = 0; x < condition.length; x++) {
  135. let c = condition[x];
  136. if(c.field == 'keyword') {
  137. temp.keyword = c.value;
  138. }else if(c.field == 'date') {
  139. temp.fromDate = new Date(c.value.split(',')[0]).getTime();
  140. temp.endDate = new Date(c.value.split(',')[1]).getTime();
  141. }else if(c.field == 'quoted') {
  142. temp.quoted = c.value == 'all' ? null : c.value;
  143. }else if(c.field == 'closed') {
  144. // temp.endDate = c.value == 'all' ? null : (
  145. // c.value == '0' ?
  146. // );
  147. }
  148. }
  149. let obj = {
  150. pageNumber: store.exportNumber?store.exportNumber:op._page,
  151. pageSize: store.exportPageSize?store.exportPageSize:store.pageSize
  152. };
  153. for(let k in temp) {
  154. if(!!temp[k]) {
  155. obj[k] = temp[k];
  156. }
  157. }
  158. return obj;
  159. },
  160. });