Przeglądaj źródła

Merge remote-tracking branch 'origin/dev' into weapp

lanjianrong 3 dni temu
rodzic
commit
18d0ed66a3

+ 22 - 3
app/reports/rpt_component/jpc_flow_tab.js

@@ -1022,6 +1022,7 @@ JpcFlowTabSrv.prototype.createNew = function() {
             rst = rst.concat(tabRstLst[i]);
             tabRstLst[i] = null;
         }
+        me.checkCombineEvent(JV.RUN_TYPE_AFTER_COMBINE, [], [], rst, $CURRENT_RPT, dataObj, me, page);
         return rst;
     };
     JpcFlowTabResult.setPageFlow = function(rptTpl, dataObj, page, thisPageRst, $CURRENT_RPT) {
@@ -1178,6 +1179,11 @@ JpcFlowTabSrv.prototype.createNew = function() {
         // 另:要考虑紧密输出情况,需要重新拆分数据
         // const regSplit = new RegExp('\\|', 'g');
         const _splitValues = function(oCell) {
+            let chkFontName = '宋体';
+            let chkFontHeight = 12;
+            const tmpVal = (`${oCell.Value || ''}`).replace(/\|/g, '');
+            const area = oCell.area;
+
             // JpcFieldHelper.setValue(data_field, theRecIdx, value);
             const values = (typeof oCell.Value === 'string') ? oCell.Value.split('|') : [oCell.Value];
             let font = oCell[JV.PROP_FONT];
@@ -1186,12 +1192,24 @@ JpcFlowTabSrv.prototype.createNew = function() {
             }
             // // if (values.length > rst) rst = values.length; // 考虑到紧凑输出,不能那么快设置rst
             // const font = private_get_font(tab_field[JV.PROP_FONT]);
-            let chkFontName = '宋体';
-            let chkFontHeight = 12;
             if (font) {
                 chkFontName = font[JV.FONT_PROPS[0]];
                 chkFontHeight = parseFloat(font[JV.FONT_PROPS[JV.FONT_PROP_IDX_HEIGHT]]);
             }
+
+            while (chkFontHeight >= 6) {
+                const tmpChnW = fontWidthMap.getFontWidth(chkFontName, chkFontHeight, '宽');
+                const tmpOtherW = fontWidthMap.getFontWidth(chkFontName, chkFontHeight, '窄');
+                let lines = Math.floor((area.Bottom - area.Top) / (chkFontHeight + JV.OUTPUT_OFFSET[JV.OFFSET_IDX_BOTTOM] + JV.OUTPUT_OFFSET[JV.OFFSET_IDX_TOP] + 4));
+                lines = lines === 0 ? 1 : lines; // lines是该单元格可容纳的行数
+                const tmpValues = JpcCommonHelper.splitString(oCell.area, tmpVal, tmpChnW, tmpOtherW);
+                if (lines < tmpValues.length) {
+                    chkFontHeight -= 1;
+                } else {
+                    break;
+                }
+            }
+
             let hasSplitStr = false;
             const splitStrArr = [];
             let accAmt = 0;
@@ -1345,6 +1363,7 @@ JpcFlowTabSrv.prototype.createNew = function() {
                     // 要拆分下数据
                     _splitValues(rCell);
                     setupControl(rCell, controls, true);
+                    rCell[JV.PROP_CONTROL].ShrinkFirst = 'T';
                 }
             }
         }
@@ -1560,7 +1579,7 @@ JpcFlowTabSrv.prototype.createNew = function() {
         }
         me.checkCombineEvent(JV.RUN_TYPE_BEFORE_COMBINE, verticalCombinePos, horizonCombinePos, rst, $CURRENT_RPT, dataObj, me, page);
         me.combinePageCells(rst, verticalCombinePos, horizonCombinePos, controls, fonts);
-        me.checkCombineEvent(JV.RUN_TYPE_AFTER_COMBINE, verticalCombinePos, horizonCombinePos, rst, $CURRENT_RPT, dataObj, me, page);
+        // me.checkCombineEvent(JV.RUN_TYPE_AFTER_COMBINE, verticalCombinePos, horizonCombinePos, rst, $CURRENT_RPT, dataObj, me, page);
         return rst;
     };
     JpcFlowTabResult.checkCombineEvent = function($RUN_TYPE, $VER_COMB_ARRAY, $HOR_COMB_ARRAY, $CURRENT_CELL_ITEMS, $CURRENT_RPT, $CURRENT_DATA, $PARENT, $PAGE) {

+ 6 - 4
app/service/stage_pay.js

@@ -304,10 +304,12 @@ module.exports = app => {
         async getSpecialTotalPrice(stage) {
             if (!stage) throw '计算数据错误';
             const stagePays = await this.getStagePays(stage);
-            const PayCalculator = require('../lib/pay_calc');
-            const tenderInfo = await this.ctx.service.tenderInfo.getTenderInfo(stage.tid);
-            const payCalculator = new PayCalculator(this.ctx, stage, tenderInfo);
-            await payCalculator.calculateAll(stagePays);
+            if (!stage.readOnly) {
+                const PayCalculator = require('../lib/pay_calc');
+                const tenderInfo = await this.ctx.service.tenderInfo.getTenderInfo(stage.tid);
+                const payCalculator = new PayCalculator(this.ctx, stage, tenderInfo);
+                await payCalculator.calculateAll(stagePays);
+            }
             const yf = this._.find(stagePays, {ptype: payConst.payType.yf});
             const sf = this._.find(stagePays, {ptype: payConst.payType.sf});
             return { yf: yf ? yf.tp : 0, sf: sf ? sf.tp : 0 };