|
@@ -354,6 +354,7 @@ JpcExSrv.prototype.createNew = function() {
|
|
|
JpcResult.outputAsSimpleJSONPageArray = function($CTX_HELPER, rptTpl, dataObj, startPage, endPage, defProperties, customizeCfg, $CUSTOM_DEFINE) {
|
|
JpcResult.outputAsSimpleJSONPageArray = function($CTX_HELPER, rptTpl, dataObj, startPage, endPage, defProperties, customizeCfg, $CUSTOM_DEFINE) {
|
|
|
const me = this;
|
|
const me = this;
|
|
|
const rst = {};
|
|
const rst = {};
|
|
|
|
|
+ let subTab = null;
|
|
|
if ((startPage > 0) && (startPage <= endPage) && (endPage <= me.totalPages)) {
|
|
if ((startPage > 0) && (startPage <= endPage) && (endPage <= me.totalPages)) {
|
|
|
rst[JV.NODE_CONTROL_COLLECTION] = private_buildDftControls(rptTpl, (defProperties === null) ? null : defProperties.ctrls);
|
|
rst[JV.NODE_CONTROL_COLLECTION] = private_buildDftControls(rptTpl, (defProperties === null) ? null : defProperties.ctrls);
|
|
|
// console.log('controls: ');
|
|
// console.log('controls: ');
|
|
@@ -368,6 +369,50 @@ JpcExSrv.prototype.createNew = function() {
|
|
|
rst.items = [];
|
|
rst.items = [];
|
|
|
let bands = JpcBand.createNew(rptTpl, defProperties);
|
|
let bands = JpcBand.createNew(rptTpl, defProperties);
|
|
|
try {
|
|
try {
|
|
|
|
|
+ if (me.crossTab && (me.crossTab.excelExportOptions || me.crossTab.excelFileExportOptions)) {
|
|
|
|
|
+ subTab = me.crossTab;
|
|
|
|
|
+ } else if (me.flowTab && (me.flowTab.excelExportOptions || me.flowTab.excelFileExportOptions)) {
|
|
|
|
|
+ subTab = me.flowTab;
|
|
|
|
|
+ }
|
|
|
|
|
+ if (subTab) {
|
|
|
|
|
+ // 按主从数据导出Sheet或文件需要预处理(收集主数据)
|
|
|
|
|
+ if (subTab.excelExportOptions) {
|
|
|
|
|
+ const masterVals = $JE.getFieldValueArray(subTab.excelExportOptions.masterField, dataObj);
|
|
|
|
|
+ if (masterVals.length > 0) {
|
|
|
|
|
+ subTab.excelExportOptions.masterFieldValues = masterVals;
|
|
|
|
|
+ if (subTab.excelExportOptions.sheetNameID) {
|
|
|
|
|
+ subTab.excelExportOptions.sheetNameField = $JE.F(subTab.excelExportOptions.sheetNameID, me);
|
|
|
|
|
+ const sheetNameVals = $JE.getFieldValueArray(subTab.excelExportOptions.sheetNameField, dataObj);
|
|
|
|
|
+ subTab.excelExportOptions.sheetNameFieldValues = sheetNameVals;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ if (subTab.excelFileExportOptions) {
|
|
|
|
|
+ const masterVals = $JE.getFieldValueArray(subTab.excelFileExportOptions.masterField, dataObj);
|
|
|
|
|
+ if (masterVals.length > 0) {
|
|
|
|
|
+ // 1. 与拆分成sheet不同,这里的master数据还得过滤
|
|
|
|
|
+ const dupVals = [];
|
|
|
|
|
+ for (const mstV of masterVals) {
|
|
|
|
|
+ if (!dupVals.includes(mstV)) dupVals.push(mstV);
|
|
|
|
|
+ }
|
|
|
|
|
+ subTab.excelFileExportOptions.orgMasterFieldValues = masterVals;
|
|
|
|
|
+ subTab.excelFileExportOptions.masterFieldValues = dupVals;
|
|
|
|
|
+ if (subTab.excelFileExportOptions.fileNameID) {
|
|
|
|
|
+ subTab.excelFileExportOptions.fileNameField = $JE.F(subTab.excelFileExportOptions.fileNameID, me);
|
|
|
|
|
+ const fileNameVals = $JE.getFieldValueArray(subTab.excelFileExportOptions.fileNameField, dataObj);
|
|
|
|
|
+ subTab.excelFileExportOptions.fileNameFieldValues = fileNameVals;
|
|
|
|
|
+ }
|
|
|
|
|
+ for (let mstVIdx = 0; mstVIdx < dupVals.length; mstVIdx++) {
|
|
|
|
|
+ const orgVIdx = masterVals.indexOf(dupVals[mstVIdx]);
|
|
|
|
|
+ let fName = `${mstVIdx + 1}`;
|
|
|
|
|
+ if (subTab.excelFileExportOptions.fileNameFieldValues && orgVIdx >= 0 && subTab.excelFileExportOptions.fileNameFieldValues.length > orgVIdx) {
|
|
|
|
|
+ fName = subTab.excelFileExportOptions.fileNameFieldValues[orgVIdx];
|
|
|
|
|
+ }
|
|
|
|
|
+ subTab.excelFileExportOptions.segs[`${dupVals[mstVIdx]}`] = { pages: [], fileName: fName };
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
for (let page = startPage; page <= endPage; page++) {
|
|
for (let page = startPage; page <= endPage; page++) {
|
|
|
me.runTimePageData.currentPage = page;
|
|
me.runTimePageData.currentPage = page;
|
|
|
me.executeFormulas($CTX_HELPER, JV.RUN_TYPE_BEFORE_OUTPUT, rptTpl, dataObj, me, $CUSTOM_DEFINE, defProperties);
|
|
me.executeFormulas($CTX_HELPER, JV.RUN_TYPE_BEFORE_OUTPUT, rptTpl, dataObj, me, $CUSTOM_DEFINE, defProperties);
|
|
@@ -389,9 +434,10 @@ JpcExSrv.prototype.createNew = function() {
|
|
|
bands = null;
|
|
bands = null;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- if (me.crossTab && me.crossTab.excelExportOptions) {
|
|
|
|
|
|
|
+ if (subTab) {
|
|
|
// 加料
|
|
// 加料
|
|
|
- rst.excelExportOptions = me.crossTab.excelExportOptions;
|
|
|
|
|
|
|
+ if (subTab.excelExportOptions) rst.excelExportOptions = subTab.excelExportOptions;
|
|
|
|
|
+ if (subTab.excelFileExportOptions) rst.excelFileExportOptions = subTab.excelFileExportOptions;
|
|
|
}
|
|
}
|
|
|
return rst;
|
|
return rst;
|
|
|
};
|
|
};
|