xqmanageLY.js 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348
  1. define(function (require) {
  2. return function (context) {
  3. var $grid1, $form, $coma;
  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 reloadValuea(_datas) {
  17. if ($coma) {
  18. $coma.combobox('clear');// 清除当前的选项
  19. $coma.combobox('loadData', _datas);// 重新加载数据
  20. }
  21. }
  22. // 获取联机下拉选二级信息
  23. function getList(id) {
  24. id = id == undefined ? 0 : id
  25. var _datas = [];
  26. _datas.push({
  27. "id": "",
  28. "text": "全部",
  29. "selected": true
  30. });
  31. $.yvan.ajax({
  32. url: api('/home/getDepartmentIdLYepi.json?unitId=' + id),
  33. method: 'GET',
  34. async: true,
  35. success: function (data) {
  36. if (data.data != null && data.data != undefined) {
  37. for (var i = 0; i < data.data.length; i++) {
  38. _datas.push({
  39. "id": data.data[i].departmentId,
  40. "text": data.data[i].departmentName
  41. })
  42. }
  43. reloadValuea(_datas);
  44. }
  45. }
  46. });
  47. return _datas;
  48. }
  49. // 导出
  50. function exportExcel() {
  51. var queryForm = $form.formGet();
  52. $.yvan.download({
  53. method: 'post',
  54. 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 + '&departmentId=' + queryForm.departmentId),
  55. fileName: '进出管理-' + $.yvan.getMoment().format('YYYY-MM-DD HH:mm:ss') + '.xlsx'
  56. });
  57. }
  58. // 输入搜索文本后点击回车按钮查询列表
  59. function enterQueryGrid1(e) {
  60. if (e.keyCode === 13) {
  61. var tmp = $(this).val();
  62. $form.formSet({queryProperties: tmp});
  63. queryGrid1();
  64. }
  65. }
  66. function enterQueryGrid2(e) {
  67. if (e.keyCode === 13) {
  68. var tmp = $(this).val();
  69. $form.formSet({phone: tmp});
  70. queryGrid1();
  71. }
  72. }
  73. function enterQueryGrid3(e) {
  74. if (e.keyCode === 13) {
  75. var tmp = $(this).val();
  76. $form.formSet({errorInfo: tmp});
  77. queryGrid1();
  78. }
  79. }
  80. // 检索条件查询
  81. function queryGrid1() {
  82. var queryUrl = '/sweepCode/selectCodeLY';// 自行替换此参数
  83. var queryForm = $form.formGet();
  84. if (!queryForm.dateSta) {
  85. $form.formSet({dateSta: getFormatDate() + " 00:00:00"});
  86. queryForm.dateSta = getFormatDate() + " 00:00:00";
  87. }
  88. if (!queryForm.dateEnd) {
  89. $form.formSet({dateEnd: getFormatDate() + " 23:59:59"});
  90. queryForm.dateEnd = getFormatDate() + " 23:59:59";
  91. }
  92. queryForm.roleCode = App.currentRoleCode;
  93. $grid1.reload({
  94. mtype: 'POST',
  95. url: api(queryUrl),
  96. queryParams: queryForm
  97. }, true);
  98. }
  99. // 搜索按钮
  100. var queryToolbarTitle = '进出管理';// 自行替换此参数
  101. var queryToolbar = {
  102. xtype: 'toolbar', title: queryToolbarTitle, items: [
  103. {
  104. text: '查询', iconCls: 'fa fa-search', onClick: function () {
  105. queryGrid1();
  106. }
  107. }, {
  108. text: '重置', iconCls: 'fa fa-refresh', onClick: function () {
  109. $form.formClear();
  110. queryGrid1();
  111. }
  112. }, {
  113. text: '关闭', iconCls: 'fa fa-times-circle', onClick: function () {
  114. App.closeMe(this);
  115. }
  116. }
  117. ]
  118. };
  119. // 搜索条件
  120. var queryForm = {
  121. onRender: function () {
  122. $form = $(this);
  123. },
  124. xtype: 'form',
  125. items: [[
  126. {
  127. xtype: 'textbox',
  128. label: '大门名称',
  129. name: 'queryProperties',
  130. prompt: "大门名称",
  131. labelWidth: 'auto',
  132. events: {keydown: enterQueryGrid1}, width: 250
  133. },
  134. {
  135. xtype: 'textbox',
  136. label: '姓名/电话',
  137. name: 'phone',
  138. prompt: "姓名/电话",
  139. labelWidth: 'auto',
  140. events: {keydown: enterQueryGrid2}, width: 250
  141. },
  142. {
  143. xtype: 'textbox',
  144. label: '错误提示',
  145. name: 'errorInfo',
  146. prompt: "错误提示",
  147. labelWidth: 'auto',
  148. events: {keydown: enterQueryGrid3}, width: 250
  149. },
  150. {xtype: 'hidden', name: 'unitId'},
  151. {
  152. xtype: 'searchbox',
  153. label: '部门',
  154. name: 'unit',
  155. prompt: "部门",
  156. width: '300px',
  157. widget: widgets.selectTableUnit,// 弹出框方法
  158. labelWidth: '70px',
  159. onChange: function (value) {
  160. if (!isNotNullOrEmpty(value)) {
  161. $form.formSet({
  162. unitId: 0
  163. })
  164. }
  165. getList($form.formGet().unitId);
  166. queryGrid1();
  167. },
  168. },],[
  169. {
  170. xtype: 'yvselect', label: '通行状态', name: 'goStatus', labelWidth: 'auto', value: '', width: 220,
  171. data: [
  172. {id: '1', text: '允许'},
  173. {id: '-1', text: '禁止'},
  174. ],
  175. onChange: function () {
  176. queryGrid1();
  177. }
  178. },
  179. {
  180. xtype: 'combobox',
  181. label: '二级部门',
  182. name: 'departmentId',
  183. labelWidth: 'auto',
  184. width: 280,
  185. value: '',
  186. data: getList(),
  187. onRender: function () {
  188. $coma = $(this);
  189. },
  190. onValue: function (data) {
  191. },
  192. onChange: function () {
  193. queryGrid1();
  194. }
  195. },
  196. {
  197. xtype: 'datetimebox',
  198. name: 'dateSta',
  199. label: '进出时间',
  200. labelWidth: 'auto',
  201. width: 230,
  202. onChange: function (data) {
  203. /* var expDateStart = $form.formGet().nextRepairDate;
  204. var expDateEnd = $form.formGet().expDateEnd;
  205. var expDateStart = new Date(expDateStart.replace("-", "/"));
  206. var expDateEnd = new Date(expDateEnd.replace("-", "/"));
  207. if (expDateStart > expDateEnd) {
  208. $.yvan.msg('起止日期必须大于起始日期');
  209. return;
  210. }*/
  211. }
  212. },
  213. {
  214. xtype: 'datetimebox', label: '--', name: 'dateEnd', labelWidth: 'auto', width: 220,
  215. onChange: function (data) {
  216. /* var expDateStart = $form.formGet().nextRepairDate;
  217. var expDateEnd = $form.formGet().expDateEnd;
  218. var expDateStart = new Date(expDateStart.replace("-", "/"));
  219. var expDateEnd = new Date(expDateEnd.replace("-", "/"));
  220. if (expDateStart > expDateEnd) {
  221. $.yvan.msg('起止日期必须大于起始日期');
  222. return;
  223. }*/
  224. }
  225. }
  226. ]]
  227. };
  228. var gridToolbarTitle = '出入列表';// 自行替换此参数
  229. var gridToolbar = {
  230. xtype: 'toolbar',
  231. title: gridToolbarTitle,
  232. items: [
  233. {
  234. text: '导出', iconCls: 'fa fa-cloud-upload', onClick: function () {
  235. exportExcel();
  236. }
  237. },
  238. ]
  239. };
  240. return {
  241. north: {
  242. height: 132,
  243. /* split: true,
  244. border: false,*///底框是否可变动
  245. items: [
  246. queryToolbar,
  247. queryForm
  248. ]
  249. },
  250. center: {
  251. height: '60%',
  252. split: true,
  253. items:
  254. {
  255. onRender: function () {
  256. $grid1 = $(this);
  257. queryGrid1()
  258. },
  259. xtype: 'grid',
  260. toolbar:
  261. gridToolbar,
  262. idField: 'joId',
  263. autoSizeColumns: true,//序号多 正确显示
  264. columns:
  265. [
  266. [
  267. {field: 'uptownId', title: '小区id', maxWidth: 200, align: 'left', hidden: true},
  268. // {field: 'uptownName', title: '小区名称', maxWidth: 200, align: 'left',},
  269. // {field: 'ridgepole', title: '楼栋', maxWidth: 200, align: 'left',},
  270. {field: 'unit', title: '部门', maxWidth: 200,},
  271. {field: 'departmentName', title: '二级部门', maxWidth: 200,},
  272. {
  273. field: 'doorplate',
  274. title: '工号', maxWidth: 200,
  275. },
  276. {
  277. field: 'linkman',
  278. title: '用户名',
  279. },
  280. {
  281. field: 'phone',
  282. title: '电话',
  283. },
  284. {
  285. field: 'doorName',
  286. title: '出入大门',
  287. align: 'left',
  288. },
  289. {
  290. field: 'date',
  291. title: '进出时间',
  292. align: 'left',
  293. },
  294. {
  295. field: 'inType',
  296. title: '记录状态',
  297. align: 'center',
  298. formatter:function (value) {
  299. if(value==1){
  300. return "进入"
  301. }else if(value ==2){
  302. return "外出"
  303. }
  304. }
  305. },
  306. {
  307. field: 'goStatus',
  308. title: '通行状态',
  309. align: 'center',
  310. formatter:function (value) {
  311. if(value==1){
  312. return "允许"
  313. }else if(value ==-1){
  314. return "禁止"
  315. }
  316. }
  317. },
  318. {
  319. field: 'errorInfo',
  320. title: '禁止提示',
  321. align: 'left',
  322. },
  323. {field: 'longitude', title: '经度', maxWidth: 200, align: 'left',},
  324. {field: 'latitude', title: '纬度', maxWidth: 200, align: 'left',},
  325. {field: 'address', title: '详细地址', maxWidth: 200, align: 'left',},
  326. ]
  327. ]
  328. }
  329. }
  330. };
  331. };
  332. }
  333. );