如下方式引入页面报表,但是 templates 找不到
- import { Designer as ReportDesigner, templates } from '@grapecity/activereports/reportdesigner'
- mounted() {
- const _this = this
- _this.designer = new ReportDesigner('#designer-host', {
- language: 'zh', //汉化;
- }) // 初始化报表设计器
- _this.designer.setActionHandlers({
- // 添加预览功能
- onRender: async (report) => {
- this.designerHidden = true
- console.log(report)
- console.log('report.definition', JSON.stringify(report.definition))
- console.log('report.ReportItems', JSON.stringify(report.definition.Body.ReportItems))
- this.$refs.reportViewer.Viewer().open(report.definition)
- return Promise.resolve()
- },
- // 添加保存功能
- onSave: (info) => {
- const reportId = info.id || `NewReport${_this.counter + 1}`
- _this.reportStorage.set(reportId, info.definition)
- _this.counter++
- console.log('onSave', JSON.stringify(info.definition))
- return Promise.resolve({ displayName: reportId })
- },
- // 添加另存为功能
- onSaveAs: function (info) {
- const reportId = `NewReport${_this.counter + 1}`
- _this.reportStorage.set(reportId, info.definition)
- _this.counter++
- console.log('onSaveAs', JSON.stringify(info.definition))
- return Promise.resolve({ id: reportId, displayName: reportId })
- },
- onOpen: function () {
- const ret = new Promise(function (resolve) {
- resolveFunc = resolve
- _this.reportIds = _this.reportStorage.keys()
- // $('#dlgOpen').modal('show')
- })
- return ret
- },
- })
- _this.designer.setReport({ id: 'report.rdlx-json', definition: templates.FPL })
-
- },
- }
复制代码
|