List.js 5.5 KB

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