神器?。?!Ureport2報(bào)表工具使用及擴(kuò)展

Ureport2簡介

 [示例地址](http://www.bsdn.org/projects/ureport/deploy/ureport-sample/#)
 UReport2是一款基于架構(gòu)在Spring之上純Java的高性能報(bào)表引擎,通過迭代單元格可以實(shí)現(xiàn)任意復(fù)雜的中國式報(bào)表。
 相比UReport1,UReport2重寫了全部代碼,彌補(bǔ)了UReport1在功能及性能上的各種不足。
   在UReport2中,提供了全新的基于網(wǎng)頁的報(bào)表設(shè)計(jì)器,可以在Chrome、Firefox、Edge等各種主流瀏覽器運(yùn)行(IE瀏覽器除外)。
 使用UReport2,打開瀏覽器即可完成各種復(fù)雜報(bào)表的設(shè)計(jì)制作。
  UReport2是第一款基于Apache-2.0開源協(xié)議的中式報(bào)表引擎,
  Github地址:https://github.com/youseries/ureport。

準(zhǔn)備工作

可以參考官方文檔
http://wiki.bsdn.org/pages/viewpage.action?pageId=76448360
但是注意坑

添加maven倉庫

 <repository>
            <id>snapshots</id>
            <url>https://oss.sonatype.org/content/repositories/snapshots/</url>
        </repository>
        <repository>
            <id>sonatype</id>
            <url>https://oss.sonatype.org/content/groups/public/</url>
        </repository>

添加依賴

<dependency>
            <groupId>com.bstek.ureport</groupId>
            <artifactId>ureport2-console</artifactId>
            <version>2.3.0-SNAPSHOT</version>

        </dependency>
        <dependency>
            <groupId>com.bstek.ureport</groupId>
            <artifactId>ureport2-core</artifactId>
            <version>2.3.0-SNAPSHOT</version>
        </dependency>

https://files.cnblogs.com/files/Halburt/2.3.0-SNAPSHOT.rar
https://files.cnblogs.com/files/Halburt/ureport2-core2.3.0-SNAPSHOT.rar

版本說明

官方正式版本 2.2.9中 使用條件時(shí),重新加載報(bào)表會(huì)導(dǎo)致條件操作符變成undefined。
同時(shí)集成過程中會(huì)發(fā)現(xiàn)poi和spring相關(guān)版本不一致出問題。
<spring.version>4.3.11.RELEASE</spring.version>
<jackson.version>2.8.7</jackson.version>
<poi.version>3.16</poi.version>

web.xml配置文件

添加report配置文件及servlet

<!-- Context ConfigLocation -->
    <context-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>classpath*:/spring-context*.xml,classpath:ureport-console-context.xml</param-value>
    </context-param>
    <servlet>
        <servlet-name>ureportServlet</servlet-name>
        <servlet-class>com.bstek.ureport.console.UReportServlet</servlet-class>
    </servlet>
    <servlet-mapping>
        <servlet-name>ureportServlet</servlet-name>
        <url-pattern>/ureport/*</url-pattern>
    </servlet-mapping>

具體使用及教程

參考
http://wiki.bsdn.org/pages/viewpage.action
UReport2教學(xué)視頻http://pan.baidu.com/s/1boWTxF5,密碼:98hj
教程介紹的比較簡要。

擴(kuò)展實(shí)現(xiàn)

快捷鍵擴(kuò)展

$(".top-toolbar").append("<a href='javascript:$(\".ureport-preview\").click()'> 預(yù)覽 </a>"  )
$(".top-toolbar").append("<a href='javascript:$(\".ureport-save\").click()'> 保存 </a>"  )
$(".top-toolbar").append("<a href='javascript:$(\".ureport-save\").click() ;$(\".ureport-preview\").click()'> 保存之后預(yù)覽 </a>"  )

screenShot713b66.png

多租戶報(bào)表支持

報(bào)表管理與ureport報(bào)表整合

報(bào)表數(shù)據(jù)緩存

針對(duì)數(shù)據(jù)報(bào)表查詢統(tǒng)計(jì)速度較慢的情況,需要添加單獨(dú)數(shù)據(jù)表進(jìn)行存儲(chǔ)報(bào)表接口。

數(shù)據(jù)庫設(shè)計(jì)

screenShot3da67d.png
字段說明
    private String name;        // 名稱
    private String reportCode ; //報(bào)表編碼
    private String parms;       // 參數(shù)json
    private String orgId;       // 組織
    private Date submitTime;        // 提交時(shí)間
    private String style;       // html樣式
    private String content;     // Html內(nèi)容
    private String excel;       // excel文件地址
    private String companyId;       // 所屬公司
    private Date reportDate;        // 所屬日期
    private User user;      // 所屬人

ID:報(bào)表ID + 參數(shù) 的組合字符串,可采用MD5

大家如果對(duì)Ureport有什么建議或者技巧,歡迎留言私信

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容