|
@@ -1,16 +1,18 @@
|
|
|
-let JV = require('../jpc_value_define');
|
|
|
-let JE = require('../jpc_rte');
|
|
|
-let JpcTextHelper = require('./jpc_helper_text');
|
|
|
-let JpcCommonOutputHelper = require('./jpc_helper_common_output');
|
|
|
-let JpcAreaHelper = require('./jpc_helper_area');
|
|
|
-let JpcFieldHelper = require('./jpc_helper_field');
|
|
|
+'use strict';
|
|
|
|
|
|
-let JpcDiscreteHelper = {
|
|
|
- outputDiscreteInfo: function (discreteArray, bands, dataObj, unitFactor, pageStatus, segIdx, multiCols, multiColIdx, $CURRENT_RPT, customizeCfg) {
|
|
|
- let rst = [];
|
|
|
+const JV = require('../jpc_value_define');
|
|
|
+const JE = require('../jpc_rte');
|
|
|
+const JpcTextHelper = require('./jpc_helper_text');
|
|
|
+const JpcCommonOutputHelper = require('./jpc_helper_common_output');
|
|
|
+const JpcAreaHelper = require('./jpc_helper_area');
|
|
|
+const JpcFieldHelper = require('./jpc_helper_field');
|
|
|
+
|
|
|
+const JpcDiscreteHelper = {
|
|
|
+ outputDiscreteInfo: function(discreteArray, bands, dataObj, unitFactor, pageStatus, segIdx, multiCols, multiColIdx, $CURRENT_RPT, customizeCfg) {
|
|
|
+ const rst = [];
|
|
|
if (discreteArray && dataObj) {
|
|
|
for (let i = 0; i < discreteArray.length; i++) {
|
|
|
- let band = bands[discreteArray[i][JV.PROP_BAND_NAME]];
|
|
|
+ const band = bands[discreteArray[i][JV.PROP_BAND_NAME]];
|
|
|
if (band && pageStatus[band[JV.BAND_PROP_DISPLAY_TYPE]] === true) {
|
|
|
if (discreteArray[i][JV.PROP_TEXT]) {
|
|
|
rst.push(JpcTextHelper.outputText(discreteArray[i][JV.PROP_TEXT], band, unitFactor, 1, 0, 1, 0, multiCols, multiColIdx));
|
|
@@ -21,49 +23,54 @@ let JpcDiscreteHelper = {
|
|
|
}
|
|
|
}
|
|
|
if (discreteArray[i][JV.PROP_DISCRETE_FIELDS]) {
|
|
|
- let flexiblePrecisionRefObj = null, flexibleRefField = null;
|
|
|
+ let flexiblePrecisionRefObj = null;
|
|
|
+ let flexibleRefField = null;
|
|
|
for (let j = 0; j < discreteArray[i][JV.PROP_DISCRETE_FIELDS].length; j++) {
|
|
|
- let df = discreteArray[i][JV.PROP_DISCRETE_FIELDS][j];
|
|
|
- let value = "";
|
|
|
- if (df[JV.PROP_FIELD_ID]) {
|
|
|
- // let map_data_field = JE.F(df[JV.PROP_FIELD_ID], $CURRENT_RPT);
|
|
|
- let map_data_field = JE.F(df[JV.PROP_FIELD_ID], $CURRENT_RPT);
|
|
|
- if (map_data_field.DataSeq !== JV.BLANK_FIELD_INDEX) {
|
|
|
- let data = dataObj[map_data_field.DataNodeName][map_data_field.DataSeq];
|
|
|
- if (data && data.length > 0) {
|
|
|
- if (data.length > segIdx) {
|
|
|
- value = data[segIdx];
|
|
|
- } else {
|
|
|
- value = data[0];
|
|
|
+ const df = discreteArray[i][JV.PROP_DISCRETE_FIELDS][j];
|
|
|
+ if (JE.isSignature(df[JV.PROP_FIELD_ID], $CURRENT_RPT)) {
|
|
|
+ //
|
|
|
+ } else {
|
|
|
+ let value = '';
|
|
|
+ if (df[JV.PROP_FIELD_ID]) {
|
|
|
+ // let map_data_field = JE.F(df[JV.PROP_FIELD_ID], $CURRENT_RPT);
|
|
|
+ const map_data_field = JE.F(df[JV.PROP_FIELD_ID], $CURRENT_RPT);
|
|
|
+ if (map_data_field.DataSeq !== JV.BLANK_FIELD_INDEX) {
|
|
|
+ const data = dataObj[map_data_field.DataNodeName][map_data_field.DataSeq];
|
|
|
+ if (data && data.length > 0) {
|
|
|
+ if (data.length > segIdx) {
|
|
|
+ value = data[segIdx];
|
|
|
+ } else {
|
|
|
+ value = data[0];
|
|
|
+ }
|
|
|
}
|
|
|
+ } else {
|
|
|
+ if (map_data_field[JV.PROP_AD_HOC_DATA] && map_data_field[JV.PROP_AD_HOC_DATA].length > 0) {
|
|
|
+ value = map_data_field[JV.PROP_AD_HOC_DATA][0];
|
|
|
+ } else value = '';
|
|
|
}
|
|
|
- } else {
|
|
|
- if (map_data_field[JV.PROP_AD_HOC_DATA] && map_data_field[JV.PROP_AD_HOC_DATA].length > 0) {
|
|
|
- value = map_data_field[JV.PROP_AD_HOC_DATA][0]
|
|
|
- } else value = "";
|
|
|
- }
|
|
|
- if (map_data_field && map_data_field[JV.PROP_PRECISION] && map_data_field.flexiblePrecisionRefObj) {
|
|
|
- let pre_ref_data = null;
|
|
|
- if (flexiblePrecisionRefObj === null) {
|
|
|
- flexiblePrecisionRefObj = {};
|
|
|
- flexibleRefField = JE.F(map_data_field[JV.PROP_PRECISION][JV.PROP_FLEXIBLE_REF_FILED_ID], $CURRENT_RPT);
|
|
|
- pre_ref_data = dataObj[map_data_field.DataNodeName][flexibleRefField.DataSeq]; //这里的引用指标必须得存在,哪怕不显示,也要存放在指标集合中!
|
|
|
- for (let decimalObj of map_data_field.flexiblePrecisionRefObj) {
|
|
|
- flexiblePrecisionRefObj["refUnit_" + decimalObj.unit] = decimalObj.decimal;
|
|
|
+ if (map_data_field && map_data_field[JV.PROP_PRECISION] && map_data_field.flexiblePrecisionRefObj) {
|
|
|
+ let pre_ref_data = null;
|
|
|
+ if (flexiblePrecisionRefObj === null) {
|
|
|
+ flexiblePrecisionRefObj = {};
|
|
|
+ flexibleRefField = JE.F(map_data_field[JV.PROP_PRECISION][JV.PROP_FLEXIBLE_REF_FILED_ID], $CURRENT_RPT);
|
|
|
+ pre_ref_data = dataObj[map_data_field.DataNodeName][flexibleRefField.DataSeq]; // 这里的引用指标必须得存在,哪怕不显示,也要存放在指标集合中!
|
|
|
+ for (const decimalObj of map_data_field.flexiblePrecisionRefObj) {
|
|
|
+ flexiblePrecisionRefObj['refUnit_' + decimalObj.unit] = decimalObj.decimal;
|
|
|
+ }
|
|
|
}
|
|
|
+ JpcFieldHelper.resetFlexibleFormat(df, pre_ref_data, flexiblePrecisionRefObj, segIdx, customizeCfg);
|
|
|
+ } else {
|
|
|
+ JpcFieldHelper.resetFormat(df, map_data_field, customizeCfg);
|
|
|
}
|
|
|
- JpcFieldHelper.resetFlexibleFormat(df, pre_ref_data, flexiblePrecisionRefObj, segIdx, customizeCfg);
|
|
|
- } else {
|
|
|
- JpcFieldHelper.resetFormat(df, map_data_field, customizeCfg);
|
|
|
+ } else if (df[JV.PROP_PARAM_ID]) {
|
|
|
+ const param = JE.P(df[JV.PROP_PARAM_ID], $CURRENT_RPT);
|
|
|
+ value = param[JV.PROP_DFT_VALUE];
|
|
|
}
|
|
|
- } else if (df[JV.PROP_PARAM_ID]) {
|
|
|
- let param = JE.P(df[JV.PROP_PARAM_ID], $CURRENT_RPT);
|
|
|
- value = param[JV.PROP_DFT_VALUE];
|
|
|
+ const item = JpcCommonOutputHelper.createCommonOutputWithoutDecorate(df, value, true);
|
|
|
+ // position
|
|
|
+ item[JV.PROP_AREA] = JpcAreaHelper.outputArea(df[JV.PROP_AREA], band, unitFactor, 1, 0, 1, 0, multiCols, multiColIdx, false, false);
|
|
|
+ rst.push(item);
|
|
|
}
|
|
|
- let item = JpcCommonOutputHelper.createCommonOutputWithoutDecorate(df, value, true);
|
|
|
- //position
|
|
|
- item[JV.PROP_AREA] = JpcAreaHelper.outputArea(df[JV.PROP_AREA], band, unitFactor, 1, 0, 1, 0, multiCols, multiColIdx, false, false);
|
|
|
- rst.push(item);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -71,10 +78,10 @@ let JpcDiscreteHelper = {
|
|
|
}
|
|
|
return rst;
|
|
|
},
|
|
|
- outputPreviewDiscreteInfo: function (discreteArray, bands, unitFactor, pageStatus) {
|
|
|
- let rst = [];
|
|
|
+ outputPreviewDiscreteInfo: function(discreteArray, bands, unitFactor, pageStatus) {
|
|
|
+ const rst = [];
|
|
|
for (let i = 0; i < discreteArray.length; i++) {
|
|
|
- let band = bands[discreteArray[i][JV.PROP_BAND_NAME]];
|
|
|
+ const band = bands[discreteArray[i][JV.PROP_BAND_NAME]];
|
|
|
if (band && pageStatus[band[JV.BAND_PROP_DISPLAY_TYPE]] === true) {
|
|
|
if (discreteArray[i][JV.PROP_TEXT]) {
|
|
|
rst.push(JpcTextHelper.outputText(discreteArray[i][JV.PROP_TEXT], band, unitFactor, 1, 0, 1, 0, 1, 0));
|
|
@@ -86,13 +93,13 @@ let JpcDiscreteHelper = {
|
|
|
}
|
|
|
if (discreteArray[i][JV.PROP_DISCRETE_FIELDS]) {
|
|
|
for (let j = 0; j < discreteArray[i][JV.PROP_DISCRETE_FIELDS].length; j++) {
|
|
|
- let df = discreteArray[i][JV.PROP_DISCRETE_FIELDS][j];
|
|
|
- let value = "";
|
|
|
+ const df = discreteArray[i][JV.PROP_DISCRETE_FIELDS][j];
|
|
|
+ let value = '';
|
|
|
if (df[JV.PROP_DFT_VALUE]) {
|
|
|
value = df[JV.PROP_DFT_VALUE];
|
|
|
}
|
|
|
- let item = JpcCommonOutputHelper.createCommonOutputWithoutDecorate(df, value, null);
|
|
|
- //position
|
|
|
+ const item = JpcCommonOutputHelper.createCommonOutputWithoutDecorate(df, value, null);
|
|
|
+ // position
|
|
|
item[JV.PROP_AREA] = JpcAreaHelper.outputArea(df[JV.PROP_AREA], band, unitFactor, 1, 0, 1, 0, 1, 0, false, false);
|
|
|
rst.push(item);
|
|
|
}
|
|
@@ -102,8 +109,8 @@ let JpcDiscreteHelper = {
|
|
|
}
|
|
|
return rst;
|
|
|
},
|
|
|
- outputPreviewSumInfoOutput: function (band, unitFactor, tab) {
|
|
|
- let rst = [];
|
|
|
+ outputPreviewSumInfoOutput: function(band, unitFactor, tab) {
|
|
|
+ const rst = [];
|
|
|
if (tab[JV.PROP_TEXT]) {
|
|
|
rst.push(JpcTextHelper.outputText(tab[JV.PROP_TEXT], band, unitFactor, 1, 0, 1, 0, 1, 0));
|
|
|
}
|
|
@@ -114,19 +121,19 @@ let JpcDiscreteHelper = {
|
|
|
}
|
|
|
if (tab[JV.PROP_SUM_FIELDS]) {
|
|
|
for (let i = 0; i < tab[JV.PROP_SUM_FIELDS].length; i++) {
|
|
|
- let tab_field = tab[JV.PROP_SUM_FIELDS][i];
|
|
|
+ const tab_field = tab[JV.PROP_SUM_FIELDS][i];
|
|
|
if (!(tab_field[JV.PROP_HIDDEN])) {
|
|
|
// rst.push(me.outputTabField(band, tab_field, null, -1, -1, 1, 0, 1, 0, unitFactor, true, controls, 0));
|
|
|
- let value = "";
|
|
|
- let item = JpcCommonOutputHelper.createCommonOutputWithoutDecorate(tab_field, value, null);
|
|
|
- //position
|
|
|
+ const value = '';
|
|
|
+ const item = JpcCommonOutputHelper.createCommonOutputWithoutDecorate(tab_field, value, null);
|
|
|
+ // position
|
|
|
item[JV.PROP_AREA] = JpcAreaHelper.outputArea(tab_field[JV.PROP_AREA], band, unitFactor, 1, 0, 1, 0, 1, 0, false, false);
|
|
|
rst.push(item);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
return rst;
|
|
|
- }
|
|
|
+ },
|
|
|
}
|
|
|
|
|
|
-module.exports = JpcDiscreteHelper;
|
|
|
+module.exports = JpcDiscreteHelper;
|