zoukankan      html  css  js  c++  java
  • 报表往子报表里传入list

    js

    var _parameters = {
        reportFileName: "reports/doctorstation/labBioResult.jasper",
        parameters: {
            'order_Id': $scope.selectedExamLabOrdersVO.orderId,
            'bioList' : bioList,
            'hasAnti' : hasAnti,
            'labAntiList' : labAntiList
        }
    };
    var printInfoObject = {
        type: "report",
        method: "post",
        appletParameters: {
            is_direct_print: true,
            is_display: false,
            printer_name: null,
            report_url: "api/jasper-prints/doctor-station/lab-bio-results"
        },
        reportParameter: _parameters
    };
    HrUtils.postMessageToBaseFrame(printInfoObject, "*");

    报表服务器的facade里写法

    public JasperPrint fillLabBioResultReport(JasperPrintParamsVo jasperPrintParamsVo) {
        LOGGER.debug("填充报表[{}];填充时使用参数:[{}]。", jasperPrintParamsVo.getReportFileName(), jasperPrintParamsVo.getParameters());
        Map reportParam = jasperPrintParamsVo.getParameters();
        List<Map<String, ?>> bioList = (List<Map<String, ?>>) jasperPrintParamsVo.getParameters().get("bioList");
        List<Map<String, ?>> labAntiList = (List<Map<String, ?>>) jasperPrintParamsVo.getParameters().get("labAntiList");
        reportParam.put("bioList", new JRMapCollectionDataSource(bioList));
        reportParam.put("labAntiList", new JRMapCollectionDataSource(labAntiList));
        reportParam.put("SUBREPORT_DIR", "reports/doctorstation/");
        return hrFillReport(obtainJasperReportByFileName(jasperPrintParamsVo.getReportFileName()), reportParam, new JREmptyDataSource());
    }

    报表写法注意

    detail1中循环的是bioList中的数据 detail3中循环的是labAntiList中的数据

    报表中传入的bioList和labAntiList的类型要注意(net.sf.jasperreports.engine.data.JRMapCollectionDataSource)

    连接子报表注意

    之前用sql做子报表是下面两个红框有内容(Connection Expression是自动生成的)

    现在往子报表中传list是先要把Connection Expression中的值删除然后在紫框中(Data Source Expression)填入($P{bioList}.cloneDataSource())

      $P{bioList}是要往子报表中传的list也是主报表中的parameter的值

  • 相关阅读:
    spring 04-Spring框架依赖注入基本使用
    spring 03-Spring开发框架之控制反转
    spring 02-Maven搭建Spring开发环境
    spring 01-Spring开发框架简介
    JVM堆内存、方法区和栈内存的关系
    jvm 07-java引用类型
    jvm 06-G1收集器
    jvm 05-JVM垃圾收集策略
    jvm 04-JVM堆内存划分
    CSS书写顺序
  • 原文地址:https://www.cnblogs.com/ms-grf/p/7561796.html
Copyright © 2011-2022 走看看