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.

144 lines
5.4 KiB

3 weeks ago
  1. @{
  2. ViewBag.Title = "Index";
  3. Layout = "~/Views/Shared/_Index.cshtml";
  4. }
  5. <script src="~/Content/js/CommonReport/CommonReport.js"></script>
  6. <script src="~/Content/js/datepicker/WdatePicker.js"></script>
  7. <script>
  8. debugger;
  9. var _Closs = new Array();
  10. // 创建一个新的 Date 对象,表示当前日期和时间
  11. var currentDate = new Date();
  12. // 获取当前月份(注意:月份是从0开始计数的)
  13. var currentMonth = currentDate.getMonth() + 1; // 加1以符合人类习惯
  14. var currentyear = currentDate.getFullYear();
  15. var currentDay = currentDate.getDate();
  16. $(function () {
  17. $("#txt_DateNow").val(currentyear + "-" + currentMonth + "-01")
  18. $("#txt_DateNow1").val(currentyear + "-" + currentMonth + "-" + currentDay)
  19. SetCols();
  20. gridList();
  21. $("#btn_search").click(function () {
  22. currentDate = new Date($("#txt_DateNow").val());
  23. currentMonth = currentDate.getMonth() + 1; // 加1以符合人类习惯
  24. currentyear = currentDate.getFullYear();
  25. currentDay = currentDate.getDate();
  26. SetCols();
  27. gridList();
  28. });
  29. })
  30. //初始化所有grid
  31. function SetCols() {
  32. var cols = new Array();
  33. var collast = { label: '料品编码', name: 'InvCode', width: 100, align: 'left' };
  34. cols.push(collast);
  35. var collast = { label: '料品名称', name: 'InvName', width: 150, align: 'left', };
  36. cols.push(collast);
  37. var collast = { label: '供应商编码', name: 'VenCode', width: 100, align: 'left' };
  38. cols.push(collast);
  39. var collast = { label: '供应商名称', name: 'VenName', width: 200, align: 'left', };
  40. cols.push(collast);
  41. var BeginTime = $("#txt_DateNow").val();
  42. var EndTime = $("#txt_DateNow1").val();
  43. $.ajax({
  44. url: "/KBSWMS/ICSInspectionReports/SelectTableColumnName?BeginTime=" + BeginTime + "&EndTime=" + EndTime+"&"+ Math.random(),
  45. dataType: "json",
  46. async: false,
  47. success: function (data) {
  48. if (data != null && data.length > 0) {
  49. for (var i = 0; i < data.length; i++) {
  50. var Code = data[i].DateValue;
  51. var Name = data[i].DateValue;
  52. var obj = new Array();
  53. obj = {
  54. label: Name,
  55. name: Code,
  56. width: 100,
  57. align: "left"
  58. }
  59. cols.push(obj);
  60. }
  61. }
  62. _Closs = cols;
  63. }
  64. });
  65. }
  66. function gridList() {
  67. debugger;
  68. document.getElementById("gridPanel").innerHTML = '<table id="gridList"></table><div id="gridPager"></div> ';//重置grid
  69. var $gridList = $("#gridList");
  70. var queryJson = {
  71. DateNow: $("#txt_DateNow").val(),
  72. DateNow1: $("#txt_DateNow1").val(),
  73. }
  74. // 初始化表格
  75. $gridList.dataGrid({
  76. url: "/KBSWMS/ICSInspectionReports/GetVenDeliveries" + "?" + Math.random(),
  77. postData: { queryJson: JSON.stringify(queryJson) },
  78. height: $(window).height() - 128,
  79. width: $(window).width() - 128,
  80. colModel: _Closs,
  81. rownumbers: false,
  82. rowNum: 200000,
  83. footerrow: true,//启用底部行(对列汇总时要启用)第一步
  84. //gridComplete: function () {
  85. // var gridName = "gridList";
  86. // Merger(gridName, '供应商');
  87. //},
  88. Number: 1000
  89. });
  90. // 搜索按钮点击事件
  91. }
  92. function btn_Export() {
  93. var data = "&BeginTime=" + $("#txt_DateNow").val() + "&EndTime=" + $("#txt_DateNow1").val();
  94. $.download("/KBSWMS/ICSInspectionReports/ExportAll8?" + Math.random(), data, 'post');
  95. }
  96. </script>
  97. <iframe id="ifrm" src="" width="0" height="0"></iframe>
  98. <div class="topPanel" style="height:50px">
  99. <div class="toolbar">
  100. <div class="btn-group">
  101. <a class="btn btn-primary" id="btn_search"><span class="glyphicon glyphicon-refresh"></span></a>
  102. <a id="NF-Export" authorize="yes" class="btn btn-primary" onclick="btn_Export()"><i class="fa fa-download"></i>当前页导出</a>
  103. </div>
  104. </div>
  105. <div class="search">
  106. <table>
  107. <tr>
  108. <th class="formTitle">
  109. <span style="color: red;">*</span>开始日期:
  110. </th>
  111. <td class="formValue">
  112. <input type="text" name="txt_DateNow" id="txt_DateNow" class="form-control" style="width: 100px;height:13px" maxlength="10" onclick="WdatePicker({ dateFmt: 'yyyy-MM-dd' })" placeholder="日期" />
  113. </td>
  114. <th class="formTitle">
  115. <span style="color: red;">*</span>结束日期:
  116. </th>
  117. <td class="formValue">
  118. <input type="text" name="txt_DateNow1" id="txt_DateNow1" class="form-control" style="width: 100px;height:13px" maxlength="10" onclick="WdatePicker({ dateFmt: 'yyyy-MM-dd' })" placeholder="日期" />
  119. </td>
  120. </tr>
  121. </table>
  122. </div>
  123. </div>
  124. <div class="gridPanel" id="gridPanel">
  125. <table id="gridList"></table>
  126. <div id="gridPager"></div>
  127. </div>