You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

238 lines
8.4 KiB

3 weeks ago
  1. @{
  2. ViewBag.Title = "Index";
  3. Layout = "~/Views/Shared/_Index.cshtml";
  4. }
  5. <script src="~/Content/js/datepicker/WdatePicker.js"></script>
  6. <style>
  7. /* 搜索区域样式 */
  8. .search {
  9. display: flex;
  10. align-items: center;
  11. margin-top: 10px;
  12. }
  13. /* 选项卡样式 - 核心修复:文字显示不全 + 尺寸调整 */
  14. .tab-container {
  15. position: absolute;
  16. top: 50px; /* 垂直位置可调整 */
  17. left: 50%;
  18. transform: translateX(-50%);
  19. display: flex;
  20. gap: 2px;
  21. }
  22. .tab-container input[type="radio"] {
  23. display: none;
  24. }
  25. .tab-container label {
  26. /* 关键修复:保证文字完整显示 */
  27. min-width: 120px; /* 增大最小宽度(根据文字长度调整,如“成品信息”需至少120px) */
  28. padding: 6px 16px; /* 增加内边距,让文字更舒展(上下6px,左右16px) */
  29. height: 32px; /* 按钮总高度(包含内边距) */
  30. box-sizing: border-box;
  31. white-space: nowrap; /* 强制文字不换行 */
  32. overflow: visible; /* 确保文字不被隐藏 */
  33. /* 其他样式 */
  34. background-color: #f1f1f1;
  35. color: #333;
  36. border: 1px solid #ccc;
  37. border-bottom: none;
  38. cursor: pointer;
  39. transition: background-color 0.3s, color 0.3s;
  40. font-size: 14px;
  41. text-align: center;
  42. line-height:24px;
  43. }
  44. .tab-container input[type="radio"]:checked + label {
  45. background-color: #007BFF;
  46. color: white;
  47. border-color: #007BFF;
  48. z-index: 1;
  49. }
  50. /* 选项卡内容样式 */
  51. .tab-content {
  52. position: absolute;
  53. top: 100px; /* 根据布局调整 */
  54. left: 15px;
  55. right: 15px;
  56. bottom: 15px;
  57. border: 1px solid #ccc;
  58. background-color: #fff;
  59. padding: 0;
  60. display: none;
  61. }
  62. #tab1:checked ~ #tab-content1,
  63. #tab2:checked ~ #tab-content2 {
  64. display: block;
  65. }
  66. /* 表格样式 */
  67. .ui-jqgrid {
  68. width: 100% !important;
  69. }
  70. .ui-jqgrid .ui-jqgrid-bdiv {
  71. overflow-x: hidden !important;
  72. }
  73. </style>
  74. <script>
  75. var grid1Data = null;
  76. var grid2Data = null;
  77. $(function () {
  78. // 选项卡切换事件
  79. $('input[name="tabs"]').change(function () {
  80. $('.tab-content').hide();
  81. $('#' + $(this).attr('data-target')).show();
  82. resizeGrid();
  83. });
  84. // 默认选中第一个选项卡
  85. $('#tab1').prop('checked', true).trigger('change');
  86. // 窗口resize监听
  87. $(window).resize(function () {
  88. resizeGrid();
  89. });
  90. });
  91. function Seach() {
  92. var Code = $("#txt_Code").val();
  93. if (Code === '') {
  94. $.modalMsg("请输入单据号后查询!", "warning");
  95. return;
  96. }
  97. loadGridList();
  98. loadGridList2();
  99. }
  100. function loadGridList() {
  101. document.getElementById("tab-content1").innerHTML = ' <table id="gridList"></table> ';//重置grid
  102. $("#gridList").dataGrid({
  103. url: "/DHAY/FullProcessTraceability/GetGridJson? " + Math.random(),
  104. postData: { queryJson: JSON.stringify({ Code: $("#txt_Code").val() }) },
  105. height: $(window).height() - 200,
  106. width: "100%",
  107. colModel: [
  108. { label: "主键", name: "ID", hidden: true, key: true },
  109. { label: '工单号', name: 'MOCode', width: 120, align: 'left' },
  110. { label: '料号', name: 'InvCode', width: 150, align: 'left' },
  111. { label: '料品名称', name: 'InvName', width: 80, align: 'left' },
  112. { label: '规格', name: 'InvStd', width: 80, align: 'left' },
  113. { label: '批号', name: 'BatchCode', width: 80, align: 'left' },
  114. { label: '入库日期', name: 'RKMtime', width: 80, align: 'left' },
  115. { label: '入库数量', name: 'RKQTY', width: 80, align: 'left' },
  116. { label: '发货日期', name: 'CKMtime', width: 80, align: 'left' },
  117. { label: '发货数量', name: 'CKQTY', width: 80, align: 'left' },
  118. ],
  119. shrinkToFit: true,
  120. autowidth: true,
  121. rowNum: 10000,
  122. autoScroll: true,
  123. sortname: 'MOCode',
  124. sortorder: "desc",
  125. viewrecords: true,
  126. multiselect: false,
  127. gridComplete: function () {
  128. resizeGrid();
  129. }
  130. });
  131. }
  132. function loadGridList2() {
  133. document.getElementById("tab-content2").innerHTML = ' <table id="gridList2"></table> ';//重置grid
  134. $("#gridList2").dataGrid({
  135. url: "/DHAY/FullProcessTraceability/GetGridJson2? " + Math.random(),
  136. postData: { queryJson: JSON.stringify({ Code: $("#txt_Code").val() }) },
  137. height: $(window).height() - 200,
  138. width: "100%",
  139. colModel: [
  140. { label: "主键", name: "ID", hidden: true, key: true },
  141. { label: '工单号', name: 'Level', hidden: true },
  142. { label: '料品名称', name: 'sort', hidden: true },
  143. { label: '序号', name: 'sortseq', width: 150, align: 'left' },
  144. { label: '料号', name: 'invcode', width: 100, align: 'left' },
  145. { label: '料品名称', name: 'InvName', width: 100, align: 'left' },
  146. { label: '规格', name: 'InvStd', width: 100, align: 'left' },
  147. { label: '批号', name: 'BatchCode', width: 100, align: 'left' },
  148. // { label: '供应商批号', name: 'EATTRIBUTE3', width: 100, align: 'left' },
  149. { label: '领料数量', name: 'llqty', width: 100, align: 'left' },
  150. // { label: '领料日期', name: 'MTIME', width: 100, align: 'left' },
  151. { label: '入库数量', name: 'RKQTY', width: 100, align: 'left' },
  152. // { label: '入库日期', name: 'InDate', width: 100, align: 'left' },
  153. { label: '工单号', name: 'mocode', width: 100, align: 'left' },
  154. { label: '采购订单号', name: 'PODocNo', width: 100, align: 'left' },
  155. { label: '杂收单号', name: 'InCode', width: 100, align: 'left' },
  156. ],
  157. shrinkToFit: true,
  158. autowidth: true,
  159. rowNum: 10000,
  160. autoScroll: true,
  161. sortname: 'sort',
  162. sortorder: "asc",
  163. viewrecords: true,
  164. multiselect: false,
  165. gridComplete: function () {
  166. resizeGrid();
  167. }
  168. });
  169. }
  170. function resizeGrid() {
  171. var $activeTab = $('.tab-content:visible');
  172. var $grid = $activeTab.find('table');
  173. if ($grid.length) {
  174. $grid.jqGrid('setGridWidth', $activeTab.width());
  175. }
  176. }
  177. </script>
  178. <div class="topPanel" style="height:100px; position: relative;">
  179. <div class="toolbar">
  180. <div class="btn-group">
  181. <!-- 工具栏按钮(若有) -->
  182. </div>
  183. </div>
  184. <div class="search">
  185. <table>
  186. <tr>
  187. <td style="text-align:right;">
  188. <label class="lglabel" for="txt_Code">&nbsp;&nbsp;&nbsp;单据号</label>:
  189. </td>
  190. <td>
  191. <div class="input-group">
  192. <input id="txt_Code" type="text" class="form-control" style="width: 100px;">
  193. </div>
  194. </td>
  195. <td>
  196. <span class="input-group-btn">
  197. <button id="btn_search" type="button" class="btn btn-primary" onclick="Seach()">
  198. <i class="fa fa-search"></i>
  199. </button>
  200. </span>
  201. </td>
  202. </tr>
  203. </table>
  204. </div>
  205. <!-- 选项卡容器(居中 + 文字完整) -->
  206. <div class="tab-container">
  207. <input type="radio" id="tab1" name="tabs" checked data-target="tab-content1">
  208. <label for="tab1">成品信息</label>
  209. <input type="radio" id="tab2" name="tabs" data-target="tab-content2">
  210. <label for="tab2">领料信息</label>
  211. </div>
  212. </div>
  213. <div class="tab-content" id="tab-content1" >
  214. <table id="gridList"></table>
  215. </div>
  216. <div class="tab-content" id="tab-content2">
  217. <table id="gridList2"></table>
  218. </div>