Explorar o código

Merge branch 'master' into olym

olym %!s(int64=7) %!d(string=hai) anos
pai
achega
8c0f1f5c54

+ 53 - 3
modules/reports/rpt_component/jpc_flow_tab.js

@@ -85,6 +85,7 @@ JpcFlowTabSrv.prototype.createNew = function(){
         me.seg_sum_fields_idx = [];
         me.seg_sum_tab_fields = [];
         me.page_sum_fields_idx = [];
+        me.page_sum_tab_fields = [];
 
         me.group_fields = [];
         me.group_sum_fields = [];
@@ -95,6 +96,7 @@ JpcFlowTabSrv.prototype.createNew = function(){
         me.pageStatusLst = [];
         me.groupSumValLst = [];
         me.segSumValLst = [];
+        me.pageSumValLst = [];
         me.multiCols = 1;
         me.pagesAmt = 0;
     };
@@ -102,7 +104,7 @@ JpcFlowTabSrv.prototype.createNew = function(){
         let me = this;
         let FLOW_NODE_STR = me.isEx?JV.NODE_FLOW_INFO_EX:JV.NODE_FLOW_INFO;
         JpcFieldHelper.findAndPutDataFieldIdx(rptTpl, rptTpl[FLOW_NODE_STR][JV.NODE_FLOW_SEG_SUM][JV.PROP_SUM_FIELDS], me.seg_sum_tab_fields, me.seg_sum_fields_idx, me.isEx);
-        JpcFieldHelper.findAndPutDataFieldIdx(rptTpl, rptTpl[FLOW_NODE_STR][JV.NODE_FLOW_PAGE_SUM][JV.PROP_SUM_FIELDS], null, me.page_sum_fields_idx, me.isEx);
+        JpcFieldHelper.findAndPutDataFieldIdx(rptTpl, rptTpl[FLOW_NODE_STR][JV.NODE_FLOW_PAGE_SUM][JV.PROP_SUM_FIELDS], me.page_sum_tab_fields, me.page_sum_fields_idx, me.isEx);
         JpcFieldHelper.findAndPutDataFieldIdx(rptTpl, rptTpl[FLOW_NODE_STR][JV.NODE_FLOW_GROUP][JV.PROP_GROUP_FIELDS], me.group_fields, null, me.isEx);
         JpcFieldHelper.findAndPutDataFieldIdx(rptTpl, rptTpl[FLOW_NODE_STR][JV.NODE_FLOW_GROUP][JV.PROP_SUM_FIELDS], me.group_sum_fields, null, me.isEx);
         for (let si = 0; si < dataSeq.length; si++) {
@@ -355,15 +357,18 @@ JpcFlowTabSrv.prototype.createNew = function(){
                     } else {
                         if (currentRecAmt + maxRowRec >= ttlSegRecAmt) {
                             pageStatus[JV.STATUS_SEGMENT_END] = true;
+                            pageStatus[JV.STATUS_REPORT_END] = true;
                             private_resetBandArea();
                             let hasAdHocRow = !JpcFlowTabHelper.chkSegEnd(bands, rptTpl, ttlSegRecAmt, currentRecAmt, maxRowRec, me.isEx);
                             if (hasAdHocRow) {
                                 //add page info(pre segment end)
                                 pageStatus[JV.STATUS_SEGMENT_END] = false;
+                                pageStatus[JV.STATUS_REPORT_END] = false;
                                 private_addPage(segIdx, grpSeqInfo, false, false, -1);
                             }
                             //add page info
                             pageStatus[JV.STATUS_SEGMENT_END] = true;
+                            pageStatus[JV.STATUS_REPORT_END] = true;
                             private_addPage(segIdx, grpSeqInfo, false, false, -1);
                         } else {
                             private_addPage(segIdx, grpSeqInfo, false, false, -1);
@@ -503,6 +508,7 @@ JpcFlowTabSrv.prototype.createNew = function(){
             // 2.3 Sum Seg
             tabRstLst.push(me.outputSegSum(rptTpl, dataObj, page, segIdx, bands, unitFactor, controls));
             // 2.4 Sum Page
+            tabRstLst.push(me.outputPageSum(rptTpl, dataObj, page, segIdx, bands, unitFactor, controls));
             // 2.5 Group
             // 2.6 Discrete
             tabRstLst.push(JpcDiscreteHelper.outputDiscreteInfo(rptTpl[FLOW_NODE_STR][JV.NODE_DISCRETE_INFO], bands, dataObj, unitFactor, me.pageStatusLst[page - 1], segIdx, 1, 0, $CURRENT_RPT));
@@ -536,6 +542,7 @@ JpcFlowTabSrv.prototype.createNew = function(){
                 // 2.3 Sum Seg
                 tabRstLst.push(me.outputSegSum(rptTpl, dataObj, actualPage, segIdx, bands, unitFactor, controls));
                 // 2.4 Sum Page
+                tabRstLst.push(me.outputPageSum(rptTpl, dataObj, actualPage, segIdx, bands, unitFactor, controls));
                 // 2.5 Group
                 // 2.6 Discrete
                 if (pi === 0) {
@@ -563,6 +570,15 @@ JpcFlowTabSrv.prototype.createNew = function(){
                 let data_details = me.isEx?dataObj[JV.DATA_DETAIL_DATA_EX]:dataObj[JV.DATA_DETAIL_DATA];
                 let data_details_ex = $CURRENT_RPT.isFollowMode?dataObj[JV.DATA_DETAIL_DATA_EX]:null;
                 let contentValuesIdx = me.dispValueIdxLst[page - 1];
+                let page_sum_data_fields = [];
+                for (let i = 0; i < me.page_sum_fields_idx.length; i++) {
+                    let data_field = data_details[me.page_sum_fields_idx[i]];
+                    page_sum_data_fields.push(data_field);
+                }
+                let rowGrandTotal = [];
+                for (let di = 0; di < page_sum_data_fields.length; di++) {
+                    rowGrandTotal.push(0.0);
+                }
                 //normal content
                 for (let rowIdx = 0; rowIdx < contentValuesIdx.length; rowIdx++) {
                     for (let i = 0; i < tab_fields.length; i++) {
@@ -603,7 +619,12 @@ JpcFlowTabSrv.prototype.createNew = function(){
                             }
                         }
                     }
+                    //page sum content
+                    for (let di = 0; di < page_sum_data_fields.length; di++) {
+                        rowGrandTotal[di] = rowGrandTotal[di] + 1.0 * JpcFieldHelper.getValue(page_sum_data_fields[di], contentValuesIdx[rowIdx][2]);
+                    }
                 }
+                me.pageSumValLst.push(rowGrandTotal);
                 //grouping content
                 for (let rowIdx = 0; rowIdx < contentValuesIdx.length; rowIdx++) {
                     if (contentValuesIdx[rowIdx][1] === JV.DISPLAY_VAL_TYPE_GROUP) {
@@ -672,6 +693,35 @@ JpcFlowTabSrv.prototype.createNew = function(){
         }
         return rst;
     };
+    JpcFlowTabResult.outputPageSum = function (rptTpl, dataObj, page, segIdx, bands, unitFactor, controls) {
+        let me = this, rst = [];
+        let FLOW_NODE_STR = me.isEx?JV.NODE_FLOW_INFO_EX:JV.NODE_FLOW_INFO;
+        let tab = rptTpl[FLOW_NODE_STR][JV.NODE_FLOW_PAGE_SUM];
+        let band = bands[tab[JV.PROP_BAND_NAME]];
+        if (band) {
+            let pageStatus = me.pageStatusLst[page - 1];
+            if (pageStatus[band[JV.BAND_PROP_DISPLAY_TYPE]]) {
+                let tab_fields = me.page_sum_tab_fields;
+                for (let i = 0; i < tab_fields.length; i++) {
+                    let cellItem = JpcCommonOutputHelper.createCommonOutput(tab_fields[i], me.pageSumValLst[page - 1], controls);
+                    cellItem[JV.PROP_AREA] = JpcAreaHelper.outputArea(tab_fields[i][JV.PROP_AREA], band, unitFactor, 1, 0, 1, 0, me.multiCols, 0, true, false);
+                    rst.push(cellItem);
+                }
+                if (tab[JV.PROP_TEXT]) {
+                    rst.push(JpcTextHelper.outputText(tab[JV.PROP_TEXT], band, unitFactor, 1, 0, 1, 0, me.multiCols, 0));
+                }
+                if (tab[JV.PROP_TEXTS]) {
+                    for (let j = 0; j < tab[JV.PROP_TEXTS].length; j++) {
+                        rst.push(JpcTextHelper.outputText(tab[JV.PROP_TEXTS][j], band, unitFactor, 1, 0, 1, 0, me.multiCols, 0));
+                    }
+                }
+                if (tab[JV.NODE_DISCRETE_INFO]) {
+                    rst = rst.concat(JpcDiscreteHelper.outputDiscreteInfo(tab[JV.NODE_DISCRETE_INFO], bands, dataObj, unitFactor, me.pageStatusLst[page - 1], segIdx, me.multiCols, 0));
+                }
+            }
+        }
+        return rst;
+    };
     JpcFlowTabResult.outputTabField = function (band, tab_field, data_field, valueIdx, serialIdx, rows, rowIdx, cols, colIdx, unitFactor, isRow, controls, multiColIdx) {
         let me = this,
             rst = JpcCommonOutputHelper.createCommonOutput(tab_field, JpcFieldHelper.getValue(data_field, valueIdx), controls);
@@ -695,10 +745,10 @@ JpcFlowTabSrv.prototype.createNew = function(){
             }
         }
         if (grp_line[JV.PROP_DISCRETE_FIELDS]) {
-            //
+            //暂时不支持
         }
         if (grp_line[JV.PROP_PARAMS]) {
-            //
+            //暂时不支持
         }
         // console.log(rst);
         return rst;

+ 2 - 2
modules/reports/util/rpt_construct_data_util.js

@@ -747,7 +747,7 @@ function ext_getFee(feeKey, dtlFeeKey) {
 function pri_getFee(dItem, feeKey, dtlFeeKey) {
     let rst = 0;
     let hasValue = false;
-    if (dItem.hasOwnProperty("fees")) {
+    if (dItem["fees"]) {
         for (let fee of dItem["fees"]) {
             if (fee["fieldName"] === feeKey) {
                 if (dtlFeeKey) {
@@ -759,7 +759,7 @@ function pri_getFee(dItem, feeKey, dtlFeeKey) {
                 break;
             }
         }
-    } else if (dItem.hasOwnProperty(feeKey)) {
+    } else if (dItem[feeKey]) {
         hasValue = true;
         rst = dItem[feeKey];
     } else {

+ 2 - 2
test/unit/reports/test_tpl_09.js

@@ -44,8 +44,8 @@ let demoRptId = 232, pagesize = "A4";
 
 let userId_Leng = 1142; //小冷User Id
 // demoPrjId = 720; //QA: DW3
-demoPrjId = 1296; //QA:
-//*/
+demoPrjId = 1348; //QA:
+/*/
 let userId_Dft = userId_Leng;
 /*/
  let userId_Dft = 76075;

+ 29 - 2
web/building_saas/glj/js/project_glj.js

@@ -26,6 +26,7 @@ let usedTenderList = [];
 let otherFileData = {};
 let currentTag = '';
 let isChanging = false;
+let initPage = false;
 $(document).ready(function () {
     $('#tab_gongliaoji').on('show.bs.tab', function (e) {
         $(e.relatedTarget.hash).removeClass('active');
@@ -225,7 +226,7 @@ $(document).ready(function () {
  */
 function init() {
     projectObj.project.projectGLJ.loadData(function (data) {
-        if (jsonData.length <= 0) {
+        if (initPage==false||jsonData.length <= 0) {
             // 赋值
             jsonData = data.gljList !== undefined && data.gljList.length > 0 ? data.gljList : [];
             jsonData = filterProjectGLJ(jsonData);
@@ -245,6 +246,7 @@ function init() {
             unitPriceFileInit();
 
             setTimeout(spreadInit, 1);
+            initPage=true;
         } else {
             projectObj.project.projectGLJ.loadCacheData();
         }
@@ -325,7 +327,7 @@ function getUsedTenderInfo() {
  * @param {object} info
  * @return {void}
  */
-function successTrigger(field, info) {
+function successTrigger(field, info,id) {
     let updateData = {};
     switch (field) {
         case 'unit_price.market_price':
@@ -339,6 +341,9 @@ function successTrigger(field, info) {
             // 供货方式更改成功后
             projectGLJSpread.changeSupplyType(info);
             break;
+        case 'is_evaluate':
+            changeIsEvaluate(id);
+            break;
     }
     // 重新加载数据到缓存
     projectObj.project.projectGLJ.loadData(function () {
@@ -350,6 +355,28 @@ function successTrigger(field, info) {
     gljOprObj.refreshView();
 }
 
+//更新是否暂估
+function changeIsEvaluate (id){
+    let projectGLJ = projectObj.project.projectGLJ
+    let datas = projectGLJ.datas;
+    let gljList = datas.gljList;
+    let glj = _.find(gljList, {'id': id});
+    if(glj){
+        let con_key = gljOprObj.getIndex(glj,gljKeyArray);
+        let pratioM =datas.mixRatioConnectData[con_key];//找到父key
+        let conditions = [];
+        if(pratioM&&pratioM.length>0){
+            for(let p_key in pratioM ){
+                conditions.push(gljOprObj.getConditionByKey(p_key));
+            }
+        }
+        let gljs = projectGLJ.getProjectGLJs(conditions,false);
+        gljs.push(glj);
+        let nodes = projectGLJ.getImpactRationNodes(gljs);//取到因为改变工料机价格而受影响的定额
+        projectObj.project.calcProgram.calcRationsAndSave(nodes);//触发计算程序
+    }
+}
+
 /**
  * socket.io相关初始化
  *

+ 30 - 15
web/building_saas/glj/js/project_glj_spread.js

@@ -48,7 +48,7 @@ ProjectGLJSpread.prototype.init = function () {
         {name: 'ID', field: 'id', visible: false},
         {name: '类型', field: 'unit_price.type', visible: false},
         {name: '总消耗量', field: 'quantity', visible: true,width:100,decimalField:'glj.quantity'},
-        {name: '定额价', field: "base_price", visible: true,width:70,decimalField:"glj.unitPrice"},
+        {name: '定额价', field: "base_price", visible: true,width:70,decimalField:"glj.unitPrice",validator: 'number'},//这里feiedID设置是为了在计不计取价差的时候做显示用
         {name: '调整价', field: 'adjust_price', visible: true,width:70,decimalField:"glj.unitPrice"},
         {name: '市场价', field: "unit_price.market_price", visible: true, validator: 'number',width:70,decimalField:"glj.unitPrice"},
         {
@@ -112,6 +112,7 @@ ProjectGLJSpread.prototype.init = function () {
     this.sheetObj.setStyle(-1, supplyQuantity, rightStyleSetting);
 
     // 设置可编辑列
+    this.sheetObj.setColumnEditable(basePriceColumn);
     this.sheetObj.setColumnEditable(marketPriceColumn);
     this.sheetObj.setColumnEditable(isEvaluateColumn);
     this.sheetObj.setColumnEditable(isAdjustPriceColumn);
@@ -198,7 +199,7 @@ ProjectGLJSpread.prototype.updateProjectGLJField = function(info, callback) {
 
     // 直接在前端计算后传值后台改
     let extend = {};
-    let updateRecord = jsonData[row];
+/*    let updateRecord = jsonData[row];  这时修改成在后端计算后直接更新,因为还要重新计算受影响的清单节点
     let parentMarketPrice = projectGLJSpread.compositionCalculate(updateRecord);
     if (parentMarketPrice !== null && Object.keys(parentMarketPrice).length > 0) {
         for (let activeCode in parentMarketPrice) {
@@ -207,7 +208,7 @@ ProjectGLJSpread.prototype.updateProjectGLJField = function(info, callback) {
             };
             extend[activeCode] = tmpObject;
         }
-    }
+    }*/
 
     // 如果是供货方式则需要处理数据
     if (field === 'supply') {
@@ -217,10 +218,17 @@ ProjectGLJSpread.prototype.updateProjectGLJField = function(info, callback) {
     if(field === 'supply_quantity'){//修改数量需做4舍5入
         value= value.toDecimal(getDecimal('glj.quantity'));
     }
-    if(field === 'unit_price.market_price'){
-        value= value.toDecimal(getDecimal('glj.unitPrice'));
+    if(field === 'unit_price.market_price'||field === 'base_price'){
+        value= scMathUtil.roundForObj(value,getDecimal('glj.unitPrice'));//修改市场价和修改定额价时需要重新记算很多受影响的树节点,现在改成与定字额工料机那里调相同的方法。
+        let editField = field === 'base_price'?field:"market_price";
+        projectObj.project.projectGLJ.updatePrice(jsonData[row],editField,value);
+        return;
     }
     extend = Object.keys(extend).length > 0 ?  JSON.stringify(extend) : '';
+    this.postUpdate(id,field,value,info,extend,callback);
+};
+
+ProjectGLJSpread.prototype.postUpdate=function (id,field,value,info,extend,callback) {
     $.bootstrapLoading.start();
     $.ajax({
         url: '/glj/update',
@@ -237,22 +245,25 @@ ProjectGLJSpread.prototype.updateProjectGLJField = function(info, callback) {
         success: function(response) {
             isChanging = false;
             // 修改失败则恢复原值
-            if (response.err !== 0) {
-                activeSheet.setValue(row, column, info.oldValue);
+            if (response.err !== 0&&info.fromRG!=true) {
+                projectGLJSheet.getSheet().setValue(info.row, info.col, info.oldValue);
                 alert('更改数据失败!');
             } else {
                 // 成功则触发相应事件
-                if (parentMarketPrice !== null) {
-                    info.parentMarketPrice = parentMarketPrice;
-                }
-                if(field !== 'supply'){ //供货方式需做转换才能直接设置值, 这里设置值是为了早点更新数据,等getdata返回数据再刷新的话会有比较大的延时
-                    activeSheet.setValue(row, column, value);
+                /* if (parentMarketPrice !== null) {
+                 info.parentMarketPrice = parentMarketPrice;
+                 }*/
+                if(field !== 'supply'&&info.fromRG!=true){ //供货方式需做转换才能直接设置值, 这里设置值是为了早点更新数据,等getdata返回数据再刷新的话会有比较大的延时
+                    projectGLJSheet.getSheet().setValue(info.row, info.col, value);
                 }
-                callback(field, info);
+                callback(field, info,id);
             }
         }
     });
-};
+
+
+}
+
 
 /**
  * 设置特殊单元格数据
@@ -314,11 +325,15 @@ ProjectGLJSpread.prototype.specialColumn = function (sourceData) {
             this.firstMachineRow = this.firstMachineRow === -1 && data.unit_price.type === GLJTypeConst.GENERAL_MACHINE ?
                 rowCounter : this.firstMachineRow;
             // 锁定该单元格
-            if (data.ratio_data  && data.ratio_data.length > 0){//有组成物时,市场单价不可修改
+            if (data.ratio_data  && data.ratio_data.length > 0){//有组成物时,市场单价、定额价不可修改
                 activeSheet.getCell(rowCounter, marketPriceColumn,  GC.Spread.Sheets.SheetArea.viewport).locked(true);
+                activeSheet.getCell(rowCounter, basePriceColumn, GC.Spread.Sheets.SheetArea.viewport).locked(true);
             }
             activeSheet.getCell(rowCounter, supplyColumn,  GC.Spread.Sheets.SheetArea.viewport).locked(true);
         }
+        if(data.unit_price.is_add!=1){//如果不是新增,定额价不可修改。
+            activeSheet.getCell(rowCounter, basePriceColumn, GC.Spread.Sheets.SheetArea.viewport).locked(true);
+        }
 
         // 处理数据
         if (data.ratio_data !== undefined && data.ratio_data.length > 0) {

+ 34 - 23
web/building_saas/main/js/models/project_glj.js

@@ -132,7 +132,7 @@ ProjectGLJ.prototype.updateData = function (id, data) {
  *
  * @return {void}
  */
-ProjectGLJ.prototype.loadCacheData = function () {
+ProjectGLJ.prototype.loadCacheData = function (resort) {
     // 加载工料机数据
     let data = this.datas === null ? null : this.datas;
     if (data === null) {
@@ -141,16 +141,18 @@ ProjectGLJ.prototype.loadCacheData = function () {
     jsonData = data.gljList !== undefined && data.gljList.length > 0 ? data.gljList : [];
     jsonData = filterProjectGLJ(jsonData);
     jsonData = sortProjectGLJ(jsonData);
-    projectGLJSheet.setData(jsonData);
-    projectGLJSpread.specialColumn(jsonData);
+    if(projectGLJSheet&&projectGLJSpread){
+        projectGLJSheet.setData(jsonData);
+        projectGLJSpread.specialColumn(jsonData);
+    }
 };
 
 ProjectGLJ.prototype.updatePriceFromRG = function (recode, updateField, newval) {
     if (updateField == 'marketPrice') {
-        this.updateBasePriceFromRG(recode, "market_price", newval);
+        this.updatePrice(recode, "market_price", newval,"rg");
     }
     if (updateField == 'basePrice') {
-        this.updateBasePriceFromRG(recode, "base_price", newval);
+        this.updatePrice(recode, "base_price", newval,"rg");
     }
 };
 
@@ -223,11 +225,11 @@ ProjectGLJ.prototype.updateGLJProperty = function (node, updateField, newval) {
 
 }
 
-ProjectGLJ.prototype.updateBasePriceFromRG = function (recode, updateField, newval) {
+ProjectGLJ.prototype.updatePrice = function (recode, updateField, newval,from) {
     let me = this;
     let projectGljs = this.datas.gljList;
-    let glj = _.find(projectGljs, {'id': recode.projectGLJID});
-    console.log(glj);
+    let pgljID = from=="rg"?recode.projectGLJID:recode.id;//和定额工料机统一接口,项目工料机ID取值不一样
+    let glj = _.find(projectGljs, {'id': pgljID});
     if (glj) {
         let data = {id: glj.unit_price.id, field: updateField, newval: newval};
         let callback = function (data) {
@@ -237,12 +239,14 @@ ProjectGLJ.prototype.updateBasePriceFromRG = function (recode, updateField, newv
             } else {
                 glj.unit_price.market_price = newval;
             }
-            //更新项目工料机价格
-            me.refreshProjectGLJPrice(data);
+            //更新回传的父节点项目工料机价格
+           let gljs = me.getProjectGLJs(data);
             me.refreshRationGLJPrice(glj);//刷新定额工料机列表的记录
+            projectObj.project.projectGLJ.loadCacheData();//更新工料机汇总缓存和显示
             gljOprObj.showRationGLJSheetData();
             me.refreshTreeNodePriceIfNeed(glj);//刷新造价书中主树上的定额工料机;
-            let nodes = me.getImpactRationNodes(glj);//取到因为改变工料机价格而受影响的定额
+            gljs.push(glj);
+            let nodes = me.getImpactRationNodes(gljs);//取到因为改变工料机价格而受影响的定额
             projectObj.project.calcProgram.calcRationsAndSave(nodes);//触发计算程序
             $.bootstrapLoading.end();
         }
@@ -254,8 +258,10 @@ ProjectGLJ.prototype.updateBasePriceFromRG = function (recode, updateField, newv
         gljOprObj.showRationGLJSheetData();
     }
 }
+
+
 ProjectGLJ.prototype.refreshTreeNodePriceIfNeed = function (data) {
-    if ((data.unit_price.type = gljType.MAIN_MATERIAL || data.unit_price.type == gljType.EQUIPMENT) && projectInfoObj.projectInfo.property.displaySetting.disPlayMainMaterial == true) {
+    if ((data.unit_price.type == gljType.MAIN_MATERIAL || data.unit_price.type == gljType.EQUIPMENT) && projectInfoObj.projectInfo.property.displaySetting.disPlayMainMaterial == true) {
         var nodes = _.filter(projectObj.project.mainTree.items, function (tem) {
             if (tem.sourceType == ModuleNames.ration_glj && tem.data.projectGLJID == data.id) {
                 tem.data.marketUnitFee = data.unit_price.market_price;
@@ -268,21 +274,24 @@ ProjectGLJ.prototype.refreshTreeNodePriceIfNeed = function (data) {
 }
 
 //根据工料机,取得所有受影响的定额节点
-ProjectGLJ.prototype.getImpactRationNodes = function (glj) {
+ProjectGLJ.prototype.getImpactRationNodes = function (gljs) {
     let nodes = [];
     let rationMap = {};
+    let idArray = _.map(gljs,'id');
+    let priceArray = _.map(gljs,'unit_price');
     //先根据项目工料机ID,找到受影响定额的ID
     let ration_glj_list = projectObj.project.ration_glj.datas; //取定额工料机数据
     for (let rg of ration_glj_list) {
-        if (rg.projectGLJID == glj.id) {
+        if (_.indexOf(idArray,rg.projectGLJID)!=-1) {
             rationMap[rg.rationID] = true;  //取所有定额ID,用MAP方式去重
         }
     }
     for (let item of projectObj.project.mainTree.items) {
         if (item.sourceType == ModuleNames.ration) {
             if (item.data.type == rationType.gljRation) {//取定额类型的工料机
-                if (item.data.projectGLJID == glj.id) {
-                    item.data.marketUnitFee = glj.unit_price.market_price; //更新市场单价
+                let idx = _.indexOf(idArray,item.data.projectGLJID);
+                if (idx != -1) {
+                    item.data.marketUnitFee = priceArray[idx].market_price; //更新市场单价
                     nodes.push(item);
                 }
             } else if (rationMap[item.data.ID] == true) {  //受影响的定额
@@ -306,11 +315,11 @@ ProjectGLJ.prototype.refreshRationTypeGLJ = function (glj) {
 
 }
 
-ProjectGLJ.prototype.refreshProjectGLJPrice = function (data) {
+ProjectGLJ.prototype.getProjectGLJs = function (data,refreshPrice=true) {
     let parentGlj = [];
     //
     let projectGljs = this.datas.gljList;
-    let indexList = ['code', 'name', 'specs', 'unit', 'type'];
+    let indexList = gljKeyArray;
     for (let d of data) {
         if (d) {
             let condition = {};
@@ -321,11 +330,13 @@ ProjectGLJ.prototype.refreshProjectGLJPrice = function (data) {
             }
             let glj = _.find(projectGljs, condition);
             if (glj) {
-                glj.unit_price.base_price = d.base_price;
-                glj.unit_price.market_price = d.market_price;
-                this.setAdjustPrice(glj);
-                this.refreshRationGLJPrice(glj);
-                this.refreshTreeNodePriceIfNeed(glj);
+                if(refreshPrice==true){
+                    glj.unit_price.base_price = d.base_price;
+                    glj.unit_price.market_price = d.market_price;
+                    this.setAdjustPrice(glj);
+                    this.refreshRationGLJPrice(glj);
+                    this.refreshTreeNodePriceIfNeed(glj);
+                }
                 parentGlj.push(glj);
             }
         }

+ 29 - 6
web/building_saas/main/js/views/glj_view.js

@@ -390,19 +390,18 @@ var gljOprObj = {
         }
     },
     onCheckBoxClick: function (sender, args) {
-        if (args.sheetName == 'ration_glj') {
-            return;
-        }
         var checkboxValue = args.sheet.getCell(args.row, args.col).value();
         var newval = 0;
         if (checkboxValue) {
             newval = 0;
             args.sheet.getCell(args.row, args.col).value(newval);
         } else {
-            newval = 1
+            newval = 1;
             args.sheet.getCell(args.row, args.col).value(newval);
         }
-        if (args.sheetName == 'ration_coe') {
+        if (args.sheetName == 'ration_glj') {
+            gljOprObj.updateIsEstimate(args,newval);
+        } else if (args.sheetName == 'ration_coe') {
             gljOprObj.updateRationCoe(args, newval)
         } else if (args.sheetName == 'quantity_detail') {
             projectObj.project.quantity_detail.isSummationUpdate(args, gljOprObj.detailData, newval);
@@ -804,7 +803,7 @@ var gljOprObj = {
                 var glj = _.find(projectGljs, {'id': ration_gljs[i].projectGLJID});
                 if (glj) {
                     let typeString = ration_gljs[i].type + "";
-                    if (typeString.indexOf("2") != -1) {//只有材料类型才显示是否暂估
+                    if (typeString.indexOf("2") != -1||typeString=='4'||typeString=='5') {//只有材料类型才显示是否暂估
                         ration_gljs[i].isEstimate = glj.is_evaluate;
                     }
                     ration_gljs[i].isAdd = glj.unit_price.is_add;
@@ -857,6 +856,16 @@ var gljOprObj = {
         t_index = k_arr.join("|-|");
         return t_index;
     },
+    getConditionByKey(conKey){//将连接字符串转换成对象
+        let valueArray = conKey.split("|-|");
+        let obj ={};
+        for(let i = 0;i<valueArray.length;i++){
+            if(valueArray[i]!='null'){
+                obj[gljKeyArray[i]]=valueArray[i];
+            }
+        }
+        return obj;
+    },
     getMixRationShowDatas: function (mixRatioList, projectGljs) {
         var temRationGLJs = [];
         for (var i = 0; i < mixRatioList.length; i++) {
@@ -1036,6 +1045,20 @@ var gljOprObj = {
         var recode = me.coeSheetData[args.row];
         projectObj.project.ration_coe.adjustCoeClick(recode, newval);
     },
+    updateIsEstimate:function (args, newval) {
+        var me = gljOprObj;
+        if(me.setting.header[args.col].dataCode=="isEstimate"){
+            var pspread= new ProjectGLJSpread();
+            var recode = me.sheetData[args.row];
+            let projectGljs = projectObj.project.projectGLJ.datas.gljList;
+            let glj = _.find(projectGljs, {'id': recode.projectGLJID});
+            if(glj){
+                glj["is_evaluate"]=newval;
+                args.fromRG=true;
+                pspread.postUpdate(recode.projectGLJID,"is_evaluate",newval,args,null,successTrigger);
+            }
+        }
+    },
     numberValueChecking: function (val) {
         var newval = Number(val);
         if (number_util.isNumber(newval)) {

+ 16 - 0
web/building_saas/report/html/rpt_main.html

@@ -73,6 +73,22 @@
                             报表设置
                         </div>
                     </div>
+                    <div class="panel">
+                        <div class="panel-body">
+                            <div class="input-group input-group-sm" role="group">
+                            <span class="input-group-btn">
+                              <button type="button" class="btn btn-secondary btn-sm" data-toggle="tooltip" data-placement="bottom" title="上一页"><i class="fa fa-chevron-left" onclick="rptControlObj.prePage(this)"></i></button>
+                            </span>
+                                <input class="form-control" id="rpt_page_num" value="" style="width:60px"  data-toggle="tooltip" data-placement="bottom" title="输入页码按回车键,快速跳转">
+                                <span class="input-group-btn">
+                              <button type="button" class="btn btn-secondary btn-sm" data-toggle="tooltip" data-placement="bottom" title="下一页"><i class="fa fa-chevron-right" onclick="rptControlObj.nextPage(this)"></i></button>
+                            </span>
+                            </div>
+                        </div>
+                        <div class="panel-foot text-muted">
+                            翻页
+                        </div>
+                    </div>
                 </div>
             </div>
             <div class="print-view poj-list">

+ 14 - 0
web/building_saas/report/js/rpt_main.js

@@ -85,6 +85,7 @@ let zTreeOprObj = {
                         me.currentRptPageRst = pageRst;
                         me.maxPages = pageRst.items.length;
                         me.currentPage = 1;
+                        me.displayPageValue();
                         let size = JpcCanvasOutput.getReportSizeInPixel(me.currentRptPageRst, getScreenDPI());
                         canvas.width = size[0] + 20;
                         if (size[1] > size[0]) {
@@ -106,6 +107,11 @@ let zTreeOprObj = {
             JpcCanvasOutput.drawPageBorder(me.currentRptPageRst, canvas, getScreenDPI());
             JpcCanvasOutput.drawToCanvas(me.currentRptPageRst, canvas, me.currentPage);
         }
+        me.displayPageValue();
+    },
+    displayPageValue: function() {
+        let me = zTreeOprObj;
+        $("#rpt_page_num").get(0).value = me.currentPage + "/" + me.maxPages;
     }
 };
 
@@ -210,5 +216,13 @@ let rptControlObj = {
                 me.getCurrentPageSize() + "/" + orgRptName;
             window.location = url;//这里不能使用get方法跳转,否则下载不成功
         }
+    },
+    prePage: function(dom) {
+        let canvas = document.getElementById("rptCanvas");
+        zTreeOprObj.showPage(zTreeOprObj.currentPage - 1, canvas);
+    },
+    nextPage: function(dom) {
+        let canvas = document.getElementById("rptCanvas");
+        zTreeOprObj.showPage(zTreeOprObj.currentPage + 1, canvas);
     }
 };