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

227 lines
8.8 KiB

3 years ago
3 years ago
3 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. BadCode: $("#txt_BadCode").val(),
  39. BadCodeName: $("#txt_BadCodeName").val(),
  40. }
  41. $gridList.dataGrid({
  42. url: "/WMS/BasicSettings/GetICSBadCodeGroup" + "?" + Math.random(),
  43. postData: { queryJson: JSON.stringify(queryJson) },
  44. height: $(window).height() - 200,
  45. width: $(window).width() - 300,
  46. colModel: [
  47. { label: "主键", name: "ID", hidden: true, key: true },
  48. { label: 'ID', name: 'ID', hidden: true },
  49. { label: '不良代码组编码', name: 'BCGCode', width: 120, align: 'left' },
  50. { label: '不良代码组描述', name: 'BCGDesc', width: 150, align: 'left' },
  51. { label: '操作人', name: 'MUSER', width: 100, align: 'left' },
  52. { label: '操作人名称', name: 'MUSERName', width: 200, align: 'left' },
  53. { label: '操作时间', name: 'MTIME', width: 200, align: 'left' },
  54. // { label: "Free1", name: "Free1", hidden: true },
  55. ],
  56. shrinkToFit: false,//宽度自适应
  57. autoWidth:true,
  58. gridComplete: function () {
  59. },
  60. pager: "#gridPager",
  61. sortorder: "desc",
  62. sortname: 'BCGCode ',
  63. viewrecords: true,
  64. multiselect: true,
  65. subGrid: true, // (1)开启子表格支持
  66. subGridRowExpanded: function (subgrid_id, rowid) { // (2)子表格容器的id和需要展开子表格的行id,将传入此事件函数
  67. debugger;
  68. $("#gridList").jqGrid("setSelection", rowid, false);
  69. bindSubGrid(subgrid_id, rowid)
  70. }
  71. });
  72. $("#btn_search").click(function () {
  73. var warehouse = $("#warehouse a.active").attr('data-value');
  74. var queryJson = {
  75. BadCode: $("#txt_BadCode").val(),
  76. BadCodeName: $("#txt_BadCodeName").val(),
  77. }
  78. $gridList.jqGrid('setGridParam', {
  79. postData: { queryJson: JSON.stringify(queryJson) },
  80. }).trigger('reloadGrid');
  81. });
  82. }
  83. function bindSubGrid(subgrid_id, rowid) {
  84. debugger;
  85. $("#gridList").jqGrid("setSelection", rowid, false);
  86. var subgrid_table_id;
  87. subgrid_table_id = subgrid_id + "_t"; // (3)根据subgrid_id定义对应的子表格的table的id
  88. var subgrid_pager_id;
  89. subgrid_pager_id = subgrid_id + "_pgr" // (4)根据subgrid_id定义对应的子表格的pager的id
  90. // (5)动态添加子报表的table和pager
  91. $("#" + subgrid_id).html("<table id='" + subgrid_table_id + "' class='scroll'></table><div id='" + subgrid_pager_id + "' class='scroll'></div>");
  92. var ID = $("#gridList").jqGrid('getRowData', rowid).ID;
  93. // (6)创建jqGrid对象
  94. $("#" + subgrid_table_id).dataGrid({
  95. cellEdit: true,
  96. url: "/WMS/BasicSettings/GetICSBadCodeGroupdetil?ID=" + ID + "&" + Math.random(), // (7)子表格数据对应的url,注意传入的contact.id参数
  97. colModel: [
  98. { label: "主键", name: "ID", hidden: true, key: true },
  99. { label: "不良代码组唯一标识", name: "BCGroupID", width: 150, align: 'left' },
  100. { label: "不良代码编码", name: "BadCode", width: 150, align: 'left' },
  101. { label: '不良代码描述', name: 'BadDesc', width: 100, align: 'left' },
  102. { label: '操作人名称', name: 'MUSERName', width: 150, align: 'left' },
  103. { label: '操作时间', name: 'MTIME', width: 150, align: 'left' },
  104. ],
  105. sortname: 'MTIME',
  106. shrinkToFit: true,//宽度自适应
  107. //multiselect: true,
  108. prmNames: { search: "search" },
  109. viewrecords: true,
  110. height: "100%",
  111. rowNum: 20,
  112. pager: subgrid_pager_id,
  113. });
  114. }
  115. function btn_Delete() {
  116. var objArr = '';
  117. var objList = $("#gridList").jqGrid('getGridParam', 'selarrrow');
  118. for (var i = 0; i < objList.length; i++) {
  119. var rowId = objList[i];
  120. var rowData = $("#gridList").jqGrid('getRowData', rowId);
  121. objArr += "'" + rowData.ID + "',";
  122. }
  123. if (objArr == '') {
  124. $.modalAlert("请选择一项进行删除!");
  125. return;
  126. }
  127. $.deleteForm({
  128. url: "/WMS/BasicSettings/DeleteICSBadCodeGroup" + "?" + Math.random(),
  129. param: { keyValue: JSON.stringify(objArr) },
  130. success: function () {
  131. $.currentWindow().$("#gridList").trigger("reloadGrid");
  132. }
  133. })
  134. }
  135. //修改类型
  136. function btn_update() {
  137. debugger;
  138. var ids = $("#gridList").jqGrid('getGridParam', 'selarrrow'); //获取 多行数据
  139. if (ids.length != 1) {
  140. $.modalAlert("请选择一行数据进行修改!");
  141. return;
  142. }
  143. for (var i in ids) {
  144. var rowData = jQuery("#gridList").jqGrid("getRowData", ids[i]);
  145. //ID
  146. var ID = rowData.ID;
  147. var BRGCode = rowData.BCGCode;
  148. var BRGDesc = rowData.BCGDesc;
  149. $.modalOpen({
  150. id: "Details",
  151. title: "修改",
  152. url: "/WMS/BasicSettings/ICSBadCodeAdd?ID=" + ID + "&BRGCode=" + BRGCode + "&BRGDesc=" + encodeURI(encodeURI(BRGDesc)) + "&" + Math.random(),
  153. width: "900px",
  154. height: "800px",
  155. callBack: function (iframeId) {
  156. top.frames[iframeId].submitForm();
  157. }
  158. });
  159. }
  160. }
  161. function btnCreate() {
  162. $.modalOpen({
  163. id: "ICSBadCodeAdd",
  164. title: "新增",
  165. url: "/WMS/BasicSettings/ICSBadCodeAdd" + "?" + Math.random(),
  166. width: "900px",
  167. height: "800px",
  168. callBack: function (iframeId) {
  169. top.frames[iframeId].submitForm();
  170. }
  171. });
  172. }
  173. </script>
  174. <div class="topPanel" style="height:60px">
  175. <div class="toolbar">
  176. <div class="btn-group">
  177. <a id="NF-Create" authorize="yes" class="btn btn-primary" onclick="btnCreate()"><i class="fa fa-pencil-square-o"></i>新增</a>
  178. <a id="NF-update" authorize="yes" class="btn btn-primary" onclick="btn_update()"><i class="fa fa-pencil-square-o"></i>修改</a>
  179. <a id="NF-Delete" authorize="yes" class="btn btn-primary" onclick="btn_Delete()"><i class="fa fa-trash-o"></i>删除</a>
  180. </div>
  181. </div>
  182. <div class="search">
  183. <table>
  184. <tr>
  185. <td style="text-align:right;"><label class="lglabel" for="txt_POCode">不良代码编号</label>:</td>
  186. <td>
  187. <div class="input-group">
  188. <input id="txt_BadCode" type="text" class="form-control" style="width: 100px;">
  189. </div>
  190. </td>
  191. <td style="width:20px"></td>
  192. <td style="text-align:right;"><label class="lglabel" for="txt_POCode">不良代码描述</label>:</td>
  193. <td>
  194. <div class="input-group">
  195. <input id="txt_BadCodeName" type="text" class="form-control" style="width: 100px;">
  196. </div>
  197. </td>
  198. <td>
  199. <span class="input-group-btn">
  200. <button id="btn_search" type="button" class="btn btn-primary"><i class="fa fa-search"></i></button>
  201. </span>
  202. </td>
  203. </tr>
  204. </table>
  205. </div>
  206. </div>
  207. <div class="gridPanel">
  208. <table id="gridList"></table>
  209. <div id="gridPager"></div>
  210. </div>