StaffList.js 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  1. /**
  2. * 教职工信息
  3. */
  4. Ext.define('school.view.basic.staff.StaffList', {
  5. extend: 'school.view.core.base.BasePanel',
  6. xtype: 'basic-staff-stafflist',
  7. dataUrl: '/api/school/teacher/list',
  8. _title: '教职工信息导入',
  9. caller: 'Teacher',
  10. pathKey: 'teacher',
  11. initComponent: function() {
  12. var me = this;
  13. Ext.apply(this, {
  14. searchField: [{
  15. xtype: 'textfield',
  16. name: 'code',
  17. fieldLabel:'教职工号'
  18. }, {
  19. xtype: 'textfield',
  20. name: 'name',
  21. fieldLabel: '姓名'
  22. }, {
  23. xtype: 'textfield',
  24. name: 'job',
  25. fieldLabel: '职位'
  26. }],
  27. gridConfig: {
  28. addTitle: '教职工信息',
  29. addXtype: 'basic-staff-staffdetail',
  30. idField: 'teacher_id',
  31. codeField: 'teacher_number',
  32. dataUrl: me.dataUrl,
  33. rootProperty: 'data.list',
  34. totalProperty: 'data.total',
  35. actionColumn: [],
  36. selModel: {
  37. checkOnly:true,
  38. type:'checkboxmodel',
  39. mode : "MULTI" ,
  40. ignoreRightMouseSelection : false
  41. },
  42. hiddenTools: false,
  43. toolBtns: [{
  44. xtype: 'importbutton',
  45. belong: me,
  46. caller: me.caller,
  47. pathKey: me.pathKey,
  48. onSuccess: function() {
  49. //刷新界面
  50. var g = me.down('grid');
  51. g.store.loadPage(g.store.currentPage);
  52. }
  53. }, {
  54. xtype: 'button',
  55. text: '一键开通'
  56. }, {
  57. xtype: 'button',
  58. text: '删除',
  59. handler: function() {
  60. // debugger;
  61. }
  62. }, {
  63. xtype: 'button',
  64. text: '新增',
  65. handler: function() {
  66. school.util.BaseUtil.openTab('basic-staff-staffdetail', '新增教职工信息', 'basic-staff-staffdetail-add');
  67. }
  68. }],
  69. columns : [{
  70. text: 'ID',
  71. dataIndex: 'teacher_id',
  72. hidden: true
  73. }, {
  74. text: '工号',
  75. dataIndex: 'teacher_number',
  76. width: 150
  77. }, {
  78. text: '绑定手机号',
  79. dataIndex: 'phone',
  80. width: 120
  81. }, {
  82. text: '姓名',
  83. dataIndex: 'teacher_name',
  84. width: 120
  85. }, {
  86. text: '性别',
  87. dataIndex: 'teacher_sex',
  88. renderer: function(v, m, r) {
  89. return v == 1 ? '男' : (v == 0 ? '女' : '未知');
  90. }
  91. }, {
  92. text: '工龄',
  93. dataIndex: 'teacher_working_age'
  94. }, {
  95. text: '是否开通',
  96. dataIndex: 'open'
  97. }, {
  98. text: '状态',
  99. dataIndex: 'teacher_status'
  100. }]
  101. },
  102. });
  103. this.callParent(arguments);
  104. },
  105. /**
  106. * 处理部分字段值
  107. */
  108. getConditionValue: function (field, value) {
  109. var me = this,
  110. xtypes = field.getXTypes().split('/'),
  111. conditionValue;
  112. if (me.isContainsAny(xtypes, ['datefield'])) {
  113. conditionValue = Ext.Date.format(new Date(from), 'Y-m-d H:i:s');
  114. } else if (me.isContainsAny(xtypes, ['conmonthfield'])) {
  115. var from = value.from,
  116. to = value.to;
  117. conditionValue = from + ',' + to;
  118. } else if (me.isContainsAny(xtypes, ['condatefield'])) {
  119. var from = value.from,
  120. to = value.to;
  121. 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');
  122. } else if (me.isContainsAny(xtypes, ['dbfindtrigger'])) {
  123. conditionValue = value;
  124. } else if (me.isContainsAny(xtypes, ['combobox', 'combo'])) {
  125. conditionValue = value;
  126. } else if (me.isContainsAny(xtypes, ['multicombo'])) {
  127. conditionValue = value.map ? value.map(function (v) {
  128. return v.value;
  129. }).join(',') : '';
  130. } else {
  131. conditionValue = value;
  132. }
  133. return conditionValue;
  134. },
  135. getExtraParams: function(store, op, condition) {
  136. var temp = {};
  137. for(let x = 0; x < condition.length; x++) {
  138. let c = condition[x];
  139. if(c.field == 'keyword') {
  140. temp.keyword = c.value;
  141. }else if(c.field == 'date') {
  142. temp.fromDate = new Date(c.value.split(',')[0]).getTime();
  143. temp.endDate = new Date(c.value.split(',')[1]).getTime();
  144. }else if(c.field == 'quoted') {
  145. temp.quoted = c.value == 'all' ? null : c.value;
  146. }else if(c.field == 'closed') {
  147. // temp.endDate = c.value == 'all' ? null : (
  148. // c.value == '0' ?
  149. // );
  150. }
  151. }
  152. let obj = {
  153. pageNumber: store.exportNumber?store.exportNumber:op._page,
  154. pageSize: store.exportPageSize?store.exportPageSize:store.pageSize
  155. };
  156. for(let k in temp) {
  157. if(!!temp[k]) {
  158. obj[k] = temp[k];
  159. }
  160. }
  161. return obj;
  162. },
  163. });