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

133 lines
3.8 KiB

3 years ago
3 years ago
3 years ago
  1. @{
  2. ViewBag.Title = "Form";
  3. Layout = "~/Views/Shared/_Form.cshtml";
  4. }
  5. <link href="~/Content/css/CommonReport/CommonReport.css" rel="stylesheet" />
  6. <script src="~/Content/js/CommonReport/CommonReport.js"></script>
  7. <link href="~/Content/css/bootstrap/bootstrap-select.css" rel="stylesheet" />
  8. <script src="~/Content/js/bootstrap/bootstrap-select.min.js"></script>
  9. <style>
  10. * {
  11. box-sizing: border-box;
  12. }
  13. </style>
  14. <script>
  15. var ColsName = $.request("ColsName");
  16. var SourceID = $.request("SourceID");
  17. var ReturnCol = $.request("ReturnCol");
  18. var cols = new Array();
  19. var gridData = new Array();
  20. $(function () {
  21. GetDate();
  22. // gridList();
  23. $(window).resize(function () {
  24. $("#gridList").setGridWidth($(window).width() * 0.99);
  25. $("#gridList").setGridWidth(document.body.clientWidth * 0.99);
  26. $("#gridList").setGridHeight($(window).height() - 98);
  27. $("#gridList").setGridHeight(document.body.clientHeight - 98);
  28. });
  29. });
  30. function GetDate() {
  31. $.ajax({
  32. url: "/SystemManage/CommonReport/GetColsSelectGrid?SourceID=" + SourceID + "&ColsName=" + escape(ColsName) + "&InputKey=" + escape($("#InputKey").val()) + "&" + Math.random(),
  33. dataType: "json",
  34. async: false,
  35. success: function (data) {
  36. if (data != false && data != null) {
  37. cols = eval(data.cols);
  38. gridData = eval(data.gridData);
  39. gridList();
  40. }
  41. else {
  42. alert("获取栏位信息异常:" + data);
  43. }
  44. },
  45. error: function (aa) {
  46. //alert("异常:" + aa.responseText);
  47. $.modalAlertNew("WMS00015", aa.responseText);
  48. }
  49. });
  50. }
  51. function gridList() {
  52. document.getElementById("gridPanel").innerHTML = ' <table id="gridList"></table> ';//重置grid
  53. var $gridList = $("#gridList");
  54. $gridList.dataGrid({
  55. height: $(window).height() - 98,
  56. datatype: "local",
  57. colModel: cols,
  58. rowNum: 500,
  59. data: gridData,
  60. viewrecords: true,
  61. rownumbers: true,
  62. multiselect: true,
  63. gridComplete: function () {
  64. }
  65. });
  66. }
  67. function KeydownData()
  68. {
  69. var evt = window.event || e;
  70. if (evt.keyCode == 13){
  71. GetDate();
  72. }
  73. }
  74. function submitForm() {
  75. var RowDatas = $("#gridList").jqGrid('getDataIDs');
  76. var ids = $("#gridList").jqGrid('getGridParam', 'selarrrow'); //获取 多行数据
  77. if (ids.length <= 0 || ids.length > 1) {
  78. $.modalAlertNew("WMS00003");
  79. return;
  80. }
  81. var RowData = $("#gridList").jqGrid('getRowData', ids[0]);
  82. var vv = RowData[ReturnCol].toString();
  83. return vv;
  84. }
  85. function Close() {
  86. $.modalClose();
  87. }
  88. function btn_Search() {
  89. GetDate();
  90. }
  91. </script>
  92. <form id="form1">
  93. <div style="margin-top: 10px; margin-left: 10px; margin-right: 10px;">
  94. <table class="form">
  95. <tr>
  96. <td class="formValue" style="width:200px">
  97. <input type="text" name="InputKey" class="form-control" id="InputKey" style="width:180px" onkeydown="KeydownData()" />
  98. <input style="display:none" mce_style="display:none">
  99. </td>
  100. <td>
  101. <a id="Btn_Search" authorize="yes" class="btn btn-primary dropdown-text " onclick="btn_Search()"><i class="fa fa-search"></i></a>
  102. </td>
  103. </tr>
  104. </table>
  105. <div class="gridPanel" id="gridPanel">
  106. <table id="gridList"></table>
  107. @*<div id="gridPager"></div>*@
  108. </div>
  109. </div>
  110. </form>