xqmanageHC.js 11 KB

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