clock1.js 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220
  1. define(function (require) {
  2. return function (context) {
  3. var $grid1, $form, $coma;
  4. // 导出
  5. function exportExcel() {
  6. var queryForm = $form.formGet();
  7. $.yvan.download({
  8. method: 'post',
  9. url: api('/clock/exSelectClockLY?queryProperties=' + queryForm.queryProperties + '&phone=' + queryForm.phone + '&unitId=' + queryForm.unitId + '&departmentId=' + queryForm.departmentId + '&dateSta=' + queryForm.dateSta + '&dateEnd=' + queryForm.dateEnd),
  10. fileName: '签到管理-' + $.yvan.getMoment().format('YYYY-MM-DD HH:mm:ss') + '.xlsx'
  11. });
  12. }
  13. // 输入搜索文本后点击回车按钮查询列表
  14. function enterQueryGrid1(e) {
  15. if (e.keyCode === 13) {
  16. var tmp = $(this).val();
  17. $form.formSet({queryProperties: tmp});
  18. queryGrid1();
  19. }
  20. }
  21. function enterQueryGrid2(e) {
  22. if (e.keyCode === 13) {
  23. var tmp = $(this).val();
  24. $form.formSet({phone: tmp});
  25. queryGrid1();
  26. }
  27. }
  28. function enterQueryGrid3(e) {
  29. if (e.keyCode === 13) {
  30. var tmp = $(this).val();
  31. $form.formSet({errorInfo: tmp});
  32. queryGrid1();
  33. }
  34. }
  35. // 检索条件查询
  36. function queryGrid1() {
  37. var queryUrl = '/clock/selectClockLY';// 自行替换此参数
  38. var queryForm = $form.formGet();
  39. if (!queryForm.dateSta) {
  40. $form.formSet({dateSta: getFormatDate() + " 00:00:00"});
  41. queryForm.dateSta = getFormatDate() + " 00:00:00";
  42. }
  43. if (!queryForm.dateEnd) {
  44. $form.formSet({dateEnd: getFormatDate() + " 23:59:59"});
  45. queryForm.dateEnd = getFormatDate() + " 23:59:59";
  46. }
  47. queryForm.roleCode = App.currentRoleCode;
  48. $grid1.reload({
  49. mtype: 'POST',
  50. url: api(queryUrl),
  51. queryParams: queryForm
  52. }, true);
  53. }
  54. // 搜索按钮
  55. var queryToolbarTitle = '签到管理';// 自行替换此参数
  56. var queryToolbar = {
  57. xtype: 'toolbar', title: queryToolbarTitle, items: [
  58. {
  59. text: '查询', iconCls: 'fa fa-search', onClick: function () {
  60. queryGrid1();
  61. }
  62. }, {
  63. text: '重置', iconCls: 'fa fa-refresh', onClick: function () {
  64. $form.formClear();
  65. queryGrid1();
  66. }
  67. }, {
  68. text: '关闭', iconCls: 'fa fa-times-circle', onClick: function () {
  69. App.closeMe(this);
  70. }
  71. }
  72. ]
  73. };
  74. // 搜索条件
  75. var queryForm = {
  76. onRender: function () {
  77. $form = $(this);
  78. },
  79. xtype: 'form',
  80. items: [[
  81. {
  82. xtype: 'textbox',
  83. label: '大门名称',
  84. name: 'queryProperties',
  85. prompt: "大门名称",
  86. labelWidth: 'auto',
  87. events: {keydown: enterQueryGrid1}, width: 250
  88. },
  89. {
  90. xtype: 'textbox',
  91. label: '姓名/电话',
  92. name: 'phone',
  93. prompt: "姓名/电话",
  94. labelWidth: 'auto',
  95. events: {keydown: enterQueryGrid2}, width: 250
  96. },
  97. {
  98. xtype: 'datetimebox',
  99. name: 'dateSta',
  100. label: '进出时间',
  101. labelWidth: 'auto',
  102. width: 230,
  103. onChange: function (data) {
  104. /* var expDateStart = $form.formGet().nextRepairDate;
  105. var expDateEnd = $form.formGet().expDateEnd;
  106. var expDateStart = new Date(expDateStart.replace("-", "/"));
  107. var expDateEnd = new Date(expDateEnd.replace("-", "/"));
  108. if (expDateStart > expDateEnd) {
  109. $.yvan.msg('起止日期必须大于起始日期');
  110. return;
  111. }*/
  112. }
  113. },
  114. {
  115. xtype: 'datetimebox', label: '--', name: 'dateEnd', labelWidth: 'auto', width: 220,
  116. onChange: function (data) {
  117. /* var expDateStart = $form.formGet().nextRepairDate;
  118. var expDateEnd = $form.formGet().expDateEnd;
  119. var expDateStart = new Date(expDateStart.replace("-", "/"));
  120. var expDateEnd = new Date(expDateEnd.replace("-", "/"));
  121. if (expDateStart > expDateEnd) {
  122. $.yvan.msg('起止日期必须大于起始日期');
  123. return;
  124. }*/
  125. }
  126. }
  127. ],]
  128. };
  129. var gridToolbarTitle = '签到列表';// 自行替换此参数
  130. var gridToolbar = {
  131. xtype: 'toolbar',
  132. title: gridToolbarTitle,
  133. items: [
  134. {
  135. text: '导出', iconCls: 'fa fa-cloud-upload', onClick: function () {
  136. exportExcel();
  137. }
  138. },
  139. {
  140. text: '分单位统计考勤', iconCls: 'fa fa-cloud-upload', onClick: function () {
  141. var queryForm = $form.formGet();
  142. $.yvan.download({
  143. method: 'post',
  144. url: api('/clock/exClockCount?queryProperties=' + queryForm.queryProperties + '&phone=' + queryForm.phone + '&unitId=' + queryForm.unitId + '&departmentId=' + queryForm.departmentId + '&dateSta=' + queryForm.dateSta + '&dateEnd=' + queryForm.dateEnd),
  145. fileName: '分单位统计考勤-' + $.yvan.getMoment().format('YYYY-MM-DD HH:mm:ss') + '.xlsx'
  146. });
  147. }
  148. },
  149. ]
  150. };
  151. return {
  152. north: {
  153. height: 88,
  154. /* split: true,
  155. border: false,*///底框是否可变动
  156. items: [
  157. queryToolbar,
  158. queryForm
  159. ]
  160. },
  161. center: {
  162. height: '60%',
  163. split: true,
  164. items:
  165. {
  166. onRender: function () {
  167. $grid1 = $(this);
  168. queryGrid1()
  169. },
  170. xtype: 'grid',
  171. toolbar:
  172. gridToolbar,
  173. idField: 'joId',
  174. autoSizeColumns: true,//序号多 正确显示
  175. columns:
  176. [
  177. [
  178. {field: 'uptownId', title: '小区id', maxWidth: 200, align: 'left', hidden: true},
  179. // {field: 'uptownName', title: '小区名称', maxWidth: 200, align: 'left',},
  180. {field: 'doorName', title: '出入大门', align: 'left',},
  181. {field: 'unit', title: '部门', maxWidth: 200,},
  182. {field: 'departmentName', title: '二级部门', maxWidth: 200, align: 'left',},
  183. {
  184. field: 'linkman',
  185. title: '用户名',
  186. },
  187. {
  188. field: 'phone',
  189. title: '电话',
  190. },
  191. {
  192. field: 'doorplate',
  193. title: '工号', maxWidth: 200,
  194. },
  195. {
  196. field: 'dateStr',
  197. title: '签到时间',
  198. align: 'left',
  199. },
  200. // {field: 'longitude', title: '经度', maxWidth: 200, align: 'left',},
  201. // {field: 'latitude', title: '纬度', maxWidth: 200, align: 'left',},
  202. // {field: 'address', title: '详细地址', maxWidth: 200, align: 'left',},
  203. ]
  204. ]
  205. }
  206. }
  207. };
  208. };
  209. }
  210. );