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.

118 lines
4.3 KiB

1 month ago
  1. @{
  2. ViewBag.Title = "Index";
  3. Layout = "~/Views/Shared/_Index.cshtml";
  4. }
  5. <style>
  6. .td {
  7. padding: 0 5px 0 5px;
  8. }
  9. </style>
  10. <script>
  11. var WorkPoints = $.request("WorkPoint");
  12. $(function () {
  13. gridList();
  14. })
  15. function gridList() {
  16. var $gridList = $("#gridList");
  17. var queryJson = {
  18. INVCODE: $("#txt_InvCode").val(),
  19. INVNAME: $("#txt_InvName").val(),
  20. }
  21. $gridList.dataGrid({
  22. url: "/SRM/BicDoc_Publish/GetItemList" + "?" + Math.random(),
  23. postData: { queryJson: JSON.stringify(queryJson), WorkPoint: JSON.stringify(WorkPoints) },
  24. height: $(window).height() - 120,
  25. width: $(window).width() - 180,
  26. colModel: [
  27. { label: "主键", name: "ID", hidden: true, key: true },
  28. { label: '物料编码', name: 'INVCODE', width: 240, align: 'left' },
  29. { label: '规格型号', name: 'InvStd', width: 240, align: 'left' },
  30. { label: '物料名称', name: 'INVNAME', width: 150, align: 'left' },
  31. { label: "单位", name: "INVUOM", width: 150, align: 'left' },
  32. { label: '来源', name: 'Source', width: 220, align: 'left' },
  33. ],
  34. sortname: 'INVCODE,INVNAME',
  35. shrinkToFit: true,//宽度自适应
  36. pager: "#gridPager",
  37. //sortname: 'ID',
  38. viewrecords: true,
  39. multiselect: true,
  40. rowNum: 200
  41. });
  42. $("#btn_search").click(function () {
  43. var queryJson = {
  44. INVCODE: $("#txt_InvCode").val(),
  45. INVNAME: $("#txt_InvName").val(),
  46. }
  47. $gridList.jqGrid('setGridParam', {
  48. postData: { queryJson: JSON.stringify(queryJson) },
  49. page: 1
  50. }).trigger('reloadGrid');
  51. });
  52. }
  53. //提交
  54. function submitForm() {
  55. //提交
  56. var ids = $("#gridList").jqGrid('getGridParam', 'selarrrow'); //获取 多行数据
  57. var objs = [];
  58. for (var i = 0; i < ids.length; i++) {
  59. var obj = {
  60. ID: GUID(),
  61. INVCODE: $("#gridList").jqGrid('getRowData', ids[i]).INVCODE,
  62. INVNAME: $("#gridList").jqGrid('getRowData', ids[i]).INVNAME,
  63. Quantity: null,
  64. INVUOM: $("#gridList").jqGrid('getRowData', ids[i]).INVUOM,
  65. DeliveryTime: null,
  66. Source: $("#gridList").jqGrid('getRowData', ids[i]).Source,
  67. InvStd: $("#gridList").jqGrid('getRowData', ids[i]).InvStd
  68. };
  69. objs.push(obj);
  70. }
  71. return objs;
  72. }
  73. function GUID() {
  74. return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
  75. var r = Math.random() * 16 | 0, v = c == 'x' ? r : (r & 0x3 | 0x8);
  76. return v.toString(16);
  77. });
  78. }
  79. </script>
  80. <form id="form1">
  81. <div class="topPanel" style="height:50px">
  82. <div class="search">
  83. <table>
  84. <tr>
  85. <td style="text-align:right;padding: 0 5px 0 5px;">
  86. <label>物料编码:</label>
  87. </td>
  88. <td>
  89. <div class="input-group">
  90. <input id="txt_InvCode" type="text" class="form-control" placeholder="物料编码" style="width: 100px;">
  91. </div>
  92. </td>
  93. <td style="text-align:right;padding: 0 5px 0 5px;">
  94. <label>物料名称:</label>
  95. </td>
  96. <td>
  97. <div class="input-group">
  98. <input id="txt_InvName" type="text" class="form-control" placeholder="物料名称" style="width: 100px;">
  99. </div>
  100. </td>
  101. <td>
  102. <span class="input-group-btn" style="padding-left:10px;">
  103. <button id="btn_search" type="button" class="btn btn-primary"><i class="fa fa-search"></i></button>
  104. </span>
  105. </td>
  106. </tr>
  107. </table>
  108. </div>
  109. </div>
  110. <div class="gridPanel">
  111. <table id="gridList"></table>
  112. <div id="gridPager"></div>
  113. </div>
  114. </form>