本帖最后由 Crystal.Li 于 2021-5-13 12:09 编辑
这篇文章给大家提供一个基于Vue框架集成使用AR JS的demo,以便大家参考使用。
关键方法代码:
mounted: function() {
designer = new ReportDesigner("#designer-host", { language: "zh" });
designer.setActionHandlers({
onRender: async (report)=>{
this.designerHidden = true;
this.$refs.reportViewer.Viewer().open(report.definition);
},
onCreate: () => {
const reportId = `NewReport${this.counter + 1}`;
//默认新建页面报表,指定templates.FPL
return Promise.resolve({ definition: templates.FPL, id: reportId, displayName: reportId });
},
onSave: (info)=>{
console.log(info);
const reportId = info.id || `NewReport${this.counter + 1}`;
//获取报表文件并下载
const fileName = `NewReport${this.counter + 1}.rdlx-json`;
const blob = new Blob([JSON.stringify(info.definition)],{type:"application/json"})
this.download(fileName, blob);
this.counter++;
return Promise.resolve({displayName: reportId});
}
});
//初始渲染test.rdlx-json报表
designer.setReport({ id: "test.rdlx-json" });
}
|