reprint_record.jsp 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296
  1. <%@ page language="java" contentType="text/html; charset=UTF-8"
  2. pageEncoding="UTF-8" %>
  3. <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
  4. <c:set value="<%=request.getContextPath()%>" var="ctx"></c:set>
  5. <!DOCTYPE html>
  6. <html>
  7. <head>
  8. <meta charset="utf-8">
  9. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  10. <title>补打信息记录</title>
  11. <meta name="keywords" content="补打信息,记录">
  12. <meta name="description" content="补打信息记录管理页面">
  13. <link href="${ctx}/css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
  14. <link href="${ctx}/css/font-awesome.css?v=4.4.0" rel="stylesheet">
  15. <link href="${ctx}/css/bootstrap-select.min.css" rel="stylesheet">
  16. <link href="${ctx}/css/plugins/bootstrap-table/bootstrap-table.min.css" rel="stylesheet">
  17. <link href="${ctx}/css/animate.css" rel="stylesheet">
  18. <link href="${ctx}/css/style.css?v=4.1.0" rel="stylesheet">
  19. <style>
  20. .row.mb-4 {
  21. margin-bottom: 1.5rem;
  22. }
  23. .form-inline-flex {
  24. display: flex;
  25. flex-wrap: wrap;
  26. align-items: center;
  27. gap: 5px;
  28. }
  29. @media (max-width: 768px) {
  30. .form-inline-flex {
  31. flex-direction: column;
  32. align-items: stretch;
  33. }
  34. .form-inline-flex .form-control,
  35. .form-inline-flex .btn,
  36. .form-inline-flex .selectpicker {
  37. width: 100% !important;
  38. margin-right: 0 !important;
  39. }
  40. }
  41. </style>
  42. </head>
  43. <body class="gray-bg">
  44. <div class="wrapper wrapper-content animated fadeInRight">
  45. <div class="row">
  46. <div class="col-sm-12">
  47. <div class="ibox">
  48. <div class="ibox-title">
  49. <div class="row">
  50. <div class="col-sm-10">
  51. <h3>补打信息记录</h3>
  52. </div>
  53. </div>
  54. </div>
  55. <div class="ibox-content">
  56. <div class="row row-lg mb-4">
  57. <div class="col-lg-12">
  58. <div class="form-inline-flex">
  59. <input type="date" class="form-control" id="reprintTime" name="reprintTime" style="width: 180px; flex-shrink: 0; margin-right: 10px; margin-bottom: 5px;">
  60. <div style="width: 200px; flex-shrink: 0; margin-right: 10px; margin-bottom: 5px;">
  61. <select id="factoryId" class="form-control selectpicker" data-live-search="true" title="请选择工厂">
  62. </select>
  63. </div>
  64. <div style="width: 200px; flex-shrink: 0; margin-right: 10px; margin-bottom: 5px;">
  65. <select id="productId" class="form-control selectpicker" data-live-search="true" title="请选择产品">
  66. </select>
  67. </div>
  68. <button type="button" id="searchBtn" class="btn btn-success"
  69. onclick="search();return false;" style="margin-right: 5px; margin-bottom: 5px;">
  70. 查询
  71. </button>
  72. <button type="button" id="resetBtn" class="btn btn-default"
  73. onclick="reset();return false;" style="margin-right: 5px; margin-bottom: 5px;">重置
  74. </button>
  75. </div>
  76. </div>
  77. </div>
  78. <div class="row row-lg mt-3">
  79. <div class="col-sm-12">
  80. <table id="table" data-toggle="table" data-mobile-responsive="true"></table>
  81. </div>
  82. </div>
  83. </div>
  84. </div>
  85. </div>
  86. </div>
  87. </div>
  88. <script src="${ctx}/js/jquery.min.js?v=2.1.4"></script>
  89. <script src="${ctx}/js/bootstrap.min.js?v=3.3.6"></script>
  90. <script src="${ctx}/js/bootstrap-select.min.js"></script>
  91. <script src="${ctx}/js/plugins/validate/jquery.validate.min.js"></script>
  92. <script src="${ctx}/js/plugins/validate/messages_zh.min.js"></script>
  93. <script src="${ctx}/js/plugins/bootstrap-table/bootstrap-table.min.js"></script>
  94. <script src="${ctx}/js/plugins/bootstrap-table/bootstrap-table-mobile.min.js"></script>
  95. <script src="${ctx}/js/plugins/bootstrap-table/locale/bootstrap-table-zh-CN.min.js"></script>
  96. <script src="${ctx}/js/common.js"></script>
  97. <script src="${ctx}/js/plugins/layer/layer.min.js"></script>
  98. <script src="${ctx}/js/Math.uuid.js"></script>
  99. <script src="${ctx}/js/content.js?v=1.0.0"></script>
  100. </body>
  101. <script>
  102. var table = null;
  103. $(document).ready(function () {
  104. table = $('#table').bootstrapTable("destroy");
  105. initTable();
  106. $('.selectpicker').selectpicker({
  107. liveSearch: true,
  108. size: 5,
  109. actionsBox: true,
  110. selectedTextFormat: 'count > 2'
  111. });
  112. initFactorySelect();
  113. initProductSelect();
  114. // Bind reset button click event
  115. $('#resetBtn').on('click', function () {
  116. reset();
  117. });
  118. });
  119. function queryParams(param) {
  120. // Get search parameters
  121. let reprintTime = $.trim($("#reprintTime").val());
  122. let factoryId = $.trim($("#factoryId").val());
  123. let productId = $.trim($("#productId").val());
  124. if (reprintTime) {
  125. param['reprintTime'] = reprintTime;
  126. }
  127. if (factoryId) {
  128. param['factoryId'] = factoryId;
  129. }
  130. if (productId) {
  131. param['sku'] = productId;
  132. }
  133. return param;
  134. }
  135. function search() {
  136. table = $('#table').bootstrapTable("refresh");
  137. }
  138. function reset() {
  139. // Reset form
  140. $("#reprintTime").val("");
  141. $("#factoryId").selectpicker('val', '');
  142. $("#productId").selectpicker('val', '');
  143. // Refresh table
  144. table = $('#table').bootstrapTable("refresh");
  145. }
  146. // Load factory data (reused from original file)
  147. function initFactorySelect() {
  148. $.ajax({
  149. url: '${ctx}/lineProduct/getFactoryList', // Assuming same endpoint
  150. type: 'POST',
  151. dataType: 'json',
  152. beforeSend: function () {
  153. $('#factoryId').prop('disabled', true).selectpicker('refresh');
  154. },
  155. success: function (res) {
  156. $('#factoryId').empty();
  157. if (res.data && res.data.length) {
  158. res.data.forEach(item => {
  159. $('#factoryId').append('<option value="' + item.id + '">' + item.factory_name + '</option>');
  160. });
  161. }
  162. $('#factoryId').selectpicker('refresh');
  163. },
  164. error: function (xhr) {
  165. $('#factoryId').empty().append('<option value="">加载失败</option>');
  166. $('#factoryId').selectpicker('refresh');
  167. layer.msg('获取工厂数据失败: ' + xhr.statusText);
  168. },
  169. complete: function () {
  170. $('#factoryId').prop('disabled', false).selectpicker('refresh');
  171. }
  172. });
  173. }
  174. // Load product data (reused from original file)
  175. function initProductSelect() {
  176. $.ajax({
  177. url: '${ctx}/itemNew/getItemAll', // Assuming same endpoint
  178. type: 'POST',
  179. dataType: 'json',
  180. beforeSend: function () {
  181. $('#productId').prop('disabled', true).selectpicker('refresh');
  182. },
  183. success: function (res) {
  184. $('#productId').empty();
  185. if (res.data && res.data.length) {
  186. res.data.forEach(item => {
  187. $('#productId').append('<option value="' + item.sku + '">' + item.item_name + '</option>');
  188. });
  189. }
  190. $('#productId').selectpicker('refresh');
  191. },
  192. error: function (xhr) {
  193. $('#productId').empty().append('<option value="">加载失败</option>');
  194. $('#productId').selectpicker('refresh');
  195. layer.msg('获取产品数据失败: ' + xhr.statusText);
  196. },
  197. complete: function () {
  198. $('#productId').prop('disabled', false).selectpicker('refresh');
  199. }
  200. });
  201. }
  202. function initTable() {
  203. table = $('#table').bootstrapTable({
  204. url: '${ctx}/prodBatch/getReprintRecord', // ** IMPORTANT: Use the new data endpoint **
  205. method: 'get',
  206. sortable: true,
  207. striped: true,
  208. cache: false,
  209. pagination: true,
  210. pageNumber: 1,
  211. pageSize: 10,
  212. pageList: [10, 25, 50, 100],
  213. queryParamsType: '',
  214. queryParams: queryParams,
  215. sidePagination: "server",
  216. strictSearch: false,
  217. minimumCountColumns: 2,
  218. clickToSelect: true,
  219. searchOnEnterKey: true,
  220. idField: "id", // Assuming there is a unique ID field
  221. responseHandler: function (res) {
  222. return {
  223. total: res.total,
  224. rows: res.records
  225. };
  226. },
  227. columns: [{
  228. title: '序号',
  229. align: 'center',
  230. formatter: function (value, row, index) {
  231. var pageNumber = this.pageNumber || 1;
  232. var pageSize = this.pageSize || 10;
  233. return (pageNumber - 1) * pageSize + index + 1;
  234. },
  235. width: "5%"
  236. }, {
  237. field: 'taskOrderNo',
  238. title: '任务单号',
  239. align: 'center'
  240. }, {
  241. field: 'factoryName',
  242. title: '工厂名称',
  243. align: 'center'
  244. }, {
  245. field: 'workshopName',
  246. title: '生产车间',
  247. align: 'center'
  248. }, {
  249. field: 'lineName',
  250. title: '产线',
  251. align: 'center'
  252. }, {
  253. field: 'productName',
  254. title: '产品名称',
  255. align: 'center'
  256. }, {
  257. field: 'boxCode',
  258. title: '箱码',
  259. align: 'center'
  260. }, {
  261. field: 'palletCode',
  262. title: '托码',
  263. align: 'center'
  264. }, {
  265. field: 'reprintTime',
  266. title: '补打时间',
  267. align: 'center'
  268. }],
  269. onLoadSuccess: function (data) {
  270. console.log("数据加载成功", data);
  271. },
  272. onLoadError: function () {
  273. layer.msg('数据加载失败', {icon: 2});
  274. }
  275. });
  276. }
  277. </script>
  278. </html>