纽威
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.

241 lines
9.7 KiB

2 years ago
  1. @{
  2. ViewBag.Title = "Index";
  3. Layout = "~/Views/Shared/_Index.cshtml";
  4. }
  5. <script src="~/Content/js/datepicker/WdatePicker.js"></script>
  6. <script>
  7. $(document).ready(function () {
  8. $("input.cell").keyup(function (e) {
  9. switch (e.keyCode) {
  10. case 40:
  11. $(this).parent()
  12. .parent()
  13. .next()
  14. .children("td")
  15. .children("input.cell[name="
  16. + $(this).attr("name") + "]")
  17. .focus();
  18. break;
  19. case 38:
  20. $(this).parent()
  21. .parent()
  22. .prev()
  23. .children("td")
  24. .children("input.cell[name="
  25. + $(this).attr("name") + "]")
  26. .focus();
  27. break;
  28. }
  29. });
  30. });</script>
  31. <script>
  32. $(function () {
  33. gridList();
  34. })
  35. function gridList() {
  36. var $gridList = $("#gridList");
  37. var queryJson = {
  38. InvCode: $("#txt_InvCode").val(),
  39. GroupCode: $("#txt_GroupCode").val(),
  40. GroupName: $("#txt_GroupName").val(),
  41. }
  42. $gridList.dataGrid({
  43. url: "/WMS/BasicSettings/GetICSInventoryInspectionGroup" + "?" + Math.random(),
  44. postData: { queryJson: JSON.stringify(queryJson) },
  45. height: $(window).height() - 200,
  46. width: $(window).width() - 300,
  47. colModel: [
  48. { label: "主键", name: "ID", hidden: true, key: true },
  49. { label: '料品代码', name: 'InvCode', width: 120, align: 'left' },
  50. { label: '料品检验项目组代码', name: 'GroupCode', width: 150, align: 'left' },
  51. { label: '料品检验项目组名称', name: 'GroupName', width: 100, align: 'left' },
  52. { label: '是否启用', name: 'Enable', width: 100, align: 'left' },
  53. { label: '操作人名称', name: 'MUSERName', width: 200, align: 'left' },
  54. { label: '操作时间', name: 'MTIME', width: 200, align: 'left' },
  55. { label: '站点', name: 'WorkPoint', width: 200, align: 'left' },
  56. ],
  57. shrinkToFit: false,//宽度自适应
  58. autoWidth:true,
  59. gridComplete: function () {
  60. },
  61. pager: "#gridPager",
  62. sortorder: "desc",
  63. sortname: 'InvCode',
  64. viewrecords: true,
  65. multiselect: true,
  66. subGrid: true, // (1)开启子表格支持
  67. subGridRowExpanded: function (subgrid_id, rowid) { // (2)子表格容器的id和需要展开子表格的行id,将传入此事件函数
  68. debugger;
  69. $("#gridList").jqGrid("setSelection", rowid, false);
  70. bindSubGrid(subgrid_id, rowid)
  71. }
  72. });
  73. $("#btn_search").click(function () {
  74. var warehouse = $("#warehouse a.active").attr('data-value');
  75. var queryJson = {
  76. InvCode: $("#txt_InvCode").val(),
  77. GroupCode: $("#txt_GroupCode").val(),
  78. GroupName: $("#txt_GroupName").val(),
  79. }
  80. $gridList.jqGrid('setGridParam', {
  81. postData: { queryJson: JSON.stringify(queryJson) },
  82. }).trigger('reloadGrid');
  83. });
  84. }
  85. function bindSubGrid(subgrid_id, rowid) {
  86. debugger;
  87. $("#gridList").jqGrid("setSelection", rowid, false);
  88. var subgrid_table_id;
  89. subgrid_table_id = subgrid_id + "_t"; // (3)根据subgrid_id定义对应的子表格的table的id
  90. var subgrid_pager_id;
  91. subgrid_pager_id = subgrid_id + "_pgr" // (4)根据subgrid_id定义对应的子表格的pager的id
  92. // (5)动态添加子报表的table和pager
  93. $("#" + subgrid_id).html("<table id='" + subgrid_table_id + "' class='scroll'></table><div id='" + subgrid_pager_id + "' class='scroll'></div>");
  94. var ID = $("#gridList").jqGrid('getRowData', rowid).ID;
  95. // (6)创建jqGrid对象
  96. $("#" + subgrid_table_id).dataGrid({
  97. cellEdit: true,
  98. url: "/WMS/BasicSettings/ICSInventoryInspectionList?ID=" + ID + "&" + Math.random(), // (7)子表格数据对应的url,注意传入的contact.id参数
  99. colModel: [
  100. { label: "主键", name: "ID", hidden: true, key: true },
  101. { label: "检验项目代码", name: "ListCode", width: 150, align: 'left' },
  102. { label: "检验项目名称", name: "ListName", width: 150, align: 'left' },
  103. { label: '单位', name: 'Unit', width: 100, align: 'left' },
  104. { label: '标准上限', name: 'SetValueMax', width: 100, align: 'left' },
  105. { label: '标准下限', name: 'SetValueMin', width: 100, align: 'left' },
  106. { label: '是否启用', name: 'Enable', width: 100, align: 'left' },
  107. { label: '操作人名称', name: 'MUSERName', width: 150, align: 'left' },
  108. { label: '操作时间', name: 'MTIME', width: 150, align: 'left' },
  109. ],
  110. sortname: 'MTIME',
  111. shrinkToFit: true,//宽度自适应
  112. //multiselect: true,
  113. prmNames: { search: "search" },
  114. viewrecords: true,
  115. height: "100%",
  116. rowNum: 20,
  117. pager: subgrid_pager_id,
  118. });
  119. }
  120. function btn_Delete() {
  121. var objArr = '';
  122. var objList = $("#gridList").jqGrid('getGridParam', 'selarrrow');
  123. for (var i = 0; i < objList.length; i++) {
  124. var rowId = objList[i];
  125. var rowData = $("#gridList").jqGrid('getRowData', rowId);
  126. objArr += "'" + rowData.ID + "',";
  127. }
  128. if (objArr == '') {
  129. $.modalAlertNew("WMS00001");
  130. return;
  131. }
  132. $.deleteForm({
  133. url: "/WMS/BasicSettings/DeleteICSInventoryInspectionGroup" + "?" + Math.random(),
  134. param: { keyValue: JSON.stringify(objArr) },
  135. success: function () {
  136. $.currentWindow().$("#gridList").trigger("reloadGrid");
  137. }
  138. })
  139. }
  140. //修改类型
  141. function btn_update() {
  142. debugger;
  143. var ids = $("#gridList").jqGrid('getGridParam', 'selarrrow'); //获取 多行数据
  144. if (ids.length != 1) {
  145. $.modalAlertNew("WMS00006");
  146. return;
  147. }
  148. for (var i in ids) {
  149. var rowData = jQuery("#gridList").jqGrid("getRowData", ids[i]);
  150. //ID
  151. var ID = rowData.ID;
  152. var InvCode = rowData.InvCode;
  153. var GroupName = rowData.GroupName;
  154. $.modalOpen({
  155. id: "Details",
  156. title: "修改",
  157. url: "/WMS/BasicSettings/ICSInventoryInspectionGroupAdd?ID=" + ID + "&InvCode=" + InvCode + "&GroupName=" + encodeURI(encodeURI(GroupName)) + "&" + Math.random(),
  158. width: "900px",
  159. height: "800px",
  160. callBack: function (iframeId) {
  161. top.frames[iframeId].submitForm();
  162. }
  163. });
  164. }
  165. }
  166. function btnCreate() {
  167. $.modalOpen({
  168. id: "InventoryInspectionGroupAdd",
  169. title: "新增",
  170. url: "/WMS/BasicSettings/ICSInventoryInspectionGroupAdd" + "?" + Math.random(),
  171. width: "900px",
  172. height: "800px",
  173. callBack: function (iframeId) {
  174. top.frames[iframeId].submitForm();
  175. }
  176. });
  177. }
  178. </script>
  179. <div class="topPanel" style="height:60px">
  180. <div class="toolbar">
  181. <div class="btn-group">
  182. <a id="NF-Create" authorize="yes" class="btn btn-primary" onclick="btnCreate()"><i class="fa fa-pencil-square-o"></i>新增</a>
  183. <a id="NF-update" authorize="yes" class="btn btn-primary" onclick="btn_update()"><i class="fa fa-pencil-square-o"></i>修改</a>
  184. <a id="NF-Delete" authorize="yes" class="btn btn-primary" onclick="btn_Delete()"><i class="fa fa-trash-o"></i>删除</a>
  185. <a class="btn btn-primary" onclick="$.reload()"><span class="glyphicon glyphicon-refresh"></span></a>
  186. </div>
  187. </div>
  188. <div class="search">
  189. <table>
  190. <tr>
  191. <td style="text-align:right;"><label class="lglabel" for="txt_InvCode">料品代码</label>:</td>
  192. <td>
  193. <div class="input-group">
  194. <input id="txt_InvCode" type="text" class="form-control" style="width: 100px;">
  195. </div>
  196. </td>
  197. <td style="width:20px"></td>
  198. <td style="text-align:right;"><label class="lglabel" for="txt_GroupCode">料品检验项目组代码</label>:</td>
  199. <td>
  200. <div class="input-group">
  201. <input id="txt_GroupCode" type="text" class="form-control" style="width: 100px;">
  202. </div>
  203. </td>
  204. <td style="width:20px"></td>
  205. <td style="text-align:right;"><label class="lglabel" for="txt_GroupName">料品检验项目组名称</label>:</td>
  206. <td>
  207. <div class="input-group">
  208. <input id="txt_GroupName" type="text" class="form-control" style="width: 100px;">
  209. </div>
  210. </td>
  211. <td>
  212. <span class="input-group-btn">
  213. <button id="btn_search" type="button" class="btn btn-primary"><i class="fa fa-search"></i></button>
  214. </span>
  215. </td>
  216. </tr>
  217. </table>
  218. </div>
  219. </div>
  220. <div class="gridPanel">
  221. <table id="gridList"></table>
  222. <div id="gridPager"></div>
  223. </div>