123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- /**
- * Created by Tony on 2017/7/14.
- * 报表数据提取class,是协助报表模板里指标字段自主提取数据的工具类
- */
- let JV = require('../rpt_component/jpc_value_define');
- let $JE = require('../rpt_component/jpc_rte');
- class Rpt_Common{
- initialize(Projects) {
- this.Projects = Projects;
- };
- getSerialNo(fieldId, $CURRENT_RPT, $CURRENT_DATA){
- let itemSerialNoRec = $JE.F(fieldId, $CURRENT_RPT);
- if (itemSerialNoRec) {
- itemSerialNoRec[JV.PROP_AD_HOC_DATA] = [];
- for (var innerFmlIdx = 0; innerFmlIdx < $CURRENT_DATA[JV.DATA_DETAIL_DATA][0].length; innerFmlIdx++) {
- itemSerialNoRec[JV.PROP_AD_HOC_DATA][innerFmlIdx] = (innerFmlIdx + 1);
- }
- itemSerialNoRec = null;
- }
- };
- };
- class Rpt_Data_Extractor {
- constructor () {
- this.COMMON = new Rpt_Common();
- };
- initialize(Projects) {
- this.Projects = Projects;
- //Projects对象应该从前端传送过来,无需在后端重复查询及构建
- /* 结构:
- {
- currentPrjId: int,
- topPrj: [
- //单项工程
- {
- subPrjName: String,
- subPrjId: int,
- detailPrj: [
- //单位工程
- {
- detailPrjName: String,
- subPrjId: int,
- }
- ...
- ]
- }
- ...
- ]
- }
- */
- };
- prepareData($CURRENT_RPT) {
- //在报表提取数据前的准备工作,主要有:
- //1. 确认指标数据的类型(离散/主/从)
- //2. 根据类型提取数据,排序
- // 2.1. header类型
- // 2.2. 章类型
- // 2.3. detail类型
- // 2.4. 排序
- };
- }
|