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

132 lines
3.8 KiB

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. }
  48. });
  49. }
  50. function gridList() {
  51. document.getElementById("gridPanel").innerHTML = ' <table id="gridList"></table> ';//重置grid
  52. var $gridList = $("#gridList");
  53. $gridList.dataGrid({
  54. height: $(window).height() - 98,
  55. datatype: "local",
  56. colModel: cols,
  57. rowNum: 500,
  58. data: gridData,
  59. viewrecords: true,
  60. rownumbers: true,
  61. multiselect: true,
  62. gridComplete: function () {
  63. }
  64. });
  65. }
  66. function KeydownData()
  67. {
  68. var evt = window.event || e;
  69. if (evt.keyCode == 13){
  70. GetDate();
  71. }
  72. }
  73. function submitForm() {
  74. var RowDatas = $("#gridList").jqGrid('getDataIDs');
  75. var ids = $("#gridList").jqGrid('getGridParam', 'selarrrow'); //获取 多行数据
  76. if (ids.length <= 0 || ids.length > 1) {
  77. $.modalAlert("请选择一行数据!");
  78. return;
  79. }
  80. var RowData = $("#gridList").jqGrid('getRowData', ids[0]);
  81. var vv = RowData[ReturnCol].toString();
  82. return vv;
  83. }
  84. function Close() {
  85. $.modalClose();
  86. }
  87. function btn_Search() {
  88. GetDate();
  89. }
  90. </script>
  91. <form id="form1">
  92. <div style="margin-top: 10px; margin-left: 10px; margin-right: 10px;">
  93. <table class="form">
  94. <tr>
  95. <td class="formValue" style="width:200px">
  96. <input type="text" name="InputKey" class="form-control" id="InputKey" style="width:180px" onkeydown="KeydownData()" />
  97. <input style="display:none" mce_style="display:none">
  98. </td>
  99. <td>
  100. <a id="Btn_Search" authorize="yes" class="btn btn-primary dropdown-text " onclick="btn_Search()"><i class="fa fa-search"></i></a>
  101. </td>
  102. </tr>
  103. </table>
  104. <div class="gridPanel" id="gridPanel">
  105. <table id="gridList"></table>
  106. @*<div id="gridPager"></div>*@
  107. </div>
  108. </div>
  109. </form>