StudentList.js 5.8 KB

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