Index.js 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  1. var refreshGirdData;
  2. var logbegin = '';
  3. var logend = '';
  4. var StartTimeBegin = '';
  5. var StartTimeend = '';
  6. var EndTimeBegin = '';
  7. var EndTimeend = '';
  8. var selectRowsData;
  9. var bootstrap = function ($, learun) {
  10. "use strict";
  11. var page = {
  12. init: function () {
  13. page.initGird();
  14. page.bind();
  15. },
  16. bind: function () {
  17. $('#multiple_condition_query').lrMultipleQuery(function (queryJson) {
  18. // 调用后台查询
  19. // queryJson 查询条件
  20. var starttime = $('#lr_search_date_StartTime').html();
  21. if (starttime == '') {
  22. StartTimeBegin = '';
  23. StartTimeend = '';
  24. }
  25. var endtime = $('#lr_search_date_EndTime').html();
  26. if (endtime == '') {
  27. EndTimeBegin = '';
  28. EndTimeend = '';
  29. }
  30. queryJson["ID"] = $("#ID").val();
  31. queryJson["AgvID"] = $("#AgvID").val();
  32. queryJson["TaskType"] = $("#TaskType").lrselectGet();
  33. queryJson["Status"] = $("#Status").lrselectGet();
  34. queryJson["AgvStatus"] = $("#AgvStatus").lrselectGet();
  35. queryJson["Station"] = $("#Station").val();
  36. queryJson["Position"] = $("#Position").val();
  37. page.search({ queryJson: JSON.stringify(queryJson) });
  38. }, 250);
  39. // 查询
  40. $('#btn_Search').on('click', function () {
  41. var keyword = $('#txt_Keyword').val();
  42. page.search({ queryJson: JSON.stringify({ keyword: $('#txt_Keyword').val() }) });
  43. });
  44. // 刷新
  45. $('#lr_refresh').on('click', function () {
  46. location.reload();
  47. });
  48. //状态变更
  49. $('#lr_fjState').on('click', function () {
  50. selectRowsData = $('#gridtable').jfGridGet("rowdata");
  51. if (selectRowsData.length == 0) {
  52. learun.alert.error('未选择行!');
  53. return false;
  54. }
  55. learun.layerForm({
  56. id: 'form1',
  57. title: '修改状态',
  58. url: top.$.rootUrl + '/FJManager/Agv/AgvState',
  59. width: 700,
  60. height: 300,
  61. callBack: function (id) {
  62. return top[id].acceptClick(refreshGirdData);
  63. }
  64. });
  65. });
  66. $('.datetime').each(function () {
  67. $(this).lrdatetime({
  68. dfdata: [
  69. { name: '今天', begin: function () { return learun.getDate('yyyy-MM-dd 00:00:00') }, end: function () { return learun.getDate('yyyy-MM-dd 23:59:59') } },
  70. { name: '近7天', begin: function () { return learun.getDate('yyyy-MM-dd 00:00:00', 'd', -6) }, end: function () { return learun.getDate('yyyy-MM-dd 23:59:59') } },
  71. { name: '近1个月', begin: function () { return learun.getDate('yyyy-MM-dd 00:00:00', 'm', -1) }, end: function () { return learun.getDate('yyyy-MM-dd 23:59:59') } },
  72. { name: '近3个月', begin: function () { return learun.getDate('yyyy-MM-dd 00:00:00', 'm', -3) }, end: function () { return learun.getDate('yyyy-MM-dd 23:59:59') } },
  73. ],
  74. // 月
  75. mShow: false,
  76. premShow: false,
  77. // 季度
  78. jShow: false,
  79. prejShow: false,
  80. // 年
  81. ysShow: false,
  82. yxShow: false,
  83. preyShow: false,
  84. yShow: false,
  85. // 默认
  86. dfvalue: 'all',
  87. selectfn: function (begin, end) {
  88. let id = $(this).attr('id');
  89. if (id == 'datesearch') {
  90. logbegin = begin;
  91. logend = end;
  92. }
  93. else if (id == 'StartTime') {
  94. StartTimeBegin = begin;
  95. StartTimeend = end;
  96. }
  97. else if (id == 'EndTime') {
  98. EndTimeBegin = begin;
  99. EndTimeend = end;
  100. }
  101. }
  102. });
  103. });
  104. $('#TaskType').lrselect({
  105. url: top.$.rootUrl + '/FJManager/Enums/GetAGVTaskTypeList',
  106. maxHeight: 180,
  107. allowSearch: false
  108. });
  109. $('#Status').lrselect({
  110. url: top.$.rootUrl + '/FJManager/Enums/GetAGVTaskStatusList',
  111. maxHeight: 180,
  112. allowSearch: false
  113. });
  114. $('#AgvStatus').lrselect({
  115. url: top.$.rootUrl + '/FJManager/Enums/GetAGVTaskStatusList',
  116. maxHeight: 180,
  117. allowSearch: false
  118. });
  119. },
  120. // 初始化列表
  121. initGird: function () {
  122. $('#gridtable').jfGrid({
  123. url: top.$.rootUrl + '/FJManager/Agv/GetPageList',
  124. headData: [
  125. { label: "AGV任务号", name: "ID", width: 120, align: "left" },
  126. { label: "AGV单号", name: "AgvID", width: 120, align: "left" },
  127. { label: "AGV任务类型", name: "TaskTypeName", width: 120, align: "left", sortname: "TaskType" },
  128. { label: "WCS任务状态", name: "StatusName", width: 120, align: "left", sortname: "Status" },
  129. { label: "AGV任务状态", name: "AgvStatusName", width: 120, align: "left", sortname: "AgvStatus" },
  130. { label: "车间", name: "WorkShop", width: 100, align: "left" },
  131. { label: "站台", name: "Station", width: 100, align: "left" },
  132. { label: "位置", name: "Position", width: 100, align: "left" },
  133. { label: '创建用户', name: 'AddWho', width: 100, align: 'left' },
  134. { label: '更新用户', name: 'EditWho', width: 100, align: 'left' },
  135. { label: "创建时间", name: "AddTime", width: 130, align: "left" },
  136. { label: "AGV更新时间", name: "AgvUpdateTime", width: 130, align: "left" },
  137. { label: "结束时间", name: "EditTime", width: 130, align: "left" },
  138. ],
  139. mainId: 'ID',
  140. isPage: true,
  141. reloadSelected: true,
  142. sidx: 'AddTime',
  143. sord: 'DESC',
  144. isMultiselect: true,
  145. });
  146. page.search({ queryJson: JSON.stringify({ keyword: $('#txt_Keyword').val() }) });
  147. },
  148. search: function (param) {
  149. $('#gridtable').jfGridSet('reload', param);
  150. }
  151. };
  152. refreshGirdData = function () {
  153. $('#gridtable').jfGridSet('reload');
  154. };
  155. page.init();
  156. }