上传后脚本:
var location = this.options.location; //获取当前控件的位置
var cr = FR.cellStr2ColumnRow(location);
var c = cr.col;
var r = cr.row;
var view = contentPane.getWidgetByCell(FR.columnRow2CellStr({col: c, row: r+1}));//获取预览单元格,c和r+1根据实际情况调整
var name=this.wrap.attach_array[0].attach_id;
console.log(name);
var o=view.options;
o.fileaddr=encodeURIComponent(encodeURIComponent("F:/FineReport_10.0/webapps/webroot/WEB-INF/assets/temp_attach/"+name));//安装路径
var filepath = decodeURIComponent(decodeURIComponent(o.fileaddr));
var filename = "";
if(filepath != ""){
if(filepath.indexOf("/")!=-1){
filename = filepath.substr(filepath.lastIndexOf("/")+1);
}else if(filepath.indexOf("\\")!=-1) {
filename = filepath.substr(filepath.lastIndexOf("\\")+1);
} else{
filename = filepath;
}
}
o.value = filename;
var sessionid = o.widgetUrl.substr(o.widgetUrl.lastIndexOf("=")+1);
var url = "ReportServer?op=resource&resource=/pdfjs-dist/web/viewer.html¶=";
if(o.envVersion> 9){
url = FR.server+"/decision/view/report?op=resource&resource=/pdfjs-dist/web/viewer.html¶=";
}
var encodeData = window.btoa("allowdownload=" + o.allowdownload +"&allowAPI="+o.allowAPI + "&watermark=" + o.watermarkstr + "&file=" + o.fileaddr+"&sessionstr="+sessionid)
o.src =url+encodeData;
console.log(o.src);
view._changeIframe(o.src);