jpc_report.js 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440
  1. 'use strict';
  2. /**
  3. * Created by Tony on 2023/4/14.
  4. */
  5. const BaseService = require('../base/base_service');
  6. const JpcEx = require('../reports/rpt_component/jpc_ex');
  7. const JV = require('../reports/rpt_component/jpc_value_define');
  8. const rpt_xl_util = require('../reports/util/rpt_excel_util');
  9. const rptDataExtractor = require('../reports/util/rpt_calculation_data_util');
  10. const RPT_DEF_PROPERTIES = require('../const/report_defined_properties');
  11. const needCustomTables = [
  12. 'mem_custom_select',
  13. 'mem_gather_stage_bills', 'mem_gather_deal_bills', 'mem_gather_stage_pay', 'mem_gather_tender_info', 'mem_gather_stage_pos',
  14. 'mem_gather_change', 'mem_gather_change_bills', 'mem_gather_stage_change', 'mem_gather_advance_pay',
  15. 'mem_gather_stage_jgcl', 'mem_gather_stage_yjcl', 'mem_gather_stage_bonus', 'mem_gather_stage_other', 'mem_gather_stage_safe_prod', 'mem_gather_stage_temp_land',
  16. 'mem_stage_sum_bills', 'mem_stage_sum_pos', 'mem_stage_sum_pay',
  17. 'mem_jh_gather_im_change', 'mem_jh_im_change', 'mem_jh_gather_stage_bills_compare',
  18. 'mem_material_sum_gl',
  19. ];
  20. const sourceTypeConst = require('../const/source_type');
  21. module.exports = app => {
  22. class JpcReport extends BaseService {
  23. /**
  24. * 构造函数
  25. *
  26. * @param {Object} ctx - egg全局变量
  27. * @return {void}
  28. */
  29. constructor(ctx) {
  30. super(ctx);
  31. this.tableName = '';
  32. this.dataId = '';
  33. }
  34. async getAllPagesCommon(ctx, rptTpl, params, option, outputType, baseDir, customSelect) {
  35. const rptDataUtil = new rptDataExtractor();
  36. rptDataUtil.initialize(rptTpl);
  37. const filter = rptDataUtil.getDataRequestFilter();
  38. const rawDataObj = await ctx.service.report.getReportData(rptTpl.source_type, params, filter.tables, filter.memFieldKeys,
  39. rptTpl[JV.NODE_CUSTOM_DEFINE], customSelect);
  40. // console.log(rawDataObj);
  41. try {
  42. const printCom = JpcEx.createNew();
  43. setupPageSize(rptTpl, params.pageSize);
  44. if (params.orientation && (params.orientation !== 'null')) rptTpl[JV.NODE_MAIN_INFO][JV.NODE_PAGE_INFO][JV.PROP_ORIENTATION] = params.orientation;
  45. const defProperties = RPT_DEF_PROPERTIES;
  46. const tplData = rptDataUtil.assembleData(ctx, rawDataObj, baseDir, printCom, customSelect);
  47. if (params.custCfg) {
  48. setupCustomizeCfg(params.custCfg, rptTpl, defProperties);
  49. } else {
  50. // setupCustomizeCfg(defProperties, rptTpl, defProperties);
  51. }
  52. const dftOption = params.option || JV.PAGING_OPTION_NORMAL;
  53. printCom.initialize(rptTpl);
  54. printCom.analyzeData(ctx.helper, rptTpl, tplData, defProperties, dftOption, outputType, customSelect, params.splitArchives);
  55. const maxPages = printCom.totalPages;
  56. let pageRst = null;
  57. if (maxPages > 0) {
  58. pageRst = printCom.outputAsSimpleJSONPageArray(ctx.helper, rptTpl, tplData, 1, maxPages, defProperties, params.custCfg, customSelect);
  59. } else {
  60. pageRst = printCom.outputAsPreviewPage(rptTpl, defProperties);
  61. }
  62. pageRst.id = params.rpt_tpl_id;
  63. if (tplData.splitArcPages) {
  64. pageRst.splitArcPages = tplData.splitArcPages;
  65. pageRst.splitArcPagesInfo = tplData.splitArcPagesInfo;
  66. }
  67. return pageRst;
  68. } catch (ex) {
  69. console.log('报表数据异常, tender id: ' + params.tender_id);
  70. console.log(ex);
  71. }
  72. }
  73. async getMultiRptsCommon(ctx, params, outputType, baseDir) {
  74. for (let idx = 0; idx < params.rpt_ids.length; idx++) {
  75. params.rpt_ids[idx] = parseInt(params.rpt_ids[idx]); // 转换一下,以防万一
  76. }
  77. const rptTpls = await ctx.service.rptTpl.getAllTplByIds(params.rpt_ids);
  78. rptTpls.sort(function(rpt1, rpt2) {
  79. return params.rpt_ids.indexOf(rpt1.id) - params.rpt_ids.indexOf(rpt2.id);
  80. });
  81. for (let rtIdx = 0; rtIdx < rptTpls.length; rtIdx++) {
  82. const newRptTpl = JSON.parse(rptTpls[rtIdx].rpt_content);
  83. newRptTpl.id = rptTpls[rtIdx].id;
  84. newRptTpl.source_type = rptTpls[rtIdx].source_type || sourceTypeConst.defaultSourceType;
  85. rptTpls[rtIdx] = newRptTpl;
  86. }
  87. const rptDataUtil = new rptDataExtractor();
  88. const filterTables = [];
  89. const memFieldKeys = {};
  90. for (const rptTpl of rptTpls) {
  91. rptDataUtil.initialize(rptTpl);
  92. const filter = rptDataUtil.getDataRequestFilter();
  93. for (const table of filter.tables) {
  94. if (filterTables.indexOf(table) < 0 && needCustomTables.indexOf(table) < 0) {
  95. filterTables.push(table);
  96. }
  97. // memFieldKeys[table] = [];
  98. }
  99. for (const tableKeyProp in filter.memFieldKeys) {
  100. if (needCustomTables.indexOf(tableKeyProp) >= 0) continue;
  101. if (!memFieldKeys.hasOwnProperty(tableKeyProp)) {
  102. memFieldKeys[tableKeyProp] = [];
  103. }
  104. for (const mfKey of filter.memFieldKeys[tableKeyProp]) {
  105. if (memFieldKeys[tableKeyProp].indexOf(mfKey) < 0) {
  106. memFieldKeys[tableKeyProp].push(mfKey);
  107. }
  108. }
  109. }
  110. }
  111. const rawDataObj = await ctx.service.report.getReportData(rptTpls[0].source_type, params, filterTables, memFieldKeys, {}, {});
  112. try {
  113. const rptPageRstArray = [];
  114. // 2. 一个一个模板创建数据
  115. // let defProperties = await ctx.service.rptPreDefineCfg.getCfgById('Administrator');
  116. // defProperties = JSON.parse(defProperties[0].defined_content);
  117. const defProperties = RPT_DEF_PROPERTIES;
  118. for (let tplIdx = 0; tplIdx < rptTpls.length; tplIdx++) {
  119. const rptTpl = (rptTpls[tplIdx]._doc) ? rptTpls[tplIdx]._doc : rptTpls[tplIdx];
  120. rptDataUtil.initialize(rptTpl);
  121. let customSelect = rptTpl[JV.NODE_CUSTOM_DEFINE] && rptTpl[JV.NODE_CUSTOM_DEFINE][JV.NODE_CUS_AUDIT_SELECT].enable
  122. ? await ctx.service.rptCustomDefine.getCustomDefine(params.tender_id, params.stage_id, rptTpl.id)
  123. : await ctx.service.rptCustomDefine.getCustomDefine(params.tender_id, -1, rptTpl.id);
  124. if (rptTpl[JV.NODE_CUSTOM_DEFINE] && rptTpl[JV.NODE_CUSTOM_DEFINE][JV.NODE_CUS_CHANGE_SELECT] && rptTpl[JV.NODE_CUSTOM_DEFINE][JV.NODE_CUS_CHANGE_SELECT].enable) {
  125. customSelect = { tid: params.tender_id, rid: params.rpt_tpl_id, sid: -1, change_select: params.customSelect[tplIdx].change_select };
  126. }
  127. // 从汇总的rawDataObj中拷贝所需数据表至curRawDataObj,以供后续使用
  128. const curRawDataObj = {};
  129. const filter = rptDataUtil.getDataRequestFilter();
  130. for (const table of filter.tables) {
  131. curRawDataObj[table] = ctx.helper.clone(rawDataObj[table]);
  132. }
  133. // 如果是用户交互类型的表,则应该单独获取数据
  134. if ((params.customSelect && params.customSelect[tplIdx]) || rptTpl[JV.NODE_CUSTOM_DEFINE][JV.NODE_CUS_OPTION]) {
  135. const cfTables = [],
  136. cmFieldKeys = [];
  137. const curFilter = rptDataUtil.getDataRequestFilter();
  138. for (const table of curFilter.tables) {
  139. if (needCustomTables.indexOf(table) >= 0) {
  140. cfTables.push(table);
  141. }
  142. }
  143. for (const tableKeyProp in filter.memFieldKeys) {
  144. if (needCustomTables.indexOf(tableKeyProp) < 0) continue;
  145. if (!cmFieldKeys.hasOwnProperty(tableKeyProp)) {
  146. cmFieldKeys[tableKeyProp] = [];
  147. }
  148. for (const mfKey of filter.memFieldKeys[tableKeyProp]) {
  149. if (cmFieldKeys[tableKeyProp].indexOf(mfKey) < 0) {
  150. cmFieldKeys[tableKeyProp].push(mfKey);
  151. }
  152. }
  153. }
  154. const customRawDataObj = await ctx.service.report.getReportData(rptTpl.source_type, params, cfTables, cmFieldKeys,
  155. rptTpl[JV.NODE_CUSTOM_DEFINE], customSelect);
  156. for (const prop in customRawDataObj) {
  157. curRawDataObj[prop] = customRawDataObj[prop];
  158. }
  159. }
  160. const tplData = rptDataUtil.assembleData(ctx, curRawDataObj, baseDir, null, customSelect);
  161. const printCom = JpcEx.createNew();
  162. setupPageSize(rptTpl, params.pageSize);
  163. if (params.orientation && (params.orientation !== 'null')) rptTpl[JV.NODE_MAIN_INFO][JV.NODE_PAGE_INFO][JV.PROP_ORIENTATION] = params.orientation;
  164. if (params.custCfg) setupCustomizeCfg(params.custCfg, rptTpl, defProperties);
  165. const dftOption = params.option || JV.PAGING_OPTION_NORMAL;
  166. printCom.initialize(rptTpl);
  167. // console.log(rptTpl);
  168. const dftSplitArchives = [];
  169. if (params.splitArchives && params.splitArchives[tplIdx]) {
  170. dftSplitArchives.push(params.splitArchives[tplIdx]);
  171. }
  172. // printCom.analyzeData(ctx.helper, rptTpl, tplData, defProperties, dftOption, outputType, customSelect, params.splitArchives);
  173. printCom.analyzeData(ctx.helper, rptTpl, tplData, defProperties, dftOption, outputType, customSelect, dftSplitArchives);
  174. const maxPages = printCom.totalPages;
  175. let pageRst = null;
  176. // console.log(maxPages);
  177. if (maxPages > 0) {
  178. pageRst = printCom.outputAsSimpleJSONPageArray(ctx.helper, rptTpl, tplData, 1, maxPages, defProperties, params.custCfg, customSelect);
  179. } else {
  180. pageRst = printCom.outputAsPreviewPage(rptTpl, defProperties);
  181. }
  182. pageRst.id = rptTpl.id;
  183. if (tplData.splitArcPages) {
  184. pageRst.splitArcPages = tplData.splitArcPages;
  185. pageRst.splitArcPagesInfo = tplData.splitArcPagesInfo;
  186. }
  187. rptPageRstArray.push(pageRst);
  188. }
  189. return rptPageRstArray;
  190. } catch (ex) {
  191. console.log(`'报表数据异常(getMultiRptsCommon): project_id ${params.project_id}, tender_id: ${params.tender_id}, stage_id: ${params.stage_id}`);
  192. console.log(ex);
  193. } finally {
  194. //
  195. }
  196. }
  197. async getPreviewPagesWithDiscreteDataCommon(ctx, rawRptTpl, pageSize, baseDir, customSelect) {
  198. // 此方法是要获取带离散数据的预览页面
  199. const rptTpl = JSON.parse(rawRptTpl.rpt_content);
  200. let params = null;
  201. if (ctx.params) {
  202. params = {};
  203. params.tender_id = ctx.params.id;
  204. params.detail_id = ctx.params.did;
  205. }
  206. const rptDataUtil = new rptDataExtractor();
  207. rptDataUtil.initialize(rptTpl);
  208. const filter = rptDataUtil.getDataRequestFilter();
  209. const source_type = rawRptTpl.source_type;
  210. const rawDataObj = await ctx.service.report.getReportData(source_type, params, filter.tables, filter.memFieldKeys,
  211. rptTpl[JV.NODE_CUSTOM_DEFINE], null);
  212. try {
  213. const printCom = JpcEx.createNew();
  214. setupPageSize(rptTpl, pageSize);
  215. const defProperties = RPT_DEF_PROPERTIES;
  216. const tplData = rptDataUtil.assembleData(ctx, rawDataObj, baseDir, printCom, customSelect);
  217. setupSomeDftCustomizeCfg(rptTpl);
  218. printCom.initialize(rptTpl);
  219. printCom.analyzeData(ctx.helper, rptTpl, tplData, defProperties, JV.PAGING_OPTION_NORMAL, JV.OUTPUT_TYPE_NORMAL, customSelect, []);
  220. const maxPages = printCom.totalPages;
  221. let pageRst = null;
  222. //
  223. if (maxPages > 0) {
  224. pageRst = printCom.outputAsSimpleJSONPageArray(ctx.helper, rptTpl, tplData, 1, 1, defProperties, params.custCfg, customSelect);
  225. } else {
  226. pageRst = printCom.outputAsPreviewPage(rptTpl, defProperties);
  227. }
  228. return pageRst;
  229. } catch (ex) {
  230. console.log('报表数据异常, tender id: ' + params.tender_id);
  231. console.log(ex);
  232. }
  233. }
  234. async getAllPreviewPagesCommon(rawRptTpl, pageSize) {
  235. const printCom = JpcEx.createNew();
  236. const defProperties = RPT_DEF_PROPERTIES;
  237. const rptTpl = JSON.parse(rawRptTpl.rpt_content);
  238. setupPageSize(rptTpl, pageSize);
  239. setupSomeDftCustomizeCfg(rptTpl);
  240. printCom.initialize(rptTpl);
  241. const pageRst = printCom.outputAsPreviewPage(rptTpl, defProperties);
  242. return pageRst;
  243. }
  244. }
  245. return JpcReport;
  246. };
  247. function setupPageSize(rptTpl, pageSize) {
  248. // 如果模板设置的是A3,那么就不改动它的页规格(防止没有空间给流水数据,导致爆内存)
  249. if (rptTpl[JV.NODE_MAIN_INFO][JV.NODE_PAGE_INFO][JV.PROP_PAGE_SIZE] !== 'A3' && pageSize) {
  250. rptTpl[JV.NODE_MAIN_INFO][JV.NODE_PAGE_INFO][JV.PROP_PAGE_SIZE] = pageSize;
  251. }
  252. }
  253. function setupCustomizeCfg(customizeCfg, rptTpl, defProperties) {
  254. const tmpObj = {};
  255. // 1. 字体
  256. const newFonts = [];
  257. for (const font of defProperties.fonts) {
  258. const copyFont = {};
  259. copyFont.ID = font.ID;
  260. for (const fontProp of JV.FONT_PROPS) {
  261. copyFont[fontProp] = font[fontProp];
  262. }
  263. newFonts.push(copyFont);
  264. tmpObj[font.ID] = copyFont;
  265. }
  266. const private_setup_font = function(propStr, newFont) {
  267. if (tmpObj[propStr]) {
  268. tmpObj[propStr].Name = newFont.Name;
  269. tmpObj[propStr].FontHeight = String(newFont.FontHeight);
  270. tmpObj[propStr].FontBold = newFont.FontBold;
  271. tmpObj[propStr].FontItalic = newFont.FontItalic;
  272. tmpObj[propStr].FontUnderline = newFont.FontUnderline;
  273. }
  274. };
  275. for (const custFont of customizeCfg.fonts) {
  276. switch (custFont.CfgDispName) {
  277. case '表标题':
  278. private_setup_font('ReportTitle_Main', custFont);
  279. break;
  280. case '列标题':
  281. private_setup_font('HeaderColumn', custFont);
  282. private_setup_font('FooterColumn', custFont);
  283. break;
  284. case '正文内容':
  285. private_setup_font('Content', custFont);
  286. break;
  287. case '合计':
  288. private_setup_font('GrandTotal', custFont);
  289. private_setup_font('SectionTotal', custFont);
  290. break;
  291. case '表眉/表脚':
  292. private_setup_font('Header', custFont);
  293. private_setup_font('Footer', custFont);
  294. break;
  295. default:
  296. break;
  297. }
  298. }
  299. // 1.1 窄体
  300. if (tmpObj.Content_Narrow) {
  301. if (customizeCfg.isNarrow) {
  302. tmpObj.Content_Narrow.Name = 'Arial Narrow';
  303. } else {
  304. if (tmpObj.Content) {
  305. tmpObj.Content_Narrow.Name = tmpObj.Content.Name;
  306. } else {
  307. tmpObj.Content_Narrow.Name = '宋体';
  308. }
  309. }
  310. }
  311. defProperties.fonts = newFonts;
  312. // 2. 页边距
  313. rptTpl[JV.NODE_MAIN_INFO][JV.NODE_MARGINS][JV.PROP_LEFT] = customizeCfg.margins[JV.PROP_LEFT] / 10;
  314. rptTpl[JV.NODE_MAIN_INFO][JV.NODE_MARGINS][JV.PROP_RIGHT] = customizeCfg.margins[JV.PROP_RIGHT] / 10;
  315. rptTpl[JV.NODE_MAIN_INFO][JV.NODE_MARGINS][JV.PROP_TOP] = customizeCfg.margins[JV.PROP_TOP] / 10;
  316. rptTpl[JV.NODE_MAIN_INFO][JV.NODE_MARGINS][JV.PROP_BOTTOM] = customizeCfg.margins[JV.PROP_BOTTOM] / 10;
  317. // 3. 边框宽度
  318. if (customizeCfg.hasOwnProperty('borderThick')) {
  319. for (let i = 0; i < defProperties.styles.length; i++) {
  320. const style = defProperties.styles[i];
  321. if (style.ID === 'BORDER_ALL_AROUND') {
  322. for (const border of style.border_style) {
  323. border.LineWeight = customizeCfg.borderThick;
  324. }
  325. }
  326. }
  327. }
  328. // 4. 边框竖线
  329. if (!(customizeCfg.showVerticalLine)) {
  330. const private_copy_border = function(src) {
  331. const rst = {};
  332. rst.Position = src.Position;
  333. rst.LineWeight = src.LineWeight;
  334. rst.DashStyle = src.DashStyle;
  335. rst.Color = src.Color;
  336. return rst;
  337. };
  338. const newStyles = [];
  339. for (let i = 0; i < defProperties.styles.length; i++) {
  340. const style = defProperties.styles[i];
  341. newStyles.push(style);
  342. if (style.ID === 'BORDER_ALL_AROUND') {
  343. const newStyle = {};
  344. newStyle.ID = style.ID;
  345. newStyle.CfgDispName = style.CfgDispName;
  346. newStyle.border_style = [];
  347. for (const border of style.border_style) {
  348. const newBorder = private_copy_border(border);
  349. newStyle.border_style.push(newBorder);
  350. if (border.Position === 'Left' || border.Position === 'Right') {
  351. newBorder.LineWeight = 0;
  352. }
  353. }
  354. newStyles[newStyles.length - 1] = newStyle;
  355. }
  356. }
  357. defProperties.styles = newStyles;
  358. }
  359. // 5. 补0
  360. const private_Setup_Format = function(tabFields) {
  361. if (tabFields) {
  362. for (const tabField of tabFields) {
  363. if (tabField[JV.PROP_FORMAT]) {
  364. tabField[JV.PROP_FORMAT] = tabField[JV.PROP_FORMAT].replace(new RegExp('#', 'gm'), '0');
  365. }
  366. }
  367. }
  368. };
  369. if (customizeCfg.fillZero) {
  370. if (rptTpl[JV.NODE_FLOW_INFO]) {
  371. if (rptTpl[JV.NODE_FLOW_INFO][JV.NODE_FLOW_CONTENT]) private_Setup_Format(rptTpl[JV.NODE_FLOW_INFO][JV.NODE_FLOW_CONTENT][JV.PROP_FLOW_FIELDS]);
  372. if (rptTpl[JV.NODE_FLOW_INFO][JV.NODE_FLOW_PAGE_SUM]) private_Setup_Format(rptTpl[JV.NODE_FLOW_INFO][JV.NODE_FLOW_PAGE_SUM][JV.PROP_SUM_FIELDS]);
  373. if (rptTpl[JV.NODE_FLOW_INFO][JV.NODE_FLOW_SEG_SUM]) private_Setup_Format(rptTpl[JV.NODE_FLOW_INFO][JV.NODE_FLOW_SEG_SUM][JV.PROP_SUM_FIELDS]);
  374. if (rptTpl[JV.NODE_FLOW_INFO][JV.NODE_FLOW_GROUP] && rptTpl[JV.NODE_FLOW_INFO][JV.NODE_FLOW_GROUP][JV.PROP_GROUP_LINES]) private_Setup_Format(rptTpl[JV.NODE_FLOW_INFO][JV.NODE_FLOW_GROUP][JV.PROP_GROUP_LINES][JV.PROP_SUM_FIELDS]);
  375. if (rptTpl[JV.NODE_FLOW_INFO][JV.NODE_DISCRETE_INFO]) {
  376. for (const discrete of rptTpl[JV.NODE_FLOW_INFO][JV.NODE_DISCRETE_INFO]) {
  377. private_Setup_Format(discrete[JV.PROP_DISCRETE_FIELDS]);
  378. }
  379. }
  380. if (rptTpl[JV.NODE_FLOW_INFO_EX]) {
  381. if (rptTpl[JV.NODE_FLOW_INFO_EX][JV.NODE_FLOW_CONTENT]) private_Setup_Format(rptTpl[JV.NODE_FLOW_INFO_EX][JV.NODE_FLOW_CONTENT][JV.PROP_FLOW_FIELDS]);
  382. if (rptTpl[JV.NODE_FLOW_INFO_EX][JV.NODE_FLOW_PAGE_SUM]) private_Setup_Format(rptTpl[JV.NODE_FLOW_INFO_EX][JV.NODE_FLOW_PAGE_SUM][JV.PROP_SUM_FIELDS]);
  383. if (rptTpl[JV.NODE_FLOW_INFO_EX][JV.NODE_FLOW_SEG_SUM]) private_Setup_Format(rptTpl[JV.NODE_FLOW_INFO_EX][JV.NODE_FLOW_SEG_SUM][JV.PROP_SUM_FIELDS]);
  384. if (rptTpl[JV.NODE_FLOW_INFO_EX][JV.NODE_FLOW_GROUP]) private_Setup_Format(rptTpl[JV.NODE_FLOW_INFO_EX][JV.NODE_FLOW_GROUP][JV.PROP_SUM_FIELDS]);
  385. if (rptTpl[JV.NODE_FLOW_INFO_EX][JV.NODE_FLOW_GROUP] && rptTpl[JV.NODE_FLOW_INFO_EX][JV.NODE_FLOW_GROUP][JV.PROP_GROUP_LINES]) private_Setup_Format(rptTpl[JV.NODE_FLOW_INFO_EX][JV.NODE_FLOW_GROUP][JV.PROP_GROUP_LINES][JV.PROP_SUM_FIELDS]);
  386. if (rptTpl[JV.NODE_FLOW_INFO_EX][JV.NODE_DISCRETE_INFO]) {
  387. for (const discrete of rptTpl[JV.NODE_FLOW_INFO_EX][JV.NODE_DISCRETE_INFO]) {
  388. private_Setup_Format(discrete[JV.PROP_DISCRETE_FIELDS]);
  389. }
  390. }
  391. }
  392. } else if (rptTpl[JV.NODE_BILL_INFO]) {
  393. if (rptTpl[JV.NODE_BILL_INFO][JV.NODE_BILL_CONTENT]) private_Setup_Format(rptTpl[JV.NODE_BILL_INFO][JV.NODE_BILL_CONTENT][JV.PROP_BILL_FIELDS]);
  394. if (rptTpl[JV.NODE_BILL_INFO][JV.NODE_DISCRETE_INFO]) {
  395. for (const discrete of rptTpl[JV.NODE_BILL_INFO][JV.NODE_DISCRETE_INFO]) {
  396. private_Setup_Format(discrete[JV.PROP_DISCRETE_FIELDS]);
  397. }
  398. }
  399. } else if (rptTpl[JV.NODE_CROSS_INFO]) {
  400. if (rptTpl[JV.NODE_CROSS_INFO][JV.NODE_CROSS_CONTENT]) private_Setup_Format(rptTpl[JV.NODE_CROSS_INFO][JV.NODE_CROSS_CONTENT][JV.TAB_CROSS_FIELDS]);
  401. if (rptTpl[JV.NODE_CROSS_INFO][JV.NODE_CROSS_ROW]) private_Setup_Format(rptTpl[JV.NODE_CROSS_INFO][JV.NODE_CROSS_ROW][JV.TAB_CROSS_FIELDS]);
  402. if (rptTpl[JV.NODE_CROSS_INFO][JV.NODE_CROSS_COL]) private_Setup_Format(rptTpl[JV.NODE_CROSS_INFO][JV.NODE_CROSS_COL][JV.TAB_CROSS_FIELDS]);
  403. if (rptTpl[JV.NODE_CROSS_INFO][JV.NODE_CROSS_COL_SUM]) private_Setup_Format(rptTpl[JV.NODE_CROSS_INFO][JV.NODE_CROSS_COL_SUM][JV.TAB_CROSS_FIELDS]);
  404. if (rptTpl[JV.NODE_CROSS_INFO][JV.NODE_CROSS_ROW_EXT]) private_Setup_Format(rptTpl[JV.NODE_CROSS_INFO][JV.NODE_CROSS_ROW_EXT][JV.TAB_CROSS_FIELDS]);
  405. if (rptTpl[JV.NODE_CROSS_INFO][JV.NODE_CROSS_ROW_SUM_EXT]) private_Setup_Format(rptTpl[JV.NODE_CROSS_INFO][JV.NODE_CROSS_ROW_SUM_EXT][JV.TAB_CROSS_FIELDS]);
  406. if (rptTpl[JV.NODE_CROSS_INFO][JV.NODE_DISCRETE_INFO]) {
  407. for (const discrete of rptTpl[JV.NODE_CROSS_INFO][JV.NODE_DISCRETE_INFO]) {
  408. private_Setup_Format(discrete[JV.PROP_DISCRETE_FIELDS]);
  409. }
  410. }
  411. }
  412. }
  413. }
  414. function setupSomeDftCustomizeCfg(rptTpl) {
  415. rptTpl[JV.NODE_MAIN_INFO][JV.NODE_MARGINS][JV.PROP_LEFT] = 1.5;
  416. rptTpl[JV.NODE_MAIN_INFO][JV.NODE_MARGINS][JV.PROP_RIGHT] = 1.5;
  417. rptTpl[JV.NODE_MAIN_INFO][JV.NODE_MARGINS][JV.PROP_TOP] = 1.5;
  418. rptTpl[JV.NODE_MAIN_INFO][JV.NODE_MARGINS][JV.PROP_BOTTOM] = 1.5;
  419. }