|
@@ -1,28 +1,33 @@
|
|
|
-let JV = require('./jpc_value_define');
|
|
|
-let JE = require('./jpc_rte');
|
|
|
-let JpcFieldHelper = require('./helper/jpc_helper_field');
|
|
|
-let JpcBandHelper = require('./helper/jpc_helper_band');
|
|
|
-let JpcCommonHelper = require('./helper/jpc_helper_common');
|
|
|
-let JpcDiscreteHelper = require('./helper/jpc_helper_discrete');
|
|
|
-let JpcTextHelper = require('./helper/jpc_helper_text');
|
|
|
-let JpcCommonOutputHelper = require('./helper/jpc_helper_common_output');
|
|
|
-let JpcAreaHelper = require('./helper/jpc_helper_area');
|
|
|
+'use strict';
|
|
|
|
|
|
-let JpcBillTabSrv = function(){};
|
|
|
-JpcBillTabSrv.prototype.createNew = function(){
|
|
|
- let JpcBillTabResult = {};
|
|
|
+const JV = require('./jpc_value_define');
|
|
|
+const JE = require('./jpc_rte');
|
|
|
+const JpcFieldHelper = require('./helper/jpc_helper_field');
|
|
|
+const JpcBandHelper = require('./helper/jpc_helper_band');
|
|
|
+const JpcCommonHelper = require('./helper/jpc_helper_common');
|
|
|
+const JpcDiscreteHelper = require('./helper/jpc_helper_discrete');
|
|
|
+const JpcTextHelper = require('./helper/jpc_helper_text');
|
|
|
+const JpcCommonOutputHelper = require('./helper/jpc_helper_common_output');
|
|
|
+const JpcAreaHelper = require('./helper/jpc_helper_area');
|
|
|
+
|
|
|
+const JpcBillTabSrv = function() {};
|
|
|
+JpcBillTabSrv.prototype.createNew = function() {
|
|
|
+ const JpcBillTabResult = {};
|
|
|
JpcBillTabResult.initialize = function() {
|
|
|
- let me = this;
|
|
|
+ const me = this;
|
|
|
me.disp_fields_idx = [];
|
|
|
+
|
|
|
+ me.signatureRst = [];
|
|
|
+ me.signatureDateRst = [];
|
|
|
};
|
|
|
JpcBillTabResult.sorting = function(rptTpl) {
|
|
|
- let me = this;
|
|
|
+ const me = this;
|
|
|
JpcFieldHelper.findAndPutDataFieldIdx(rptTpl, rptTpl[JV.NODE_BILL_INFO][JV.NODE_BILL_CONTENT][JV.PROP_BILL_FIELDS], null, me.disp_fields_idx);
|
|
|
};
|
|
|
JpcBillTabResult.paging = function(rptTpl, dataObj) {
|
|
|
let rst = 0;
|
|
|
function getDataLength(fields_str) {
|
|
|
- let dataFields = dataObj[fields_str];
|
|
|
+ const dataFields = dataObj[fields_str];
|
|
|
if (dataFields && dataFields.length > 0) {
|
|
|
rst = dataFields[0].length;
|
|
|
}
|
|
@@ -40,26 +45,30 @@ JpcBillTabSrv.prototype.createNew = function(){
|
|
|
}
|
|
|
return rst;
|
|
|
};
|
|
|
- JpcBillTabResult.outputAsPreviewPage = function (rptTpl, bands, controls, $CURRENT_RPT) {
|
|
|
- let me = this, rst = [], vIdx = [];
|
|
|
- //只预览第一页的数据
|
|
|
- let pageStatus = [true, true, false, true, false, false, false, false];
|
|
|
+ JpcBillTabResult.outputAsPreviewPage = function(rptTpl, bands, controls, $CURRENT_RPT) {
|
|
|
+ const me = this;
|
|
|
+ let rst = [];
|
|
|
+ // const vIdx = [];
|
|
|
+ // 只预览第一页的数据
|
|
|
+ const pageStatus = [true, true, false, true, false, false, false, false];
|
|
|
JpcBandHelper.setBandArea(bands, rptTpl, pageStatus, true, false);
|
|
|
- let unitFactor = JpcCommonHelper.getUnitFactor(rptTpl);
|
|
|
+ const unitFactor = JpcCommonHelper.getUnitFactor(rptTpl);
|
|
|
rst = rst.concat(me.outputPreviewContent(rptTpl, bands, unitFactor, controls, pageStatus));
|
|
|
rst = rst.concat(JpcDiscreteHelper.outputPreviewDiscreteInfo(rptTpl[JV.NODE_BILL_INFO][JV.NODE_DISCRETE_INFO], bands, unitFactor, pageStatus));
|
|
|
return rst;
|
|
|
};
|
|
|
- JpcBillTabResult.outputAsSimpleJSONPage = function (rptTpl, dataObj, page, bands, controls, $CURRENT_RPT, customizeCfg) {
|
|
|
- let me = this, rst = [], tabRstLst = [];
|
|
|
- //1 calculate the band position
|
|
|
- let pageStatus = [true, false, false, false, false, false, false, false];
|
|
|
+ JpcBillTabResult.outputAsSimpleJSONPage = function(rptTpl, dataObj, page, bands, controls, $CURRENT_RPT, customizeCfg) {
|
|
|
+ const me = this;
|
|
|
+ let rst = [];
|
|
|
+ const tabRstLst = [];
|
|
|
+ // 1. calculate the band position
|
|
|
+ const pageStatus = [true, false, false, false, false, false, false, false];
|
|
|
JpcBandHelper.setBandArea(bands, rptTpl, pageStatus);
|
|
|
- //2. start to output detail-part
|
|
|
- let unitFactor = JpcCommonHelper.getUnitFactor(rptTpl);
|
|
|
- //2.1 output content
|
|
|
+ // 2. start to output detail-part
|
|
|
+ const unitFactor = JpcCommonHelper.getUnitFactor(rptTpl);
|
|
|
+ // 2.1 output content
|
|
|
tabRstLst.push(me.outputContent(rptTpl, dataObj, page, bands, unitFactor, controls, pageStatus, $CURRENT_RPT, customizeCfg));
|
|
|
- //2.2 output discrete
|
|
|
+ // 2.2 output discrete
|
|
|
tabRstLst.push(JpcDiscreteHelper.outputDiscreteInfo(rptTpl[JV.NODE_BILL_INFO][JV.NODE_DISCRETE_INFO], bands, dataObj, unitFactor, pageStatus, page - 1, 1, 0, $CURRENT_RPT, customizeCfg));
|
|
|
for (let i = 0; i < tabRstLst.length; i++) {
|
|
|
rst = rst.concat(tabRstLst[i]);
|
|
@@ -69,15 +78,15 @@ JpcBillTabSrv.prototype.createNew = function(){
|
|
|
};
|
|
|
JpcBillTabResult.outputPreviewContent = function(rptTpl, bands, unitFactor, controls, pageStatus) {
|
|
|
let rst = [];
|
|
|
- let tab = rptTpl[JV.NODE_BILL_INFO][JV.NODE_BILL_CONTENT];
|
|
|
- let band = bands[tab[JV.PROP_BAND_NAME]];
|
|
|
+ const tab = rptTpl[JV.NODE_BILL_INFO][JV.NODE_BILL_CONTENT];
|
|
|
+ const band = bands[tab[JV.PROP_BAND_NAME]];
|
|
|
if (band) {
|
|
|
if (pageStatus[band[JV.BAND_PROP_DISPLAY_TYPE]]) {
|
|
|
- let tab_fields = tab[JV.PROP_BILL_FIELDS];
|
|
|
+ const tab_fields = tab[JV.PROP_BILL_FIELDS];
|
|
|
for (let i = 0; i < tab_fields.length; i++) {
|
|
|
- let tab_field = tab_fields[i];
|
|
|
+ const tab_field = tab_fields[i];
|
|
|
if (!(tab_field[JV.PROP_HIDDEN])) {
|
|
|
- let cellItem = JpcCommonOutputHelper.createCommonOutput(tab_field, "", controls);
|
|
|
+ const cellItem = JpcCommonOutputHelper.createCommonOutput(tab_field, '', controls);
|
|
|
cellItem[JV.PROP_AREA] = JpcAreaHelper.outputArea(tab_field[JV.PROP_AREA], band, unitFactor, 1, 0, 1, 0, 1, 0, false, false);
|
|
|
rst.push(cellItem);
|
|
|
}
|
|
@@ -98,22 +107,26 @@ JpcBillTabSrv.prototype.createNew = function(){
|
|
|
return rst;
|
|
|
};
|
|
|
JpcBillTabResult.outputContent = function(rptTpl, dataObj, page, bands, unitFactor, controls, pageStatus, $CURRENT_RPT, customizeCfg) {
|
|
|
- let me = this, rst = [];
|
|
|
- let tab = rptTpl[JV.NODE_BILL_INFO][JV.NODE_BILL_CONTENT];
|
|
|
- let band = bands[tab[JV.PROP_BAND_NAME]];
|
|
|
+ const me = this;
|
|
|
+ let rst = [];
|
|
|
+ const tab = rptTpl[JV.NODE_BILL_INFO][JV.NODE_BILL_CONTENT];
|
|
|
+ const band = bands[tab[JV.PROP_BAND_NAME]];
|
|
|
if (band) {
|
|
|
if (pageStatus[band[JV.BAND_PROP_DISPLAY_TYPE]]) {
|
|
|
- let tab_fields = tab[JV.PROP_BILL_FIELDS];
|
|
|
+ const tab_fields = tab[JV.PROP_BILL_FIELDS];
|
|
|
let data_details = null;
|
|
|
if (rptTpl[JV.NODE_FIELD_MAP][JV.NODE_DETAIL_FIELDS]) {
|
|
|
data_details = dataObj[JV.DATA_DETAIL_DATA];
|
|
|
} else if (rptTpl[JV.NODE_FIELD_MAP][JV.NODE_MASTER_FIELDS]) {
|
|
|
data_details = dataObj[JV.DATA_MASTER_DATA];
|
|
|
}
|
|
|
- let flexiblePrecisionRefObj = null, flexibleRefField = null, precision_ref_data = null;
|
|
|
+ let flexiblePrecisionRefObj = null;
|
|
|
+ let flexibleRefField;
|
|
|
+ let precision_ref_data;
|
|
|
for (let i = 0; i < tab_fields.length; i++) {
|
|
|
- let tab_field = tab_fields[i];
|
|
|
- let data_field = null, map_data_field = JE.F(tab_field[JV.PROP_FIELD_ID], $CURRENT_RPT);
|
|
|
+ const tab_field = tab_fields[i];
|
|
|
+ let data_field = null;
|
|
|
+ const map_data_field = JE.F(tab_field[JV.PROP_FIELD_ID], $CURRENT_RPT);
|
|
|
if (me.disp_fields_idx.length > i && me.disp_fields_idx[i] !== JV.BLANK_FIELD_INDEX && (typeof me.disp_fields_idx[i] !== 'object')) {
|
|
|
data_field = data_details[me.disp_fields_idx[i]];
|
|
|
} else {
|
|
@@ -126,8 +139,8 @@ JpcBillTabSrv.prototype.createNew = function(){
|
|
|
flexiblePrecisionRefObj = {};
|
|
|
flexibleRefField = JE.F(map_data_field[JV.PROP_PRECISION][JV.PROP_FLEXIBLE_REF_FILED_ID], $CURRENT_RPT);
|
|
|
precision_ref_data = dataObj[map_data_field.DataNodeName][flexibleRefField.DataSeq];
|
|
|
- for (let decimalObj of map_data_field.flexiblePrecisionRefObj) {
|
|
|
- flexiblePrecisionRefObj["refUnit_" + decimalObj.unit] = decimalObj.decimal;
|
|
|
+ for (const decimalObj of map_data_field.flexiblePrecisionRefObj) {
|
|
|
+ flexiblePrecisionRefObj['refUnit_' + decimalObj.unit] = decimalObj.decimal;
|
|
|
}
|
|
|
}
|
|
|
JpcFieldHelper.resetFlexibleFormat(tab_field, precision_ref_data, flexiblePrecisionRefObj, page - 1, customizeCfg);
|
|
@@ -135,8 +148,8 @@ JpcBillTabSrv.prototype.createNew = function(){
|
|
|
if (page === 1) JpcFieldHelper.resetFormat(tab_field, map_data_field, customizeCfg);
|
|
|
}
|
|
|
if (!(tab_field[JV.PROP_HIDDEN])) {
|
|
|
- let val = JpcFieldHelper.getValue(data_field, page - 1);
|
|
|
- let cellItem = JpcCommonOutputHelper.createCommonOutput(tab_field, val, controls);
|
|
|
+ const val = JpcFieldHelper.getValue(data_field, page - 1);
|
|
|
+ const cellItem = JpcCommonOutputHelper.createCommonOutput(tab_field, val, controls);
|
|
|
cellItem[JV.PROP_AREA] = JpcAreaHelper.outputArea(tab_field[JV.PROP_AREA], band, unitFactor, 1, 0, 1, 0, 1, 0, false, false);
|
|
|
rst.push(cellItem);
|
|
|
}
|
|
@@ -159,4 +172,4 @@ JpcBillTabSrv.prototype.createNew = function(){
|
|
|
return JpcBillTabResult;
|
|
|
};
|
|
|
|
|
|
-module.exports = new JpcBillTabSrv();
|
|
|
+module.exports = new JpcBillTabSrv();
|