1 <html> 2 <head> 3 <title>Common Report</title> 4 <script src="plug-in/jquery/jquery.js" type="text/javascript"></script> 5 <script src="script/public/mainStyle.js" type="text/javascript"></script> 6 <script type="text/javascript" src="script/public/main.js"></script> 7 <script src="script/public/revenue.js" type="text/javascript" language="javascript"></script> 8 <script type="text/javascript"> 9 /** 10 * 查看当前用户的扩展权限 11 * @param 无参数 12 * @return 无返回值 13 */ 14 function setUserRight() 15 { 16 var allRi = fetchMultiPValue("Duty.getPower",6,"&userid="+$("#userid").val()+"&menuid="+$("#imenuid").val() + "&groupid="+$("#zid").val()); 17 if(typeof allRi == 'undefined' || allRi.length == 0) 18 { 19 //alert("取权限失败"); 20 return false; 21 } 22 if(allRi[0][0]=="all") 23 { 24 return true; 25 } 26 var reportname = ''; 27 28 for(var i = 0;i<allRi.length;i++){ 29 if(getCaption(allRi[i][0],'reportname','')!="") 30 { 31 reportname = getCaption(allRi[i][0],'reportname',''); 32 break; 33 } 34 } 35 $("#reportlet").val("/com/tsdreport/" + reportname + ".cpt"); 36 } 37 /** 38 * 中文编码 39 * @param 无参数 40 * @return 无返回值 41 */ 42 43 function cjkEncode(text) { 44 if (text == null) { 45 return ""; 46 } 47 var newText = ""; 48 for (var i = 0; i < text.length; i++) { 49 var code = text.charCodeAt (i); 50 if (code >= 128 || code == 91 || code == 93) {//91 is "[", 93 is "]". 51 newText += "[" + code.toString(16) + "]"; 52 } 53 else if(code==37) 54 { 55 newText += "%25"; 56 } 57 else { 58 newText += text.charAt(i); 59 } 60 61 } 62 return newText; 63 } 64 /** 65 * 下载报表 66 * @param 无参数 67 * @return 无返回值 68 */ 69 function loadFromReportConfig() 70 { 71 var res = fetchSingleValue("cReport.FileName",7,"&menuid="+$("#imenuid").val()); 72 if(res!=undefined && res!="") 73 { 74 $("#reportlet").val("/com/tsdreport/" + res); 75 } 76 } 77 </script> 78 79 </head> 80 <body> 81 <form name="report" id="report" method="get"> 82 <!-- 报表文件名 --> 83 <input type="hidden" name="reportlet" id="reportlet" /> 84 <!-- UserID --> 85 <input type="hidden" name="userid" id="userid" value="<%=(String)session.getAttribute("userid")%>" /> 86 <!-- UserName --> 87 <input type="hidden" name="username" id="username" value="<%=(String)session.getAttribute("username")%>" /> 88 <!-- 管理区域 --> 89 <input type="hidden" name="managearea" id="managearea" value="<%=(String)session.getAttribute("managearea")%>" /> 90 <!-- 部门 --> 91 <input type="hidden" name="departname" id="departname" value="<%=(String)session.getAttribute("departname")%>" /> 92 <!-- 权限组ID --> 93 <input type="hidden" name="groupid" id="groupid" value="<%=(String)session.getAttribute("groupid")%>" /> 94 <!-- 营收区域 --> 95 <input type="hidden" name="chargearea" id="chargearea" value="<%=(String)session.getAttribute("chargearea")%>" /> 96 <!-- 业务区域 --> 97 <input type="hidden" name="userarea" id="userarea" value="<%=(String)session.getAttribute("userarea")%>" /> 98 </form> 99 100 <input type="hidden" name="userid" id="userid" value="<%=(String)session.getAttribute("userid")%>" /> 101 <input type="hidden" id="imenuid" name="imenuid" value='<%=imenuid %>' /> 102 <input type="hidden" id="zid" name="zid" value='<%=zid %>' /> 103 <input type='hidden' id='thisbasePath' value='<%=basePath %>' /> 104 105 <div id="error" style="width:360px;height:80px;border:#99ccff 1px solid;line-height:80px;text-align:center;vertical-align:middle;display:none;"> 106 <h3>没有可打印的报表文件</h3> 107 </div> 108 109 <script language="javascript"> 110 111 setUserRight(); 112 113 loadFromReportConfig(); 114 115 var obj = document.report.reportlet; 116 117 if(obj.value == "" || obj.value==undefined || obj.value=="null") 118 { 119 error.style.marginLeft = (document.body.clientWidth - 360)/2; 120 error.style.marginTop = (document.body.clientHeight - 300)/2; 121 error.style.display = "block"; 122 } 123 else 124 { 125 //document.report.action = $("#thisbasePath").val() + "ReportServer"; 126 //document.report.submit(); 127 var param = $("#thisbasePath").val() + "ReportServer"; 128 $.each($("#report :hidden"),function(i,n){ 129 param = param + "&"; 130 param = param + $(n).attr("name"); 131 param = param + "="; 132 param = param + cjkEncode($(n).attr("value")); 133 }); 134 param = param.replace("ReportServer&reportlet","ReportServer?reportlet"); 135 document.location = param; 136 } 137 </script> 138 139 </body> 140 </html>
网页上有个按钮,属性中没有click方法,但点击的确会出发loadFromReportConfig,求各位大神指点~