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

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