Explorar el Código

Merge branch 'master' of http://192.168.1.41:3000/SmartCost/YangHuCost

zhangweicheng hace 4 años
padre
commit
ccb1f84c08

+ 12 - 4
modules/pm/controllers/pm_controller.js

@@ -105,6 +105,7 @@ module.exports = {
     updateMixDatas: async function (req, res) {
         let datas = JSON.parse(req.body.data).mixDataArr;
         let functions = [];
+        let specialResult = {};
 
         function updateFunc(model, cod, doc) {
             return function (cb) {
@@ -134,13 +135,20 @@ module.exports = {
                 const engineeringItem = _.find(datas.properties['property.projectFeature'], { key: 'engineering' });
                 const feeStandardItem = _.find(datas.properties['property.projectFeature'], { key: 'feeStandard' });
                 if (engineeringItem && engineeringItem.value && feeStandardItem && feeStandardItem.value) {
-                    const project = await projectModel.findOne({ ID: datas.projectID }, { 'property.valuation': 1 }).lean();
+                    const project = await projectModel.findOne({ ID: datas.projectID }, { 'property.valuation': 1, 'property.engineering_id': 1 }).lean();
                     if (project) {
-                        const engineering = await engineeringModel.findOne({ valuationID: project.property.valuation, name: engineeringItem.value, feeName: feeStandardItem.value }, { _id: 1 }).lean();
-                        if (engineering) {
+                        const orgEngineeringID = project.property.engineering_id;
+                        const engineering = await engineeringModel.findOne({ valuationID: project.property.valuation, name: engineeringItem.value, feeName: feeStandardItem.value }, { _id: 1, tax_group: 1, bill_lib: 1 }).lean();
+                        if (engineering && orgEngineeringID !== engineering._id.toString()) {
                             datas.properties['property.engineeringName'] = engineeringItem.value;
                             datas.properties['property.feeStandardName'] = feeStandardItem.value;
                             datas.properties['property.engineering_id'] = engineering._id.toString();
+                            if (engineering.tax_group && engineering.tax_group[0] && engineering.tax_group[0].fee_lib) {
+                                // 工程专业变更,需要更改费率
+                                specialResult.newFeeLibID = engineering.tax_group[0].fee_lib.id;
+                            }
+                            specialResult.billLibs = engineering.bill_lib;
+                            
                         }
                     }
                 }
@@ -175,7 +183,7 @@ module.exports = {
         asyncTool.parallel(functions, function (err, result) {
             {
                 if (!err) {
-                    res.json({ error: 0, message: err, data: result });
+                    res.json({ error: 0, message: err, data: specialResult});
                 } else {
                     res.json({ error: 1, message: err, data: null });
                 }

+ 5 - 4
modules/reports/rpt_component/jpc_flow_tab.js

@@ -85,7 +85,7 @@ JpcFlowTabSrv.prototype.createNew = function(){
                 if (segAutoHeightInfo[segIdx].length > startRecIdx + vi) {
                     couldBreak = private_addAutoHeightPageValue(vi);
                     // if (couldBreak) break;
-                } else if (vIdx.length < maxRecPerPage) {
+                } else if (vIdx.length > 0 && vIdx.length < maxRecPerPage) {
                     vIdx.push([followMode, JV.DISPLAY_VAL_TYPE_NORMAL, JV.BLANK_VALUE_INDEX]);
                 }
             } else {
@@ -637,7 +637,7 @@ JpcFlowTabSrv.prototype.createNew = function(){
                                 if (currentRecAmt + accAutoHeightAmt + adHocAutoHeightAmt + maxRowRec >= ttlSegRecAmt) {
                                     pageStatus[JV.STATUS_SEGMENT_END] = true;
                                     private_resetBandArea();
-                                    let hasAdHocRow = !JpcFlowTabHelper.chkSegEnd(bands, rptTpl, ttlSegRecAmt, currentRecAmt + adHocAutoHeightAmt, maxRowRec, me.isEx);
+                                    let hasAdHocRow = !JpcFlowTabHelper.chkSegEnd(bands, rptTpl, ttlSegRecAmt, currentRecAmt + accAutoHeightAmt + adHocAutoHeightAmt, maxRowRec, me.isEx);
                                     if (hasAdHocRow) {
                                         //add page info(pre segment end)
                                         pageStatus[JV.STATUS_SEGMENT_END] = false;
@@ -655,7 +655,7 @@ JpcFlowTabSrv.prototype.createNew = function(){
                                 if (currentRecAmt + accAutoHeightAmt + adHocAutoHeightAmt + maxRowRec >= ttlSegRecAmt) {
                                     pageStatus[JV.STATUS_SEGMENT_END] = true;
                                     private_resetBandArea();
-                                    let hasAdHocRow = !JpcFlowTabHelper.chkSegEnd(bands, rptTpl, ttlSegRecAmt, currentRecAmt + adHocAutoHeightAmt, maxRowRec, me.isEx);
+                                    let hasAdHocRow = !JpcFlowTabHelper.chkSegEnd(bands, rptTpl, ttlSegRecAmt, currentRecAmt + accAutoHeightAmt + adHocAutoHeightAmt, maxRowRec, me.isEx);
                                     if (hasAdHocRow) {
                                         //add page info(pre segment end)
                                         pageStatus[JV.STATUS_SEGMENT_END] = false;
@@ -668,7 +668,8 @@ JpcFlowTabSrv.prototype.createNew = function(){
                                         //纯 followTabEx 数据啦
                                         private_addPage(segIdx, null, true, false, -1);
                                     } else {
-                                        private_addPage(segIdx, grpSeqInfo, false, true, ttlSegRecAmtNormal);
+                                        let splitPoint = ttlSegRecAmtNormal - handledRowAmt ;
+                                        private_addPage(segIdx, grpSeqInfo, false, true, splitPoint);
                                     }
                                 } else {
                                     //在这里要考虑如果有多页正常的流水数据情况,那么就得考虑这页有多少条普通流水记录,不应该一刀切地用ttlSegRecAmtNormal

+ 42 - 22
web/building_saas/main/js/views/project_view.js

@@ -2758,32 +2758,52 @@ $('#property_ok').click(function () {
 
     if(hasMixData()){
         CommonAjax.post('/pm/api/updateMixDatas', {user_id: userID, mixDataArr: mixDatas}, function (rstData) {
-            //需要重载页面
-            if(needToReload(mixDatas)){
-                window.location.href = '/main?project=' + projectID;
-            }
-            else{
-                if(mixDatas.properties.hasOwnProperty('property.maxPriceRate')){
-                    projectObj.project.property.maxPriceRate = maxPriceRate;
-                }
-                if(mixDatas.properties.hasOwnProperty('property.minPriceRate')){
-                    projectObj.project.property.minPriceRate = minPriceRate;
-                }
-                if(mixDatas.properties.hasOwnProperty('property.basicInformation')){
-                    basicInfoView.orgDatas = basicInfoView.toViewDatas(mixDatas.properties['property.basicInformation']);
+            const doAferSuccess = () => {
+                $.bootstrapLoading.end();
+                //需要重载页面
+                if(needToReload(mixDatas)){
+                    window.location.href = '/main?project=' + projectID;
                 }
-                if(mixDatas.properties.hasOwnProperty('property.projectFeature')){
-                    projFeatureView.orgDatas = projFeatureView.toViewDatas(mixDatas.properties['property.projectFeature']);
+                else{
+                    if(mixDatas.properties.hasOwnProperty('property.maxPriceRate')){
+                        projectObj.project.property.maxPriceRate = maxPriceRate;
+                    }
+                    if(mixDatas.properties.hasOwnProperty('property.minPriceRate')){
+                        projectObj.project.property.minPriceRate = minPriceRate;
+                    }
+                    if(mixDatas.properties.hasOwnProperty('property.basicInformation')){
+                        basicInfoView.orgDatas = basicInfoView.toViewDatas(mixDatas.properties['property.basicInformation']);
+                    }
+                    if(mixDatas.properties.hasOwnProperty('property.projectFeature')){
+                        projFeatureView.orgDatas = projFeatureView.toViewDatas(mixDatas.properties['property.projectFeature']);
+                    }
+                    if(mixDatas.options && mixDatas.options.updateData){
+                        let v1 = mixDatas.options.updateData['rationQuanACToBillsQuan'],
+                            v2 = mixDatas.options.updateData['rationQuanACToRationUnit'],
+                            progressiveType = mixDatas.options.updateData['progressiveType']  ;
+                        optionsOprObj.updateOptions(optionsOprObj.options, {type: optionsOprObj.optionsTypes.GENERALOPTS, opt: 'rationQuanACToBillsQuan', value: v1});
+                        optionsOprObj.updateOptions(optionsOprObj.options, {type: option-sOprObj.optionsTypes.GENERALOPTS, opt: 'rationQuanACToRationUnit', value: v2});
+                        optionsOprObj.updateOptions(optionsOprObj.options, {type: optionsOprObj.optionsTypes.GENERALOPTS, opt: 'progressiveType', value: progressiveType});
+                    }
                 }
-                if(mixDatas.options && mixDatas.options.updateData){
-                    let v1 = mixDatas.options.updateData['rationQuanACToBillsQuan'],
-                        v2 = mixDatas.options.updateData['rationQuanACToRationUnit'],
-                        progressiveType = mixDatas.options.updateData['progressiveType']  ;
-                    optionsOprObj.updateOptions(optionsOprObj.options, {type: optionsOprObj.optionsTypes.GENERALOPTS, opt: 'rationQuanACToBillsQuan', value: v1});
-                    optionsOprObj.updateOptions(optionsOprObj.options, {type: optionsOprObj.optionsTypes.GENERALOPTS, opt: 'rationQuanACToRationUnit', value: v2});
-                    optionsOprObj.updateOptions(optionsOprObj.options, {type: optionsOprObj.optionsTypes.GENERALOPTS, opt: 'progressiveType', value: progressiveType});
+            }
+            // 改变清单库
+            if (rstData && rstData.billLibs) {
+                projectObj.project.projectInfo.engineeringInfo.bill_lib = rstData.billLibs;
+                $('#stdBillsGuidanceLibSelect').empty();
+                if ($('#zy').is(':visible')) {
+                    billsGuidance.initLibs(rstData.billLibs);
                 }
             }
+            // 需要改变费率
+            if (rstData && rstData.newFeeLibID) {
+                $.bootstrapLoading.start();
+                feeRateObject.feeRateSTDLoaded = false;
+                feeRateObject.feeRateSTDList = [];
+                projectObj.project.FeeRate.changeFeeRateStandard(rstData.newFeeLibID,doAferSuccess);
+            } else {
+                doAferSuccess();
+            }
         });
     }
 });

+ 1 - 1
web/building_saas/main/js/views/std_billsGuidance_lib.js

@@ -1330,7 +1330,7 @@ const billsGuidance = (function () {
         }
     }
 
-    return {initViews, bindBtn, refreshWorkBook, setColumnWidthByRate, locateAtBills, bills, elfItem, overwrite};
+    return {initViews, initLibs, bindBtn, refreshWorkBook, setColumnWidthByRate, locateAtBills, bills, elfItem, overwrite};
 })();
 
 $(document).ready(function(){

+ 9 - 1
web/building_saas/report/js/jpc_output.js

@@ -113,6 +113,13 @@ let JpcCanvasOutput = {
             if (rst.length === 0) rst.push(''); //什么都没有,也得整个空串
             return rst;
         }
+        function _chkIfShinkFirst(control, actLines) {
+            let rst = false;
+            if (control.ShrinkFirst === 'T' && control.Wrap !== 'T' && actLines > 1) {
+                rst = true;
+            }
+            return rst;
+        }
         function private_drawText(val, area, font, control) {
             let dftFontHeight = 12;
             let output = [];
@@ -211,7 +218,8 @@ let JpcCanvasOutput = {
                     let lines = Math.floor((area[JV.IDX_BOTTOM] - area[JV.IDX_TOP]) / (dftFontHeight + JV.OUTPUT_OFFSET[JV.OFFSET_IDX_BOTTOM] + JV.OUTPUT_OFFSET[JV.OFFSET_IDX_TOP] + 4));
                     lines = (lines === 0 || (control.Shrink === 'T' && control.ShrinkFirst === 'T'))?1:lines;
                     let actLines = private_splitString(val, validAreaTxtWidth, ctx);
-                    if (actLines.length > lines && dftFontHeight >= 6) {
+                    // if (actLines.length > lines && dftFontHeight >= 6) {
+                    if ((actLines.length > lines || _chkIfShinkFirst(control, actLines.length)) && dftFontHeight >= 6) {
                         dftFontHeight--;
                         ctx.font = "" + dftFontHeight + "px " + font[JV.PROP_NAME];
                     } else {