页面树结构
转至元数据结尾
转至元数据起始

报表工具使用的是第三方的ureport2做的集成,如果要定制报表、套打等功能,都可以使用报表工具来实现,报表工具的使用教程可以参考ureport2的官方文档:https://www.w3cschool.cn/ureport/

报表工具的配置到菜单需要使用外部链接的方式设置,URL地址内容为:http://$env.serverIp:9090/ureport/designer   如果是nginx转发的地址的话需要根据转发后的APP端的接口地址替换 http://$env.serverIp:9090 即可

介绍一下配置数据连接的方式,这里的连接就是普通的jdbc的连接

配置连接DWF的数据库

数据源名称:DWF-local

连接用户名:postgres

连接密码:Dwf2018

驱动名称:org.postgresql.Driver

连接URL:jdbc:postgresql://127.0.0.1:5432/dataway

连接其他数据库参考

MySQL驱动名称:com.mysql.jdbc.Driver,MySQL连接URL:jdbc:mysql://localhost:3306/test

SQL server驱动名称:com.microsoft.sqlserver.jdbc.SQLServerDriver,SQL server连接URL:jdbc:sqlserver://localhost:1433;DatabaseName=tjl

Oracle驱动名称:oracle.jdbc.driver.OracleDriver  ,Oracle连接URL:jdbc:oracle:thin:@127.0.0.1:1521:orcl

集成到系统中可以参考:

1:跳预览打开页面:http://$env.serverIp:9090/ureport/preview?_u=file:.ureport.xml

2:以excel方式下载:http://$env.serverIp:9090/ureport/excel?_u=file:test.ureport.xml

3:以word方式下载:http://$env.serverIp:9090/ureport/word?_u=file:.ureport.xml

4:以pdf方式下载:http://$env.serverIp:9090/ureport/pdf?_u=file:.ureport.xml

5:以pdf方式打开:http://$env.serverIp:9090/ureport/pdf/show?_u=file:.ureport.xml  

关于系统集成的时候传参方式参考如下

上面的这些URL在使用时,如果需要向报表传入参数,可以将这些参数直接放在URL后面使用,

如:http://localhost:8080/ureport2-demo/ureport/word?_u=file:test.ureport.xml&deptId=D11&age=50,将报表file:test.ureport.xml导出成word时,传入两个参数,分别是:deptId=D11以及age=50


常用的表达式

select(罗列数据)   filter 为条件部分,条件可以有多个,多个条件之间用 and 或 or 连接,order 为是否对当前的 propertyName 进行排序,可选值有两个 desc 和 asc,既正序和倒序:语法  datasetName.select(propertyName[,filter,order])

group(分组罗列数据)  filter 为条件部分,条件可以有多个,多个条件之间用 and 或 or 连接,order 为是否对当前的 propertyName 进行排序,可选值有两个 desc 和 asc,既正序和倒序。:语法   datasetName.group(propertyName[,filter,order])

sum(累加数据)  sum 是对数据集目标字段进行累加,所以目标字段一定要是一个数字类型,否则就会产生错误:语法  datasetName.sum(propertyName,filter)

min(取最小值)   取最小值没有 order:语法  datasetName.min(propertyName,filter)

max(取最大值)  取最大值没有 order:语法 datasetName.max(propertyName,filter)

avg(取平均值)  avg在取平均值时,如除不尽,则保留8位小数,:语法 datasetName.avg(propertyName,filter)

count(统计数量)  count 是对数据集对象数量进行统计:语法  datasetName.count(filter)


示例

在表格中通过表达式来设置图片属性取值

'http://192.168.31.82:8180/' + tupianzhanshi.select(plt_tupianshuxing)

需要隐藏工具栏的话可以补充参数_t=0来实现

SQL数据集参数设置

   对于 SQL 方式数据集参数传递方式,实际上就是给 SQL 添加查询条件,UReport2 中S QL 参数传递采用的是命名参数的方式。

表达式中返回SQL的注意事项
我们在使用表达式返回SQL时,如果SQL中包含单引号包裹的字符串,那么需要加上“\”来为单引号转义,否则会出现语法错误,如下面的表达式:

示例1:

${
    if(param("oid")==null || param("oid")==''){
        return "select * from plt_cus_asset  where plt_oid=\'0402C9DCFE7C594495F2226AB84D0710\'";
    }else{
     return "select * from plt_cus_asset where plt_oid=:oid"
    }
}



  • 无标签

2 评论

  1. 刘英博 发表:

    关于UReport2的视频教程,看完第1集基本就会用了

    https://www.bilibili.com/video/BV11R4y1A73k?p=1

  2. 刘英博 发表:

    select plt_currentprocess as "currentProcess",plt_oid as "oid",plt_owner as "owner",plt_lastmodifytime as "lastModifyTime",plt_lastmodifier as "lastModifier",plt_createtime as "createTime",plt_creator as "creator",plt_id as "id",plt_assetname as "assetName",plt_assettype as "assetType",plt_installationdate as "installationDate",plt_assetstate as "assetState",plt_workhour as "workHour",plt_wocount as "woCount",plt_mileage as "mileAge",plt_alarmcount as "alarmCount",plt_locationx as "locationX",plt_locationy as "locationY",plt_asseticon as "assetIcon",plt_partoid as "partOid",plt_assetimg as "assetImg",plt_assetimgidentified as "assetImgIdentified",plt_assetdesc as "assetDesc",plt_ownername as "ownerName",plt_workloc as "workLoc" from plt_cus_asset where 1=1