huangxiaomin 3 年前
父節點
當前提交
8c283eb067
  1. 5
      ureport2-console/src/main/java/com/bstek/ureport/console/html/HtmlPreviewServletAction.java
  2. 2
      ureport2-console/src/main/resources/ureport-html/html-preview.html
  3. 2
      ureport2-js/src/designer.js
  4. 29
      ureport2-js/src/tools/BackTool.js
  5. 33
      ureport2-js/src/tools/PreviewTool.js

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

@ -120,6 +120,8 @@ public class HtmlPreviewServletAction extends RenderPageServletAction {
String customParameters = buildCustomParameters(req); String customParameters = buildCustomParameters(req);
context.put("customParameters", customParameters); context.put("customParameters", customParameters);
context.put("_t", ""); context.put("_t", "");
boolean isBack = StringUtils.isNotBlank(req.getParameter("isBack"));
context.put("isback",isBack);
Tools tools = null; Tools tools = null;
if (MobileUtils.isMobile(req)) { if (MobileUtils.isMobile(req)) {
tools = new Tools(false); tools = new Tools(false);
@ -140,6 +142,9 @@ public class HtmlPreviewServletAction extends RenderPageServletAction {
context.put("hasTools", true); context.put("hasTools", true);
} else { } else {
tools = new Tools(false); tools = new Tools(false);
if(!isBack){
tools.setShow(false);
}
} }
} }
context.put("tools", tools); context.put("tools", tools);

2
ureport2-console/src/main/resources/ureport-html/html-preview.html

@ -123,9 +123,11 @@ ${upSearchFormHtml}
<span id='pageLinkContainer'></span> <span id='pageLinkContainer'></span>
</span> </span>
#end #end
#if($isback)
<button type="button" class="btn btn-default ureport-back-btn" style="display:inline-block;padding:0;background:#f8f8f8;border:none;margin:3px;float: right" title="返回"> <button type="button" class="btn btn-default ureport-back-btn" style="display:inline-block;padding:0;background:#f8f8f8;border:none;margin:3px;float: right" title="返回">
<img src='${contextPath}/ureport/res/ureport-asserts/icons/back.svg' width="22px" height="22px"> <img src='${contextPath}/ureport/res/ureport-asserts/icons/back.svg' width="22px" height="22px">
</button> </button>
#end
</div> </div>
</div> </div>
#end #end

2
ureport2-js/src/designer.js

@ -35,6 +35,7 @@ import {undoManager} from './Utils.js';
import PrintLine from './PrintLine.js'; import PrintLine from './PrintLine.js';
import FileInfo from './FileInfo.js'; import FileInfo from './FileInfo.js';
import {renderRowHeader} from './table/HeaderUtils.js'; import {renderRowHeader} from './table/HeaderUtils.js';
import BackTool from "./tools/BackTool";
export default class UReportDesigner{ export default class UReportDesigner{
constructor(containerId,searchFormContainerId){ constructor(containerId,searchFormContainerId){
@ -144,6 +145,7 @@ export default class UReportDesigner{
this.tools.push(new ChartTool(context)); this.tools.push(new ChartTool(context));
this.tools.push(new SettingsTool(context)); this.tools.push(new SettingsTool(context));
this.tools.push(new SearchFormSwitchTool(context)); this.tools.push(new SearchFormSwitchTool(context));
this.tools.push(new BackTool(context));
for(const tool of this.tools){ for(const tool of this.tools){
toolbar.append(tool.buildButton()); toolbar.append(tool.buildButton());
} }

29
ureport2-js/src/tools/BackTool.js

@ -0,0 +1,29 @@
/**
* Created by Jacky.Gao on 2017-01-25.
*/
import Tool from './Tool.js';
export default class OpenTool extends Tool{
constructor(context){
super(context);
}
execute(){
window.parent.postMessage({'goback': -1},'*')
}
getTitle(){
return `${window.i18n.openFile}`;
}
getIcon(){
return `<img src='${window._contextPath}/ureport/res/ureport-asserts/icons/back.svg' width="22px" height="22px">`;
}
// buildButton(){
// const btn=$(`<button type="button" class="btn btn-default" style="border:none;border-radius:0;background: #f8f8f8;padding: 6px 5px;" title="${this.getTitle()}">
// ${this.getIcon()}
// </button>`);
// const _this=this;
// btn.click(function(){
// _this.execute();
// });
// return btn;
// }
}

33
ureport2-js/src/tools/PreviewTool.js

@ -32,7 +32,7 @@ export default class PreviewTool extends Tool{
type:'POST', type:'POST',
success:function(){ success:function(){
resetDirty(); resetDirty();
_this.doPreview(); _this.doPreview(false);
}, },
error:function(response){ error:function(response){
if(response && response.responseText){ if(response && response.responseText){
@ -60,23 +60,26 @@ export default class PreviewTool extends Tool{
} }
doPreview(withPaging){ doPreview(withPaging){
// let targetUrl=window._server+"/preview?_u=p"; // let targetUrl=window._server+"/preview?_u=p";
let targetUrl=window._server+"/preview?_u="+ withPaging ? "p" : window._reportFile; console.log("前往预览")
let targetUrl=window._server+"/preview?_u="+ (withPaging ? "p" : window._reportFile);
// if(withPaging){ // if(withPaging){
// targetUrl+='&_i=1&_r=1'; // targetUrl+='&_i=1&_r=1';
// } // }
const content=tableToXml(this.context); // const content=tableToXml(this.context);
$.ajax({ let newWindow=window.open(targetUrl,"_blank");
url:window._server+"/designer/savePreviewData", newWindow.focus();
type:'POST', // $.ajax({
data:{content}, // url:window._server+"/designer/savePreviewData",
success:function(){ // type:'POST',
let newWindow=window.open(targetUrl,"_blank"); // data:{content},
newWindow.focus(); // success:function(){
}, // let newWindow=window.open(targetUrl,"_blank");
error:function(){ // newWindow.focus();
alert(`${window.i18n.tools.preview.previewFail}`); // },
} // error:function(){
}); // alert(`${window.i18n.tools.preview.previewFail}`);
// }
// });
} }
getTitle(){ getTitle(){
return `${window.i18n.tools.preview.preview}`; return `${window.i18n.tools.preview.preview}`;

載入中…
取消
儲存