Bläddra i källkod

预览报错提示

master
燕鹏 3 år sedan
förälder
incheckning
86cf76c247
  1. 10
      ureport2-console/src/main/java/com/bstek/ureport/console/html/HtmlPreviewServletAction.java
  2. 20
      ureport2-js/src/preview.js

10
ureport2-console/src/main/java/com/bstek/ureport/console/html/HtmlPreviewServletAction.java

@ -65,6 +65,7 @@ public class HtmlPreviewServletAction extends RenderPageServletAction {
private ReportBuilder reportBuilder;
private ReportRender reportRender;
private HtmlProducer htmlProducer = new HtmlProducer();
@Override
public void execute(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
String method = retriveMethod(req);
@ -73,19 +74,19 @@ public class HtmlPreviewServletAction extends RenderPageServletAction {
} else {
VelocityContext context = new VelocityContext();
HtmlReport htmlReport = null;
String errorMsg=null;
String errorMsg = "报表文件读取失败";
try {
htmlReport = loadReport(req);
} catch (Exception ex) {
if(!(ex instanceof ReportDesignException)){
if (ex instanceof ReportDesignException) {
ex.printStackTrace();
errorMsg = "报表设计错误";
}
errorMsg=buildExceptionMessage(ex);
}
String title = buildTitle(req);
context.put("title", title);
if (htmlReport == null) {
context.put("content", "<div style='color:red'><strong>报表计算出错,错误信息如下:</strong><br><div style=\"margin:10px\">"+errorMsg+"</div></div>");
context.put("content", "<div style='color:red'><strong>预览报表失败:" + errorMsg + "</strong></div>");
context.put("error", true);
context.put("searchFormJs", "");
context.put("downSearchFormHtml", "");
@ -362,6 +363,7 @@ public class HtmlPreviewServletAction extends RenderPageServletAction {
public void setReportBuilder(ReportBuilder reportBuilder) {
this.reportBuilder = reportBuilder;
}
public void setReportRender(ReportRender reportRender) {
this.reportRender = reportRender;
}

20
ureport2-js/src/preview.js

@ -103,16 +103,16 @@ $(document).ready(function(){
const url=window._server+'/excel'+urlParameters;
window.open(url,'_blank');
});
$(`.ureport-export-excel-paging`).click(function(){
const urlParameters=buildLocationSearchParameters();
const url=window._server+'/excel/paging'+urlParameters;
window.open(url,'_blank');
});
$(`.ureport-export-excel-paging-sheet`).click(function(){
const urlParameters=buildLocationSearchParameters();
const url=window._server+'/excel/sheet'+urlParameters;
window.open(url,'_blank');
});
// $(`.ureport-export-excel-paging`).click(function(){
// const urlParameters=buildLocationSearchParameters();
// const url=window._server+'/excel/paging'+urlParameters;
// window.open(url,'_blank');
// });
// $(`.ureport-export-excel-paging-sheet`).click(function(){
// const urlParameters=buildLocationSearchParameters();
// const url=window._server+'/excel/sheet'+urlParameters;
// window.open(url,'_blank');
// });
});
window._currentPageIndex=null;

Laddar…
Avbryt
Spara