|
|
@ -4,6 +4,7 @@ |
|
|
|
import Tool from './Tool.js'; |
|
|
|
import {tableToXml} from '../Utils.js'; |
|
|
|
import {alert} from '../MsgBox.js'; |
|
|
|
import {resetDirty} from "../Utils"; |
|
|
|
|
|
|
|
export default class PreviewTool extends Tool{ |
|
|
|
execute(){ |
|
|
@ -23,15 +24,34 @@ export default class PreviewTool extends Tool{ |
|
|
|
ul.append(preview); |
|
|
|
const _this=this; |
|
|
|
preview.click(function(){ |
|
|
|
_this.doPreview(); |
|
|
|
const content=tableToXml(_this.context); |
|
|
|
if(window._reportFile){ |
|
|
|
$.ajax({ |
|
|
|
url:window._server+"/designer/saveReportFile", |
|
|
|
data:{content,file:window._reportFile}, |
|
|
|
type:'POST', |
|
|
|
success:function(){ |
|
|
|
resetDirty(); |
|
|
|
_this.doPreview(); |
|
|
|
}, |
|
|
|
error:function(response){ |
|
|
|
if(response && response.responseText){ |
|
|
|
alert("服务端错误:"+response.responseText+""); |
|
|
|
}else{ |
|
|
|
alert(`${window.i18n.tools.save.failSave}`); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
}); |
|
|
|
const pagingPreview=$(`<li>
|
|
|
|
<a href="###"> |
|
|
|
<i class="glyphicon glyphicon-search" style="color: #0e90d2;"></i> ${window.i18n.tools.preview.pagingPreview} |
|
|
|
<i class="glyphicon glyphicon-search" style="color: #0e90d2;"></i> 预览 |
|
|
|
</a> |
|
|
|
</li>`); |
|
|
|
ul.append(pagingPreview); |
|
|
|
pagingPreview.click(function(){ |
|
|
|
// _this.doPreview(true);
|
|
|
|
_this.doPreview(true); |
|
|
|
}); |
|
|
|
group.append(mainBtn); |
|
|
@ -39,10 +59,11 @@ export default class PreviewTool extends Tool{ |
|
|
|
return group; |
|
|
|
} |
|
|
|
doPreview(withPaging){ |
|
|
|
let targetUrl=window._server+"/preview?_u=p"; |
|
|
|
if(withPaging){ |
|
|
|
targetUrl+='&_i=1&_r=1'; |
|
|
|
} |
|
|
|
// let targetUrl=window._server+"/preview?_u=p";
|
|
|
|
let targetUrl=window._server+"/preview?_u="+ withPaging ? "p" : window._reportFile; |
|
|
|
// if(withPaging){
|
|
|
|
// targetUrl+='&_i=1&_r=1';
|
|
|
|
// }
|
|
|
|
const content=tableToXml(this.context); |
|
|
|
$.ajax({ |
|
|
|
url:window._server+"/designer/savePreviewData", |
|
|
|