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

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