dakaLY.js 8.8 KB

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