viewReport.jsp 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222
  1. <%@ page language="java" contentType="text/html; charset=GBK" pageEncoding="GBK"%>
  2. <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
  3. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  4. <html>
  5. <head>
  6. <meta http-equiv="Content-Type" content="text/html; charset=GBK">
  7. <title>报表</title>
  8. <script type=text/javascript src="/shares/js/jquery-1.5.1.min.js"></script>
  9. <script type="text/javascript" src="/shares/js/constant.js"></script>
  10. <script type="text/javascript" src="/shares/js/common.js"></script>
  11. <link href="main.css" rel="stylesheet" type="text/css"></link>
  12. <link href="${pageContext.request.contextPath}//liger/lib/ligerUI/skins/${sessionScope.css}/css/ligerui-all.css" rel="stylesheet" type="text/css" />
  13. <script src="${pageContext.request.contextPath}/liger/lib/ligerUI/js/ligerui.all.js" type="text/javascript"></script>
  14. <script type="text/javascript" src="/shares/datePicker/WdatePicker.js"></script>
  15. <script type="text/javascript" src="/shares/js/constant.js"></script>
  16. <script type="text/javascript" src="/shares/js/common.js"></script>
  17. <script type="text/javascript" src="/shares/js/xdate.js"></script>
  18. <script type="text/javascript">
  19. $(function() {
  20. $("#reportHtml").height(getParentHeight() - 80);
  21. initDate();
  22. });
  23. function exportReport(ext) {
  24. //begin qianqw 20150511
  25. submitAUrl("toReprotAction.do?method=" + ext + "&report_id=${report_id}");
  26. //end
  27. }
  28. function pagePrevReport() {
  29. var pi = $("#pageIndex").val();
  30. if (pi == "")
  31. pi = "0";
  32. pi = parseInt(pi) - 1;
  33. $("#pageIndex").val(pi);
  34. submitTargetAUrl(
  35. "toReprotAction.do?method=toHtml&key=${key}&report_id=${report_id}&pageIndex=" + pi,
  36. "reportHtml");
  37. }
  38. function pageNextReport() {
  39. var pi = $("#pageIndex").val();
  40. if (pi == "")
  41. pi = "0";
  42. pi = parseInt(pi) + 1;
  43. $("#pageIndex").val(pi);
  44. submitTargetAUrl(
  45. "toReprotAction.do?method=toHtml&key=${key}&report_id=${report_id}&pageIndex=" + pi,
  46. "reportHtml");
  47. }
  48. function searchReport() {
  49. if(validate()){
  50. var url = "";
  51. $(".list_search input[type='text'],.list_search select").each(
  52. function() {
  53. var name = $(this).attr("name");
  54. var value = $(this).val();
  55. url = url + "&" + name + "=" + encodeURI(value);
  56. });
  57. submitTargetAUrl("toReprotAction.do?method=toHtml&key=${key}&report_id=${report_id}&pageIndex=0" + url,
  58. "reportHtml");
  59. }
  60. }
  61. /**
  62. * 点查询时验证
  63. * 要验证控件的class中加入:
  64. * 1、valid_notempty 验证非空
  65. */
  66. function validate(){
  67. var rs = true;
  68. var str = "";
  69. $(".notempty").each(function(index,value){
  70. if(this.value == ""){
  71. str += $(this).parent().prev().children('span').text()+"不能为空\n";
  72. rs = false;
  73. }
  74. });
  75. if(!rs){
  76. alert(str);
  77. }
  78. return rs;
  79. }
  80. /**
  81. * 初始化日期控件
  82. * @param type 初始化类型: init_date_monthbegin 本月第一天,
  83. * init_date_monthend 本月最后一天,
  84. * init_date_curdate 当前日期
  85. */
  86. function initDate(){
  87. // alert(new Date());
  88. // alert(getSystemDate());
  89. $(".init_date_monthbegin").each(function(index,value){
  90. $(this).val(getCurrentMonthFirst());
  91. });
  92. $(".init_date_monthend").each(function(index,value){
  93. $(this).val(getCurrentMonthLast());
  94. });
  95. $(".init_date_curdate").each(function(index,value){
  96. $(this).val(getCurrentDate());
  97. });
  98. $(".init_date_curyear").each(function(index,value){
  99. $(this).val(getCurrentYean());
  100. });
  101. $(".init_date_curyearmonth").each(function(index,value){
  102. $(this).val(getCurrentYearMonth());
  103. });
  104. }
  105. /**
  106. *获取当前年月
  107. */
  108. function getCurrentYearMonth(){
  109. var date=new Date();
  110. var month = date.getMonth()+1;
  111. if(month<10){
  112. month = "0"+month;
  113. }
  114. var str = date.getFullYear()+"-"+month;
  115. return str;
  116. }
  117. /**
  118. *获取当前年份
  119. */
  120. function getCurrentYean(){
  121. var myDate = new Date();
  122. return myDate.getFullYear(); //获取完整的年份(4位,1970-????)
  123. }
  124. /**
  125. *获取当天日期
  126. */
  127. function getCurrentDate(){
  128. return getCurrentDate();
  129. }
  130. /**
  131. *获取当月第一天
  132. */
  133. function getCurrentMonthFirst(){
  134. var date=new Date();
  135. date.setDate(1);
  136. curMonFirst = formatDate(date);
  137. return curMonFirst.substring(0, curMonFirst.indexOf(" "));
  138. }
  139. /**
  140. * 获取当前月的最后一天
  141. */
  142. function getCurrentMonthLast(){
  143. var date=new Date();
  144. var currentMonth=date.getMonth();
  145. var nextMonth=++currentMonth;
  146. var nextMonthFirstDay=new Date(date.getFullYear(),nextMonth,1);
  147. var oneDay=1000*60*60*24;
  148. curMonLast = formatDate(new Date(nextMonthFirstDay-oneDay));
  149. return curMonLast.substring(0, curMonLast.indexOf(" "));
  150. }
  151. var iframeLoaded = function (iframe) {
  152. if (iframe.src.length > 0) {
  153. if (!iframe.readyState || iframe.readyState == "complete") {
  154. var win = iframe.contentWindow;
  155. var pages = win.document.getElementsByName("pages")[0].value;
  156. var pageindex = win.document.getElementsByName("pageindex")[0].value;
  157. processPage(pageindex,pages);
  158. }
  159. }
  160. }
  161. function processPage(index,pages){
  162. $("#pageHtml").show();
  163. var lastPage = pages - 1;
  164. if(pages<2){
  165. $("#prevpage").hide();
  166. $("#nextpage").hide();
  167. }else if(pages>1&&index==0){
  168. $("#prevpage").hide();
  169. $("#nextpage").show();
  170. }else if(pages>1&&index==lastPage){
  171. $("#prevpage").show();
  172. $("#nextpage").hide();
  173. }else{
  174. $("#prevpage").show();
  175. $("#nextpage").show();
  176. }
  177. }
  178. </script>
  179. </head>
  180. <body scroll="no">
  181. <form>
  182. <div class="container-layout">
  183. <div id="btn_title" class="form-button">
  184. <input type="hidden" id="pageIndex" value="${pageIndex}" />
  185. <input type="button" id="exportPdf" onclick="closeWindow()" class="l-button" value="关闭" />
  186. <input type="button" id="exportPdf" onclick="exportReport('toPdf')" class="l-button" value="导出PDF" />
  187. <input type="button" id="exportPdf" onclick="exportReport('toExcel')" class="l-button" value="导出EXCEL" />
  188. <div style="float: right; margin-right: 5px;display:none;" id="pageHtml">
  189. <a id="prevpage" onclick="pagePrevReport()" target="reportHtml">上一页</a>&nbsp;
  190. <a id="nextpage" onclick="pageNextReport()" target="reportHtml">下一页</a>
  191. </div>
  192. </div>
  193. <div class="default_search">
  194. <c:forEach items="${htmlParams}" var="p">
  195. <ul class="list_search">
  196. <li class="title" ><span>${p.title}</span>:</li>
  197. <li class="text" >${p.value}</li>
  198. </ul>
  199. </c:forEach>
  200. <ul>
  201. <li class="search-button"><input class="l-button" onclick="searchReport()" name="search" value="查询" type="button"></li>
  202. </ul>
  203. </div>
  204. <div class="forum-container">
  205. <%-- <iframe style="width: 100%;" frameborder="0" name="reportHtml" id="reportHtml" src="toReprotAction.do?method=toHtml&key=${key}&pageIndex=0"></iframe> --%>
  206. <iframe onload="iframeLoaded(this)" style="width: 100%;" frameborder="0" name="reportHtml" id="reportHtml" src="toReprotAction.do?method=toHtml&report_id=${report_id}&pageIndex=0"></iframe>
  207. </div>
  208. </div>
  209. </form>
  210. </body>
  211. </html>