StaffList.js 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200
  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. initComponent: function() {
  9. var me = this;
  10. Ext.apply(this, {
  11. searchField: [{
  12. xtype: 'textfield',
  13. name: 'code',
  14. fieldLabel:'教职工号'
  15. }, {
  16. xtype: 'textfield',
  17. name: 'name',
  18. fieldLabel: '姓名'
  19. }, {
  20. xtype: 'textfield',
  21. name: 'job',
  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. handler: me.onImport,
  51. }, {
  52. xtype: 'button',
  53. text: '一键开通'
  54. }, {
  55. xtype: 'button',
  56. text: '下载模板'
  57. }, {
  58. xtype: 'button',
  59. text: '批量导入'
  60. }, {
  61. xtype: 'button',
  62. text: '删除'
  63. }, {
  64. xtype: 'button',
  65. text: '新增'
  66. }],
  67. columns : [{
  68. text: 'ID',
  69. dataIndex: 'teacher_id',
  70. hidden: true
  71. }, {
  72. text: '工号',
  73. dataIndex: 'teacher_number',
  74. width: 150
  75. }, {
  76. text: '绑定手机号',
  77. dataIndex: 'phone',
  78. width: 120
  79. }, {
  80. text: '姓名',
  81. dataIndex: 'teacher_name',
  82. width: 120
  83. }, {
  84. text: '性别',
  85. dataIndex: 'teacher_sex',
  86. renderer: function(v, m, r) {
  87. return v == 1 ? '男' : (v == 0 ? '女' : '未知');
  88. }
  89. }, {
  90. text: '工龄',
  91. dataIndex: 'teacher_working_age'
  92. }, {
  93. text: '是否开通',
  94. dataIndex: 'open'
  95. }, {
  96. text: '状态',
  97. dataIndex: 'teacher_status'
  98. }],
  99. listeners: {
  100. itemclick: function(view, record, item, index, e, eOpts) {
  101. school.util.BaseUtil.openTab('basic-staff-staffdetail', '教职工信息', 'basic-staff-staffdetail'+record.get('teacher_id'), {
  102. initId: record.get('teacher_id')
  103. });
  104. }
  105. }
  106. },
  107. });
  108. this.callParent(arguments);
  109. },
  110. onImport:function(){
  111. var grid = this.ownerCt.ownerCt;
  112. var form = grid.ownerCt,panelEl = form.getEl();
  113. var box = panelEl.getBox();
  114. var height = box.height;
  115. var width = box.width;
  116. var win = form.add(Ext.create('school.view.core.base.ImportWindow', {
  117. cls:'x-window-dbfind',
  118. belong:form,
  119. modal:true,
  120. height: height * 0.8,
  121. width: width * 0.8,
  122. title: form._title + '导入',
  123. scrollable: true,
  124. bodyPadding: 10,
  125. constrain: true,
  126. closable: true,
  127. layout:'fit',
  128. renderTo:form.getEl()
  129. }));
  130. win.show();
  131. },
  132. /**
  133. * 处理部分字段值
  134. */
  135. getConditionValue: function (field, value) {
  136. var me = this,
  137. xtypes = field.getXTypes().split('/'),
  138. conditionValue;
  139. if (me.isContainsAny(xtypes, ['datefield'])) {
  140. conditionValue = Ext.Date.format(new Date(from), 'Y-m-d H:i:s');
  141. } else if (me.isContainsAny(xtypes, ['conmonthfield'])) {
  142. var from = value.from,
  143. to = value.to;
  144. conditionValue = from + ',' + to;
  145. } else if (me.isContainsAny(xtypes, ['condatefield'])) {
  146. var from = value.from,
  147. to = value.to;
  148. 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');
  149. } else if (me.isContainsAny(xtypes, ['dbfindtrigger'])) {
  150. conditionValue = value;
  151. } else if (me.isContainsAny(xtypes, ['combobox', 'combo'])) {
  152. conditionValue = value;
  153. } else if (me.isContainsAny(xtypes, ['multicombo'])) {
  154. conditionValue = value.map ? value.map(function (v) {
  155. return v.value;
  156. }).join(',') : '';
  157. } else {
  158. conditionValue = value;
  159. }
  160. return conditionValue;
  161. },
  162. getExtraParams: function(store, op, condition) {
  163. var temp = {};
  164. for(let x = 0; x < condition.length; x++) {
  165. let c = condition[x];
  166. if(c.field == 'keyword') {
  167. temp.keyword = c.value;
  168. }else if(c.field == 'date') {
  169. temp.fromDate = new Date(c.value.split(',')[0]).getTime();
  170. temp.endDate = new Date(c.value.split(',')[1]).getTime();
  171. }else if(c.field == 'quoted') {
  172. temp.quoted = c.value == 'all' ? null : c.value;
  173. }else if(c.field == 'closed') {
  174. // temp.endDate = c.value == 'all' ? null : (
  175. // c.value == '0' ?
  176. // );
  177. }
  178. }
  179. let obj = {
  180. pageNumber: store.exportNumber?store.exportNumber:op._page,
  181. pageSize: store.exportPageSize?store.exportPageSize:store.pageSize
  182. };
  183. for(let k in temp) {
  184. if(!!temp[k]) {
  185. obj[k] = temp[k];
  186. }
  187. }
  188. return obj;
  189. },
  190. });