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

169 lines
6.6 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. // 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. UserCode: $("#txt_UserCode").val(),
  41. UserName: $("#txt_UserName").val()
  42. }
  43. $gridList.dataGrid({
  44. url: "/WMS/UerList/GetUserList" + "?" + Math.random(),
  45. postData: { queryJson: JSON.stringify(queryJson) },
  46. height: $(window).height() - 180,
  47. width: $(window).width() - 400,
  48. colModel: [
  49. { label: "主键", name: "F_Id", hidden: true, key: true },
  50. { label: '角色', name: '角色', align: 'left', width: 100, },
  51. { label: '用户编码', name: '用户编码', align: 'left',width: 100, },
  52. { label: '用户名称', name: '用户名称', align: 'left', width: 180, },
  53. ],
  54. width: "100%",
  55. autowidth: true,
  56. gridComplete: function () {
  57. },
  58. //shrinkToFit: true,//宽度自适应
  59. pager: "#gridPager",
  60. sortname: '用户编码',
  61. sortorder: "desc",
  62. viewrecords: true,
  63. //multiselect: true,
  64. subGrid: true, // (1)开启子表格支持
  65. subGridRowExpanded: function (subgrid_id, rowid) { // (2)子表格容器的id和需要展开子表格的行id,将传入此事件函数
  66. $("#gridList").jqGrid("setSelection", rowid, false);
  67. bindSubGrid(subgrid_id, rowid)
  68. },
  69. });
  70. $("#btn_search").click(function () {
  71. var queryJson = {
  72. UserCode: $("#txt_UserCode").val(),
  73. UserName: $("#txt_UserName").val()
  74. }
  75. $gridList.jqGrid('setGridParam', {
  76. postData: { queryJson: JSON.stringify(queryJson) },
  77. }).trigger('reloadGrid');
  78. });
  79. }
  80. function bindSubGrid(subgrid_id, rowid) {
  81. $("#gridList").jqGrid("setSelection", rowid, false);
  82. var subgrid_table_id;
  83. subgrid_table_id = subgrid_id + "_t"; // (3)根据subgrid_id定义对应的子表格的table的id
  84. var subgrid_pager_id;
  85. subgrid_pager_id = subgrid_id + "_pgr" // (4)根据subgrid_id定义对应的子表格的pager的id
  86. // (5)动态添加子报表的table和pager
  87. $("#" + subgrid_id).html("<table id='" + subgrid_table_id + "' class='scroll'></table><div id='" + subgrid_pager_id + "' class='scroll'></div>");
  88. var queryJson = $("#gridList").jqGrid('getRowData', rowid).用户编码;
  89. // (6)创建jqGrid对象
  90. $("#" + subgrid_table_id).dataGrid({
  91. cellEdit: true,
  92. url: "/WMS/UerList/GetUserListDetails?queryJson=" + queryJson, // (7)子表格数据对应的url,注意传入的contact.id参数
  93. colModel: [
  94. { label: "主键", name: "ID", hidden: true, key: true },
  95. { label: "菜单名称", name: "菜单名称", width: 180, align: 'left' },
  96. { label: '操作人', name: 'F_CreatorTime', width: 180, align: 'left' },
  97. { label: '操作时间', name: 'F_RealName', width: 180, align: 'left' },
  98. ],
  99. sortname: '菜单名称',
  100. shrinkToFit: true,//宽度自适应
  101. prmNames: { search: "search" },
  102. pager: subgrid_pager_id,
  103. viewrecords: true,
  104. height: "100%",
  105. rowNum: 20
  106. });
  107. }
  108. function btn_ExportAll() {
  109. var postData = "&keyValue=1";
  110. if ($("#txt_UserCode").val() != null && $("#txt_UserCode").val() != "") {
  111. postData += "&UserCode=" + $("#txt_UserCode").val()
  112. }
  113. if ($("#txt_UserName").val() != null && $("#txt_UserName").val() != "") {
  114. postData += "&UserName=" + $("#txt_UserName").val()
  115. }
  116. $.download("/SRM/UerList/ExportAll" + "?" + Math.random(), postData, 'post');
  117. }
  118. </script>
  119. <div class="topPanel" style="height:50px">
  120. <div class="toolbar">
  121. <div class="btn-group">
  122. @*<a id="NF-Export" authorize="yes" class="btn btn-primary" onclick="btn_Export()"><i class="fa fa-download"></i>当前页导出</a>*@
  123. <a id="NF-ExportAll" authorize="yes" class="btn btn-primary" onclick="btn_ExportAll()"><i class="fa fa-download"></i>全部导出</a>
  124. <a class="btn btn-primary" onclick="$.reload()"><span class="glyphicon glyphicon-refresh"></span></a>
  125. </div>
  126. <script>$('.toolbar').authorizeButton()</script>
  127. </div>
  128. <div class="search">
  129. <table>
  130. <tr>
  131. <td>
  132. <label>用户编号:</label>
  133. </td>
  134. <td>
  135. <div class="input-group">
  136. <input id="txt_UserCode" type="text" class="form-control" placeholder="用户编号" style="width: 100px;">
  137. </div>
  138. </td>
  139. <td>
  140. <label>&nbsp;&nbsp;&nbsp;用户名称:</label>
  141. </td>
  142. <td>
  143. <div class="input-group">
  144. <input id="txt_UserName" type="text" class="form-control" placeholder="用户名称" style="width: 100px;">
  145. <span class="input-group-btn">
  146. <button id="btn_search" type="button" class="btn btn-primary"><i class="fa fa-search"></i></button>
  147. </span>
  148. </div>
  149. </td>
  150. </tr>
  151. </table>
  152. </div>
  153. </div>
  154. <div class="gridPanel">
  155. <table id="gridList"></table>
  156. <div id="gridPager"></div>
  157. </div>