index.html 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  1. <!doctype html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
  6. <link rel="shortcut icon" href="/img/logo.png" />
  7. <link rel="bookmark" href="/img/logo.png" />
  8. <link rel="stylesheet" href="/plugins/bootstrap-4.3.1/css/bootstrap.min.css">
  9. <link rel="stylesheet" href="/plugins/font-awesome-4.7.0/css/font-awesome.min.css">
  10. <!--<link rel="stylesheet" href="../common/StyleSheet.css" />-->
  11. <script src="/Plugins/jquery-3.4.1/jquery-3.4.1.min.js"></script>
  12. <script src="/Plugins/xrequest/xrequest.min.js"></script>
  13. <title>东科软件</title>
  14. <style>
  15. tbody .bold-large-text {
  16. font-size: 24px;
  17. font-weight: bold;
  18. text-align: center;
  19. color: red;
  20. vertical-align: middle;
  21. }
  22. a {
  23. color: lightgray;
  24. }
  25. </style>
  26. </head>
  27. <body class="bg-light">
  28. <!--自动缩放-->
  29. <!--<script src="../common/setting.js"></script>-->
  30. <!--导航菜单-->
  31. <script src="../common/navbar.js"></script>
  32. <div class="container-fluid pt-3">
  33. <div class="p-4 rounded shadow-sm bg-white">
  34. <div class="position-absolute d-none d-lg-block">
  35. <img src="/Img/dongke.png" style="width:100px;" />
  36. </div>
  37. <div class="position-relative pull-right d-none d-lg-block">
  38. <a class="nav-link" href="javascript:void(0)" onclick="fullScreen(); $('#navbar').toggle();">
  39. <i class="fa fa-bars" aria-hidden="true"></i>
  40. </a>
  41. </div>
  42. <!--报表名称-->
  43. <h4 class="text-center pb-2">包装单一览表</h4>
  44. <!--工具条-->
  45. <div id="toolbar" class="pb-4">
  46. <form id="formSearch" class="form-inline">
  47. <div class="form-group pr-2">
  48. <div>线号:</div>
  49. <select id="线号" name="线号" class="custom-select" style="width:120px;">
  50. <option value="">请选择...</option>
  51. <option value="1">1</option>
  52. <option value="2">2</option>
  53. </select>
  54. </div>
  55. <div class="form-group pull-right">
  56. <button id="清空按钮" type="button" onclick="resetForm()" class="btn btn-secondary">清空</button>
  57. <div class="pl-2"></div>
  58. <button id="搜索按钮" type="button" onclick="loadData()" class="btn btn-danger">搜索</button>
  59. </div>
  60. </form>
  61. </div>
  62. <!--报表数据-->
  63. <table id="table" class="table table-bordered table-hover" data-toolbar="#toolbar" style="font-size: 24px;">
  64. <thead>
  65. <tr>
  66. <th scope="col" data-field="出水距" data-sortable="true">水距</th>
  67. <th scope="col" data-field="产品型号" data-sortable="true">产品型号</th>
  68. <!--<th scope="col" data-field="商标" data-sortable="true">商标</th>
  69. <th scope="col" data-field="商标物料描述" data-sortable="true">物料描述</th>-->
  70. <th scope="col" data-field="商标变更" data-sortable="true">商标变更</th>
  71. <th scope="col" data-field="商标变更物料描述" data-sortable="true">物料描述</th>
  72. <th scope="col" data-field="出库数量" data-sortable="true">数量</th>
  73. <th scope="col" data-field="已出数量" data-sortable="true">已出</th>
  74. <th scope="col" data-field="状态" data-sortable="true">状态</th>
  75. <th scope="col" data-field="下单时间" data-sortable="true">下单时间</th>
  76. <th scope="col" data-field="线号" data-sortable="true">线号</th>
  77. </tr>
  78. </thead>
  79. </table>
  80. <div class="pb-4"></div>
  81. </div>
  82. </div>
  83. <!--版权信息-->
  84. <script src="../common/footer.js"></script>
  85. <script src="/Plugins/bootstrap-4.3.1/js/bootstrap.bundle.min.js"></script>
  86. <script src="/Plugins/bootstrap-table/bootstrap-table.min.js"></script>
  87. <script src="/Plugins/bootstrap-table/bootstrap-table-locale-all.min.js"></script>
  88. <script src="/Plugins/sweetalert/sweetalert.min.js"></script>
  89. <script src="../Common/xuwell.js"></script>
  90. <script>
  91. $(document).ready(function () {
  92. loadData();
  93. setInterval(function () { loadData(); }, 30000);
  94. });
  95. function loadData() {
  96. const select = document.getElementById('线号');
  97. //await xuwell.loadTable({
  98. // id: '#table',
  99. // url: 'index.ashx?linenumber=' + select.value + '&r=' + Math.random()
  100. //});
  101. //将原有方法提取出来 新加uptable方法
  102. var $table = $('#table');
  103. $table.bootstrapTable('destroy').bootstrapTable({
  104. toggle: "table",
  105. boolbar: '#toolbar',
  106. url: 'index.ashx?linenumber=' + select.value + '&r=' + Math.random(),
  107. locale: "zh-CN",
  108. sortable: false,
  109. sortOrder: "asc",
  110. pagination: true,
  111. pageNumber: 1,
  112. pageSize: 10,
  113. pageList: "[10, 100, 500, 1000, 2000, 5000, ALL]",
  114. striped: true,
  115. sidePagination: 'server',
  116. columns: [
  117. {
  118. field: '出水距', // 列的字段名
  119. title: '水距', // 列的标题
  120. class: 'bold-large-text' // 为该列添加 CSS 类
  121. // 其他列选项...
  122. }],
  123. responseHandler: function (res) {
  124. return res;
  125. },
  126. onLoadSuccess: function (data) {
  127. uptable(data.rows);
  128. }
  129. });
  130. };
  131. function resetForm() {
  132. $('#formSearch')[0].reset();
  133. };
  134. /**合并单元格*/
  135. const uptable = (data) => {
  136. /**出水距*/
  137. let dataValue = null;
  138. /**起始单元格 */
  139. let startIndex = 0;
  140. /**合并行数 */
  141. let rowspan = 1;
  142. data.forEach((value, index) => {
  143. // 初始化
  144. if (dataValue === null) {
  145. dataValue = value.出水距;
  146. startIndex = index;
  147. }
  148. //检测到变化点
  149. else if (value.出水距 !== dataValue) {
  150. //合并前一个组并且只合并数量大于1的组
  151. if (rowspan > 1) {
  152. $('#table').bootstrapTable('mergeCells', { index: startIndex, field: '出水距', rowspan: rowspan })
  153. }
  154. // 更新状态
  155. dataValue = value.出水距;
  156. startIndex = index;
  157. rowspan = 1;
  158. }
  159. else {
  160. // 同一组,增加计数
  161. rowspan++;
  162. }
  163. });
  164. // 处理最后一个组(如果数组以同一组结束且数量大于1)
  165. if (dataValue !== null && rowspan > 1) {
  166. $('#table').bootstrapTable('mergeCells', { index: startIndex, field: '出水距', rowspan: rowspan })
  167. }
  168. }
  169. </script>
  170. </body>
  171. </html>