StudentList.js 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201
  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: '/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. handler: function() {
  68. school.util.BaseUtil.openTab('basic-student-studentdetail', '新增学生信息', 'basic-student-studentdetail-add');
  69. }
  70. }, {
  71. xtype: 'button',
  72. text: '删除'
  73. }],
  74. columns : [{
  75. text: 'id',
  76. dataIndex: 'stu_id',
  77. hidden: true
  78. }, {
  79. text: '学号',
  80. dataIndex: 'stu_number',
  81. width: 150
  82. }, {
  83. text: '学生姓名',
  84. dataIndex: 'stu_number',
  85. width: 120
  86. }, {
  87. text: '性别',
  88. dataIndex: 'stu_sex',
  89. width: 120,
  90. renderer: function(v, m, r) {
  91. return v == 1 ? '男' : (v == 0 ? '女' : '未知');
  92. }
  93. }, {
  94. text: '年级',
  95. dataIndex: 'grade'
  96. }, {
  97. text: '班级',
  98. dataIndex: 'class'
  99. }, {
  100. text: '出生日期',
  101. dataIndex: 'stu_birthday',
  102. width: 120,
  103. xtype: 'datecolumn',
  104. format: 'Y-m-d'
  105. }, {
  106. text: '年龄',
  107. dataIndex: 'stu_age'
  108. }, {
  109. text: '入学日期',
  110. dataIndex: 'stu_enroll_date',
  111. xtype: 'datecolumn',
  112. format: 'Y-m-d'
  113. }, {
  114. text: '毕业日期',
  115. dataIndex: 'stu_graduate_date',
  116. xtype: 'datecolumn',
  117. format: 'Y-m-d'
  118. }, {
  119. text: '状态',
  120. dataIndex: 'stu_status'
  121. }],
  122. listeners: {
  123. itemclick: function(view, record, item, index, e, eOpts) {
  124. let number = record.get('stu_number');
  125. school.util.BaseUtil.openTab('basic-student-studentdetail', '学生信息' + '(' + number + ')', 'basic-student-studentdetail'+record.get('stu_id'), {
  126. initId: record.get('stu_id')
  127. });
  128. }
  129. }
  130. },
  131. });
  132. this.callParent(arguments);
  133. },
  134. /**
  135. * 处理部分字段值
  136. */
  137. getConditionValue: function (field, value) {
  138. var me = this,
  139. xtypes = field.getXTypes().split('/'),
  140. conditionValue;
  141. if (me.isContainsAny(xtypes, ['datefield'])) {
  142. conditionValue = Ext.Date.format(new Date(from), 'Y-m-d H:i:s');
  143. } else if (me.isContainsAny(xtypes, ['conmonthfield'])) {
  144. var from = value.from,
  145. to = value.to;
  146. conditionValue = from + ',' + to;
  147. } else if (me.isContainsAny(xtypes, ['condatefield'])) {
  148. var from = value.from,
  149. to = value.to;
  150. 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');
  151. } else if (me.isContainsAny(xtypes, ['dbfindtrigger'])) {
  152. conditionValue = value;
  153. } else if (me.isContainsAny(xtypes, ['combobox', 'combo'])) {
  154. conditionValue = value;
  155. } else if (me.isContainsAny(xtypes, ['multicombo'])) {
  156. conditionValue = value.map ? value.map(function (v) {
  157. return v.value;
  158. }).join(',') : '';
  159. } else {
  160. conditionValue = value;
  161. }
  162. return conditionValue;
  163. },
  164. getExtraParams: function(store, op, condition) {
  165. var temp = {};
  166. for(let x = 0; x < condition.length; x++) {
  167. let c = condition[x];
  168. if(c.field == 'keyword') {
  169. temp.keyword = c.value;
  170. }else if(c.field == 'date') {
  171. temp.fromDate = new Date(c.value.split(',')[0]).getTime();
  172. temp.endDate = new Date(c.value.split(',')[1]).getTime();
  173. }else if(c.field == 'quoted') {
  174. temp.quoted = c.value == 'all' ? null : c.value;
  175. }else if(c.field == 'closed') {
  176. // temp.endDate = c.value == 'all' ? null : (
  177. // c.value == '0' ?
  178. // );
  179. }
  180. }
  181. let obj = {
  182. pageNumber: store.exportNumber?store.exportNumber:op._page,
  183. pageSize: store.exportPageSize?store.exportPageSize:store.pageSize
  184. };
  185. for(let k in temp) {
  186. if(!!temp[k]) {
  187. obj[k] = temp[k];
  188. }
  189. }
  190. return obj;
  191. },
  192. });