StudentList.js 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  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/school/student/list',
  8. _title: '学生信息',
  9. caller: 'Student',
  10. pathKey: 'student',
  11. initComponent: function() {
  12. var me = this;
  13. Ext.apply(this, {
  14. searchField: [{
  15. xtype: 'textfield',
  16. name: 'grade',
  17. fieldLabel: '年级'
  18. }, {
  19. xtype: 'textfield',
  20. name: 'class',
  21. fieldLabel: '班级'
  22. }, {
  23. xtype: 'textfield',
  24. name: 'code',
  25. fieldLabel:'学号'
  26. }, {
  27. xtype: 'textfield',
  28. name: 'name',
  29. fieldLabel: '姓名'
  30. }, {
  31. xtype: 'textfield',
  32. name: 'parent',
  33. fieldLabel: '家长'
  34. }],
  35. gridConfig: {
  36. addTitle: '学生信息',
  37. addXtype: 'basic-student-studentdetail',
  38. idField: 'stu_id',
  39. codeField: 'stu_number',
  40. dataUrl: me.dataUrl,
  41. caller: null,
  42. rootProperty: 'data.list',
  43. totalProperty: 'data.total',
  44. actionColumn: [],
  45. selModel: {
  46. checkOnly:true,
  47. type:'checkboxmodel',
  48. mode : "MULTI" ,
  49. ignoreRightMouseSelection : false
  50. },
  51. hiddenTools: false,
  52. toolBtns: [{
  53. xtype: 'importbutton',
  54. belong: me,
  55. caller: me.caller,
  56. pathKey: me.pathKey,
  57. onSuccess: function() {
  58. //刷新界面
  59. var g = me.down('grid');
  60. g.store.loadPage(g.store.currentPage);
  61. }
  62. }, {
  63. xtype: 'button',
  64. text: '一键开通'
  65. }, {
  66. xtype: 'button',
  67. text: '添加',
  68. handler: function() {
  69. school.util.BaseUtil.openTab('basic-student-studentdetail', '新增学生信息', 'basic-student-studentdetail-add');
  70. }
  71. }, {
  72. xtype: 'button',
  73. text: '删除'
  74. }],
  75. columns : [{
  76. text: 'id',
  77. dataIndex: 'stu_id',
  78. hidden: true
  79. }, {
  80. text: '学号',
  81. dataIndex: 'stu_number',
  82. width: 150
  83. }, {
  84. text: '学生姓名',
  85. dataIndex: 'stu_name',
  86. width: 120
  87. }, {
  88. text: '性别',
  89. dataIndex: 'stu_sex',
  90. width: 120,
  91. renderer: function(v, m, r) {
  92. return v == 1 ? '男' : (v == 0 ? '女' : '未知');
  93. }
  94. }, {
  95. text: '年级',
  96. dataIndex: 'grade'
  97. }, {
  98. text: '班级',
  99. dataIndex: 'class'
  100. }, {
  101. text: '出生日期',
  102. dataIndex: 'stu_birthday',
  103. width: 120,
  104. xtype: 'datecolumn',
  105. format: 'Y-m-d'
  106. }, {
  107. text: '年龄',
  108. dataIndex: 'stu_age'
  109. }, {
  110. text: '入学日期',
  111. dataIndex: 'stu_enroll_date',
  112. xtype: 'datecolumn',
  113. format: 'Y-m-d'
  114. }, {
  115. text: '毕业日期',
  116. dataIndex: 'stu_graduate_date',
  117. xtype: 'datecolumn',
  118. format: 'Y-m-d'
  119. }, {
  120. text: '状态',
  121. dataIndex: 'stu_status'
  122. }]
  123. },
  124. });
  125. this.callParent(arguments);
  126. },
  127. /**
  128. * 处理部分字段值
  129. */
  130. getConditionValue: function (field, value) {
  131. var me = this,
  132. xtypes = field.getXTypes().split('/'),
  133. conditionValue;
  134. if (me.isContainsAny(xtypes, ['datefield'])) {
  135. conditionValue = Ext.Date.format(new Date(from), 'Y-m-d H:i:s');
  136. } else if (me.isContainsAny(xtypes, ['conmonthfield'])) {
  137. var from = value.from,
  138. to = value.to;
  139. conditionValue = from + ',' + to;
  140. } else if (me.isContainsAny(xtypes, ['condatefield'])) {
  141. var from = value.from,
  142. to = value.to;
  143. 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');
  144. } else if (me.isContainsAny(xtypes, ['dbfindtrigger'])) {
  145. conditionValue = value;
  146. } else if (me.isContainsAny(xtypes, ['combobox', 'combo'])) {
  147. conditionValue = value;
  148. } else if (me.isContainsAny(xtypes, ['multicombo'])) {
  149. conditionValue = value.map ? value.map(function (v) {
  150. return v.value;
  151. }).join(',') : '';
  152. } else {
  153. conditionValue = value;
  154. }
  155. return conditionValue;
  156. },
  157. getExtraParams: function(store, op, condition) {
  158. var temp = {};
  159. for(let x = 0; x < condition.length; x++) {
  160. let c = condition[x];
  161. if(c.field == 'keyword') {
  162. temp.keyword = c.value;
  163. }else if(c.field == 'date') {
  164. temp.fromDate = new Date(c.value.split(',')[0]).getTime();
  165. temp.endDate = new Date(c.value.split(',')[1]).getTime();
  166. }else if(c.field == 'quoted') {
  167. temp.quoted = c.value == 'all' ? null : c.value;
  168. }else if(c.field == 'closed') {
  169. // temp.endDate = c.value == 'all' ? null : (
  170. // c.value == '0' ?
  171. // );
  172. }
  173. }
  174. let obj = {
  175. pageNumber: store.exportNumber?store.exportNumber:op._page,
  176. pageSize: store.exportPageSize?store.exportPageSize:store.pageSize
  177. };
  178. for(let k in temp) {
  179. if(!!temp[k]) {
  180. obj[k] = temp[k];
  181. }
  182. }
  183. return obj;
  184. },
  185. });