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的值

  • 相关阅读:
    vue自定义指令
    ZOJ Problem Set–2104 Let the Balloon Rise
    ZOJ Problem Set 3202 Secondprice Auction
    ZOJ Problem Set–1879 Jolly Jumpers
    ZOJ Problem Set–2405 Specialized FourDigit Numbers
    ZOJ Problem Set–1874 Primary Arithmetic
    ZOJ Problem Set–1970 All in All
    ZOJ Problem Set–1828 Fibonacci Numbers
    要怎么样调整状态呢
    ZOJ Problem Set–1951 Goldbach's Conjecture
  • 原文地址:https://www.cnblogs.com/ms-grf/p/7561796.html
Copyright © 2011-2022 走看看