4. 应用中添加 BI
-
在项目中引入此插件
-
在 Studio 打开项目。
-
编辑 Project properties,在 App components 面板点击 Custom components 边上的 plus 按钮。
-
在 Custom application component 弹窗,输入 BI 插件的属性:
-
Artifact group:
com.haulmont.addon.bi
-
Artifact name:
cuba-bi-global
-
Version:
1.5.0
根据项目使用的 CUBA 框架版本选取兼容的插件版本:
平台版本 插件版本 6.5.x
1.1.1
6.6.x
1.2.1
6.7.x
1.2.3
6.8.x
1.2.4
6.9.x
1.3.0
6.10.x
1.4.0
7.0.x
1.5.0
示例:
Figure 27. BI 插件
-
-
-
在
web-app.properties
文件添加cuba.web.mainTabSheetMode
属性,以便在切换应用标签页的时候能保留报表内容:cuba.web.mainTabSheetMode = MANAGED
-
在插件提供的 BI > BI Reports 页面,注册 BI 报表。点击 Create 设置路径为本地保存的 Pentaho 报表:
Figure 28. BI 报表页面通过添加角色列表可以控制报表只对部分特定用户可用。如果这个列表是空的,那么所有人都能用这个报表。
现在用户可以在 BI > Run BI Reports 页面运行报表。
-
另一个方法是可以使用插件提供的
biComponent
可视化组件将 BI 报表嵌入到应用页面。示例:<cubabi:biComponent id="biComponent" height="100%" reportPath=":home:admin:ProductsByTypeAndLocation.saiku" width="100%"/>
reportPath
属性是 Pentaho 用户终端中报表文件的路径。另外,需要在window
元素的xmlns
属性添加cubabi
命名空间:xmlns:cubabi="http://schemas.company.com/cubabi/0.1/ui-component.xsd"