فهرست منبع

Merge branch 'master' of http://smartcost.f3322.net:3000/SmartCost/YangHuCost

TonyKang 7 سال پیش
والد
کامیت
fbac39b2c3

+ 5 - 3
Dockerfile

@@ -1,14 +1,16 @@
 FROM costbase:2.0
 
-WORKDIR /home/ConstructionCost
+RUN mv /home/ConstructionCost /home/YangHuCost
 
-COPY . /home/ConstructionCost
+WORKDIR /home/YangHuCost
+
+COPY . /home/YangHuCost
 
 RUN cnpm install
 
 RUN gulp build
 
-EXPOSE 6060
+EXPOSE 2060
 
 ENV NODE_ENV=prod
 

+ 5 - 3
Dockerfile_pp

@@ -1,14 +1,16 @@
 FROM costbase:2.0
 
-WORKDIR /home/ConstructionCost
+RUN mv /home/ConstructionCost /home/YangHuCost
 
-COPY . /home/ConstructionCost
+WORKDIR /home/YangHuCost
+
+COPY . /home/YangHuCost
 
 RUN cnpm install
 
 RUN gulp build
 
-EXPOSE 6060
+EXPOSE 2060
 
 ENV NODE_ENV=pp
 

+ 5 - 3
Dockerfile_qa

@@ -1,14 +1,16 @@
 FROM costbase:2.0
 
-WORKDIR /home/ConstructionCost
+RUN mv /home/ConstructionCost /home/YangHuCost
 
-COPY . /home/ConstructionCost
+WORKDIR /home/YangHuCost
+
+COPY . /home/YangHuCost
 
 RUN cnpm install
 
 RUN gulp build
 
-EXPOSE 6060
+EXPOSE 2060
 
 ENV NODE_ENV=qa
 

+ 3 - 1
modules/common/const/bills_fixed.js

@@ -53,7 +53,9 @@ const fixedFlag = {
     //施工机械
     CONSTRUCTION_MACHINE:25,
     //暂列金额
-    PROVISIONAL:26
+    PROVISIONAL:26,
+    //安全生产费
+    SAFE_COST:27
 };
 
 export default fixedFlag;

+ 7 - 1
modules/glj/models/unit_price_model.js

@@ -271,6 +271,11 @@ class UnitPriceModel extends BaseModel {
         return rList;
     }
 
+    needUpdateParent(connect_key){
+        let noNeedUpdateType = ["202","203","204"];//父类型为混凝土、砂浆,配合比,类型的,不用更新价格
+        let keyList = connect_key.split("|-|");
+        return noNeedUpdateType.indexOf(keyList[4]) == -1
+    }
     async checkAndUpdateParent(unitPrice,field,project_id,newValueMap,batchUpdate=false){//检查是否属于某个工料机的组成物,如果是,并且不是批量更新的情况下,直接更新,如果是批量更新,返回更新任务
         //查找是否是属于某个项目工料机的组成物
         let mixRatioModel = new MixRatioModel();
@@ -281,7 +286,8 @@ class UnitPriceModel extends BaseModel {
         let rList= [];
         if(mixRatioList&&mixRatioList.length>0){
             for(let m of mixRatioList){
-                if(!connectKeyMap.hasOwnProperty(m.connect_key)){//为了去重复,组成物会与其它项目同步,所以有可能重复。
+                // 父类型不为混凝土、砂浆,配合比,类型的,才要更新价格
+                if(this.needUpdateParent(m.connect_key) && !connectKeyMap.hasOwnProperty(m.connect_key)){//为了去重复,组成物会与其它项目同步,所以有可能重复。
                     rList.push(await this.updateParentUnitPrice(m,field,project_id,newValueMap,batchUpdate));
                     connectKeyMap[m.connect_key]=true;
                 }

+ 0 - 3
modules/pm/controllers/pm_controller.js

@@ -387,11 +387,9 @@ module.exports = {
             if(gc_tenderFiles.length > 0){
                 for(let i = 0, len = gc_tenderFiles.length; i < len; i++){
                     let gc_t = gc_tenderFiles[i];
-                    console.log(gc_t.ParentID);
                     let theProj = _projs[prefix + gc_t.ParentID] || null;
                     if(!theProj){
                         let tempProjs = await ProjectsData.getProjectsByIds(userID, compilatoinId, [gc_t.ParentID]);
-                        console.log(tempProjs[0]);
                         if(tempProjs.length > 0 && tempProjs[0].projType === projType.project){
                             theProj = _projs[prefix + gc_t.ParentID] = tempProjs[0]._doc;
                             buildProj(theProj);
@@ -402,7 +400,6 @@ module.exports = {
                     }
                 }
             }
-            console.log(_projs);
             for(let i in _projs){
                 rst.push(_projs[i]);
             }

+ 4 - 3
modules/pm/models/project_model.js

@@ -172,8 +172,8 @@ ProjectsDAO.prototype.updateUserProjects = async function (userId, compilationId
 
                     //呈现选项
                     data.updateData.property.displaySetting = displaySetting;
-
-                    data.updateData.property.billsCalcMode = 0;
+                    let defaultCalcMode = (data.updateData.property.valuationType == 'bill') ? 2 : 1;
+                    data.updateData.property.billsCalcMode = defaultCalcMode;
                     data.updateData.property.zanguCalcMode = 0;
                     //计算选项
                     data.updateData.property.calcOptions = calcOptions;
@@ -796,7 +796,8 @@ ProjectsDAO.prototype.defaultSettings = async function (userID, compilationId, p
     }
     let cloneProperty = _.cloneDeep(project.property);
     //关于计算
-    cloneProperty.billsCalcMode = 0;
+    let defaultCalcMode = (project.property.valuationType == 'bill') ? 2 : 1;
+    cloneProperty.billsCalcMode = defaultCalcMode;
     cloneProperty.zanguCalcMode = 0;
     cloneProperty.calcOptions = calcOptions;
     //清单工程量精度

+ 1 - 1
modules/ration_glj/facade/glj_calculate_facade.js

@@ -132,7 +132,7 @@ function generateUpdateTasks(result) {
 
 function sortRationGLJ(list) {
     list = _.sortByAll(list, [function (item) {
-        return _.indexOf(gljUtil.getGljTypeSeq(),item.type);
+        return gljUtil.getMainType(item.type);
     }, "code"])
     return list;
 }

+ 8 - 3
public/gljUtil.js

@@ -16,7 +16,8 @@ module.exports = {
     getMarketPrice:getMarketPrice,
     getBasePrice:getBasePrice,
     getAdjustPrice:getAdjustPrice,
-    getGljTypeSeq:getGljTypeSeq
+    getMainType:getMainType,
+    isConcreteType:isConcreteType
 };
 
 function calcProjectGLJQuantity(projectGLJDatas,rationGLJDatas,rationDatas,billsDatas,q_decimal) {
@@ -43,6 +44,10 @@ function calcPriceDiff(glj,calcOptions) {
     gljNodeUtil.calcPriceDiff(glj,calcOptions);
 }
 
-function getGljTypeSeq() {
-    return gljNodeUtil.getGljTypeSeq();
+function getMainType() {
+    return gljNodeUtil.getMainType();
+}
+
+function isConcreteType(type) {
+    return gljNodeUtil.isConcreteType(type);
 }

+ 36 - 9
public/web/gljUtil.js

@@ -36,7 +36,7 @@ let gljUtil = {
                 let m_index = this.getIndex(m,this.gljKeyArray);
                 let m_glj = quantityMap[m_index];
                 let p_glj = quantityMap[pkey];
-                if(m_glj&&p_glj){
+                if(m_glj&&p_glj&&!gljUtil.isConcreteType(p_glj.type) ){//混凝土、砂浆、配合比组成物的消耗量在定额下已经有体现了,不用再计算进去
                     let quantity = scMathUtil.roundForObj(parseFloat(p_glj[qField])*parseFloat(m.consumption),q_decimal);
                     let techQuantity = scMathUtil.roundForObj(parseFloat(p_glj[tField])*parseFloat(m.consumption),q_decimal);
                     let subdivisionQuantity = scMathUtil.roundForObj(parseFloat(p_glj[sField])*parseFloat(m.consumption),q_decimal);
@@ -295,19 +295,44 @@ let gljUtil = {
         t_index = k_arr.join("|-|");
         return t_index;
     },
-    getGljTypeSeq:function () {
-        let gljType = this.gljType;
-        return   [gljType.LABOUR,gljType.MAIN_MATERIAL,gljType.CONCRETE,gljType.MORTAR,gljType.MIX_RATIO,gljType.COMMERCIAL_CONCRETE,
-            gljType.COMMERCIAL_MORTAR,gljType.GENERAL_MATERIAL,gljType.OTHER_MATERIAL,gljType.GENERAL_MACHINE,gljType.INSTRUMENT,gljType.OTHER_MACHINE_USED,
-            gljType.MACHINE_COMPOSITION,gljType.MACHINE_LABOUR,gljType.FUEL_POWER_FEE,gljType.DEPRECIATION_FEE,gljType.INSPECTION_FEE,gljType.MAINTENANCE,
-            gljType.DISMANTLING_FREIGHT_FEE,gljType.VERIFICATION_FEE,gljType.OTHER_FEE,gljType.EQUIPMENT,gljType.MANAGEMENT_FEE,gljType.PROFIT,gljType.GENERAL_RISK_FEE]
+    getMainType:function (type) {
+        let str = type + "";
+        return parseInt(str.substr(0,1));
     },
     sortRationGLJ:function (list) {
         list = _.sortByAll(list, [function (item) {
-            return _.indexOf(gljTypeSeq,item.type)
-        }, "code"])
+            return gljUtil.getMainType(item.type);
+        }, "code"]);
         return list;
     },
+    sortMixRatio:function (list) {
+        return _.sortByAll(list, ["code"]);
+    },
+    //项目工料机 混凝土、砂浆、配合比排序与定额工料机不一样,同时,type取值的地方不一样
+    sortProjectGLJ:function (list) {
+        let specialMap = {202:9,203:10,204:11};//混凝土、砂浆、配合比 排到最后
+        list = _.sortByAll(list, [function (item) {
+            if(gljUtil.isConcreteType(item.unit_price.type)) return specialMap[item.unit_price.type];
+            return gljUtil.getMainType(item.unit_price.type);
+        }, "code"]);
+        return list;
+    },
+    isConcreteType:function (type) {
+        let concreteType = [gljUtil.gljType.CONCRETE,gljUtil.gljType.MORTAR,gljUtil.gljType.MIX_RATIO];//混凝土大类:混凝土、砂浆,配合比
+        return concreteType.indexOf(type)!=-1
+    },
+    hasComposition:function (ration_glj,isRationType) {//判断是否有组成物,有则返回true   现在主材类型的工料机也有可能有组成物。
+        let type = isRationType==true? ration_glj.subType:ration_glj.type;
+        if(gljUtil.notEditType.indexOf(type)!=-1||type==gljType.MAIN_MATERIAL){
+            let keyArray = isRationType==true? rationKeyArray:gljKeyArray;
+            let con_key = gljUtil.getIndex(ration_glj,keyArray);
+            var mixRatioMap = projectObj.project.projectGLJ.datas.mixRatioMap;
+            if(mixRatioMap[con_key]&&mixRatioMap[con_key].length>0){
+                return true;
+            }
+        }
+        return false;
+    },
     fixedFlag : {
         // 分部分项工程
         SUB_ENGINERRING: 1,
@@ -326,6 +351,8 @@ let gljUtil = {
         COMMERCIAL_CONCRETE: 205,                   // 商品混凝土
         COMMERCIAL_MORTAR: 206,                     // 商品砂浆
         OTHER_MATERIAL: 207,                        // 其它材料
+        PURCHASE_COMPONENT: 208,                    // 外购砼构件
+        GREEN_SEEDLING: 209,                        // 绿化苗木
         // ==============材料类型 ↑=================
         // ==============机械类型 ↓=================
         GENERAL_MACHINE: 301,                       // 机械台班

+ 1 - 3
web/building_saas/glj/js/project_glj.js

@@ -343,9 +343,7 @@ function filterProjectGLJ(jsonData) {
 
 function sortProjectGLJ(jsonData) {
     if (jsonData.length > 0) {
-        jsonData = _.sortByAll(jsonData, [function (item) {
-            return _.indexOf(gljTypeSeq,item.unit_price.type);
-        }, 'code']);
+        jsonData = gljUtil.sortProjectGLJ(jsonData)
     }
     return jsonData
 }

+ 8 - 8
web/building_saas/main/html/main.html

@@ -193,7 +193,7 @@
                                       <a class="nav-link sub-item" id="linkQDJL" data-toggle="tab" href="#subSpread" role="tab">清单精灵</a>
                                   </li>
                                   <li class="nav-item" id="GLJ_div">
-                                      <a class="nav-link sub-item active" id="linkGLJ" data-toggle="tab" href="#subSpread" role="tab">人材机</a>
+                                      <a class="nav-link sub-item active" id="linkGLJ" data-toggle="tab" href="#subSpread" role="tab">工料机</a>
                                   </li>
                               <!--    <li class="nav-item">
                                       <a class="nav-link" id="linkFZTJ" data-toggle="tab" href="#subSpread" role="tab">附注条件</a>
@@ -481,7 +481,7 @@
                                               </div>
                                               <div class="form-check form-check-inline">
                                                   <input class="form-check-input" type="radio" name="content_type" id="raion_glj" value="ration_glj">
-                                                  <label class="form-check-label" for="raion_glj">人材机</label>
+                                                  <label class="form-check-label" for="raion_glj">工料机</label>
                                               </div>
                                               <!--<div class="form-check form-check-inline">
                                                   <input class="form-check-input" type="radio" name="inlineRadioOptions" id="bookmark" value="option4">
@@ -794,7 +794,7 @@
                                     <div class="modal-auto-height">
                                         <fieldset class="form-group">
                                             <h5>取费方式</h5>
-                                            <div class="form-check">
+                                            <div class="form-check" style="display:none">
                                                 <label class="form-check-label">
                                                     <input class="form-check-input" name="calcFlag" id="rationContent" value="0" type="radio">
                                                     子目含量取费
@@ -812,14 +812,14 @@
                                                     子目单价取费(正算):清单综合合价=∑子目综合合价
                                                 </label>
                                             </div>
-                                            <div class="form-check">
+                                            <div class="form-check" style="display:none">
                                                 <label class="form-check-label">
                                                     <input class="form-check-input" name="calcFlag" id="billsPrice" value="3" type="radio">
                                                     清单单价取费
                                                 </label>
                                             </div>
                                         </fieldset>
-                                        <fieldset class="form-group">
+                                        <fieldset class="form-group" style="display:none">
                                             <h5>暂估合价计算方式</h5>
                                             <div class="form-check">
                                                 <label class="form-check-label">
@@ -834,7 +834,7 @@
                                                 </label>
                                             </div>
                                         </fieldset>
-                                        <fieldset class="form-group">
+                                        <fieldset class="form-group"  style="display:none">
                                             <h5>计算选项</h5>
                                             <div class="form-check">
                                                 <label class="form-check-label">
@@ -912,7 +912,7 @@
                                                     </div>
                                                 </div>
                                             </div>
-                                            <h5 class="mt-3">人材机</h5>
+                                            <h5 class="mt-3">工料机</h5>
                                             <div class="row m-0">
                                                 <div class="col-sm-3">
                                                     <div class="input-group input-group-sm mb-2">
@@ -1265,7 +1265,7 @@
                                             <a id="cb_QTXM" href="javascript:void(0)">其他项目</a>
                                         </li>
                                         <li class="py-1">
-                                            <a id="cb_RCJ" href="javascript:void(0)">人材机</a>
+                                            <a id="cb_RCJ" href="javascript:void(0)">工料机</a>
                                         </li>
                                         <li class="py-1">
                                             <a id="cb_FBF" href="javascript:void(0)">分包费</a>

+ 4 - 0
web/building_saas/main/js/main.js

@@ -3,8 +3,12 @@
  */
 $(function () {
     loadMainSize();
+
     $("#header-menu").removeAttr('style');
 
+    if (projectInfoObj.projectInfo.property.valuationType == 'bill')
+        $("#tab_tender_price").css('display', 'none');
+
     $('#tab_baobiao').on('shown.bs.tab', function (e) {
         $(e.relatedTarget.hash).removeClass('active');
         // do something

+ 33 - 33
web/building_saas/main/js/models/calc_program.js

@@ -148,29 +148,17 @@ let calcTools = {
         if (!treeNode.data.fees) {
             treeNode.data.fees = [];
             treeNode.data.feesIndex = {};
-            // treeNode.updateData.fees = [];   // 在某种未知情况下,treeNode.data.fees有值,导致这句无法执行。下同
-            // treeNode.updateData.feesIndex = {};
+             treeNode.updateData.fees = [];   // 在某种未知情况下,treeNode.data.fees有值,导致这句无法执行。下同
+             treeNode.updateData.feesIndex = {};
             treeNode.changed = true;
         }
         else if (!treeNode.data.feesIndex){
             treeNode.data.feesIndex = {};
-            // treeNode.updateData.feesIndex = {};
+             treeNode.updateData.feesIndex = {};
             for (let fee of treeNode.data.fees){
                 treeNode.data.feesIndex[fee.fieldName] = fee;
-                // treeNode.updateData.feesIndex[fee.fieldName] = fee;
-            };
-            treeNode.changed = true;
-        };
-
-        if (!treeNode.updateData.fees) {
-            treeNode.updateData.fees = [];
-            treeNode.updateData.feesIndex = {};
-            treeNode.changed = true;
-        }
-        else if (!treeNode.updateData.feesIndex){
-            treeNode.updateData.feesIndex = {};
-            for (let fee of treeNode.updateData.fees)
                 treeNode.updateData.feesIndex[fee.fieldName] = fee;
+            };
             treeNode.changed = true;
         };
     },
@@ -306,6 +294,7 @@ let calcTools = {
     machineDetailFee: function (treeNode, gljArr, masterTypeFilter, detailType, isTender) {
         if (!gljArr) return 0;
         let result = 0;
+        let nodeQ = calcTools.uiNodeQty(treeNode) ? calcTools.uiNodeQty(treeNode) : 0;
         for (let glj of gljArr) {
             if (baseMachineMasterTypes.includes(glj.type)){
                 // 机型不符
@@ -330,7 +319,7 @@ let calcTools = {
                         mdSum = (mdSum).toDecimal(decimalObj.glj.unitPriceHasMix);
                     }
                 }
-                result = (result + (gljQ * mdSum).toDecimal(decimalObj.process)).toDecimal(decimalObj.process)
+                result = (result + (nodeQ * gljQ * mdSum).toDecimal(decimalObj.process)).toDecimal(decimalObj.process)
             }
         }
         result = (result).toDecimal(decimalObj.ration.totalPrice);
@@ -478,19 +467,22 @@ let calcTools = {
 
         let rcj = (treeNode.data.subType === gljType.LABOUR && calcTools.inBase(baseName, 'RGF')) ||
             (baseMaterialTypes.includes(treeNode.data.subType) && calcTools.inBase(baseName, 'CLF')) ||
-            (treeNode.data.subType === gljType.GENERAL_MACHINE && calcTools.inBase(baseName, 'JXF'));
+            (treeNode.data.subType === gljType.GENERAL_MACHINE && calcTools.inBase(baseName, 'JXF')) ||
+            (treeNode.data.subType === gljType.EQUIPMENT && calcTools.inBase(baseName, 'SBF')) ||
 
-        if (typeof isJX2017 != 'undefined') {
-            rcj = rcj || (treeNode.data.subType === gljType.LABOUR && calcTools.inBase(baseName, 'SC_RGF')) ||
-                (baseMaterialTypes.includes(treeNode.data.subType) && calcTools.inBase(baseName, 'SC_CLF')) ||
-                (treeNode.data.subType === gljType.GENERAL_MACHINE && calcTools.inBase(baseName, 'SC_JXF'))
-        };
+            (treeNode.data.subType === gljType.LABOUR && calcTools.inBase(baseName, 'SC_RGF')) ||
+            (baseMaterialTypes.includes(treeNode.data.subType) && calcTools.inBase(baseName, 'SC_CLF')) ||
+            (treeNode.data.subType === gljType.GENERAL_MACHINE && calcTools.inBase(baseName, 'SC_JXF')) ||
+            (treeNode.data.subType === gljType.EQUIPMENT && calcTools.inBase(baseName, 'SC_SBF'));
 
         if (rcj ||
-            (treeNode.data.subType === gljType.MAIN_MATERIAL && calcTools.inBase(baseName, 'ZCF')) ||
-            (treeNode.data.subType === gljType.EQUIPMENT && calcTools.inBase(baseName, 'SBF'))) {
-            if (treeNode.data.type == rationType.volumePrice)
-                result = treeNode.data.marketUnitFee ? parseFloat(treeNode.data.marketUnitFee).toDecimal(decimalObj.ration.unitPrice) : 0
+            (treeNode.data.subType === gljType.MAIN_MATERIAL && calcTools.inBase(baseName, 'ZCF'))
+            ) {
+            if (treeNode.data.type == rationType.volumePrice){
+                let nodeQ = calcTools.uiNodeQty(treeNode) ? calcTools.uiNodeQty(treeNode) : 0;
+                result = treeNode.data.marketUnitFee ? (parseFloat(treeNode.data.marketUnitFee) * nodeQ).toDecimal(decimalObj.ration.unitPrice) : 0
+            }
+
             else if (treeNode.data.type == rationType.gljRation)
             // result = treeNode.data.basePrice ? parseFloat(treeNode.data.basePrice).toDecimal(decimalObj.ration.unitPrice) : 0;
             // 这里因为是算基数所以要取基价,但不能直接取basePrice,受限于项目属性的三个选项。
@@ -836,17 +828,19 @@ let rationCalcBasesNameKinds = {
     RGF:        ['定额基价人工费', '定额人工费'],
     CLF:        ['定额基价材料费', '定额材料费'],
     QTCLF:      ['定额其他材料费'],
-    JXF:        ['定额基价机械费', '定额机械费', '定额施工机具使用费'],
-    JSRGF:      ['定额基价机上人工费'],
+    JXF:        ['定额基价机械费', '定额机械费', '定额施工机具使用费', '定额施工机械使用费'],
+    JSRGF:      ['定额基价机上人工费', '定额施工机械人工费'],
     ZCF:        ['主材费', '市场价主材费'],
-    SBF:        ['设备费'],
+    SBF:        ['定额设备费'],
     RGGR:       ['人工工日'],
     ZGCLF:      ['暂估材料费'],
 
     // 市场价人工费、市场价材料费、市场价机械费。江西用,跟重庆区分开,概念上不太统一,这里要注意区分。
     SC_RGF:     ['人工费'],
     SC_CLF:     ['材料费'],
-    SC_JXF:     ['机械费'],
+    SC_JXF:     ['机械费', '施工机具使用费', '施工机械使用费'],
+    SC_JSRGF:   ['施工机械人工费'],
+    SC_SBF:     ['设备费', '市场价设备费', '设备购置费'],
 
     JC_RGF:     ['人工费价差'],
     JC_CLF:     ['材料费价差'],
@@ -887,8 +881,14 @@ let rationCalcBases = {
     '施工机械人工费': function (node, isTender) {
         return calcTools.machineDetailFee(node, node.data.gljList, [], gljType.MACHINE_LABOUR, isTender);
     },
-    '商品砼费': function (node, isTender) {
-        return calcTools.rationBaseFee(node, [gljType.COMMERCIAL_CONCRETE, gljType.COMMERCIAL_MORTAR], priceTypes.ptMarketPrice, isTender);
+    '定额商品砼费': function (node, isTender) {
+        return calcTools.rationBaseFee(node, [gljType.COMMERCIAL_CONCRETE, gljType.COMMERCIAL_MORTAR], priceTypes.ptBasePrice, isTender);
+    },
+    '定额外购砼构件费': function (node, isTender) {
+        return calcTools.rationBaseFee(node, [gljType.PURCHASE_COMPONENT], priceTypes.ptBasePrice, isTender);
+    },
+    '定额绿化苗木费': function (node, isTender) {
+        return calcTools.rationBaseFee(node, [gljType.GREEN_SEEDLING], priceTypes.ptBasePrice, isTender);
     },
     '设备购置费': function (node, isTender) {
         return calcTools.rationBaseFee(node, [gljType.EQUIPMENT], priceTypes.ptMarketPrice, isTender);

+ 6 - 4
web/building_saas/main/js/models/fee_rate.js

@@ -217,10 +217,12 @@ var FeeRate = {
         FeeRate.prototype.onFeeRatesChange = function (infos) {//{rateID:'AAAA',value:23}
             let node = project.mainTree.selected;
             let me = this;
+            let rateMap = {};
             for(let i of infos){
-                this.refreshCalProgramByRateID(i.rateID,i.value);
+                rateMap[i.rateID] = i.value;
                 this.refreshBillsByRateID(i.rateID,i.value);
             }
+            this.refreshCalProgramByRateID(rateMap);
             if(node){
                 if (node.sourceType==='ration' && calcProgramObj.sheet) {
                     calcProgramObj.refreshCalcProgram(node, 3);
@@ -304,12 +306,12 @@ var FeeRate = {
             project.calcProgram.compileAllTemps();
             calcProgramManage.refreshDetailSheet();
         }
-        FeeRate.prototype.refreshCalProgramByRateID=function (rateID,value) {
+        FeeRate.prototype.refreshCalProgramByRateID=function (rateMap) {
             var templates = project.calcProgram.datas.templates;
             for(var i =0;i<templates.length;i++){
                 _.forEach(templates[i].calcItems,function (item) {
-                    if(item.feeRateID==rateID){
-                        item.feeRate = value;
+                    if(rateMap[item.feeRateID]){
+                        item.feeRate = rateMap[item.feeRateID];
                     }
                 })
             }

+ 3 - 7
web/building_saas/main/js/models/main_consts.js

@@ -20,10 +20,6 @@ const ModuleNames = {
 };
 
 let gljType = gljUtil.gljType;
-let gljTypeSeq =gljUtil.getGljTypeSeq(); /*[gljType.LABOUR,gljType.MAIN_MATERIAL,gljType.CONCRETE,gljType.MORTAR,gljType.MIX_RATIO,gljType.COMMERCIAL_CONCRETE,
-    gljType.COMMERCIAL_MORTAR,gljType.GENERAL_MATERIAL,gljType.OTHER_MATERIAL,gljType.GENERAL_MACHINE,gljType.INSTRUMENT,gljType.OTHER_MACHINE_USED,
-    gljType.MACHINE_COMPOSITION,gljType.MACHINE_LABOUR,gljType.FUEL_POWER_FEE,gljType.DEPRECIATION_FEE,gljType.INSPECTION_FEE,gljType.MAINTENANCE,
-    gljType.DISMANTLING_FREIGHT_FEE,gljType.VERIFICATION_FEE,gljType.OTHER_FEE,gljType.EQUIPMENT,gljType.MANAGEMENT_FEE,gljType.PROFIT,gljType.GENERAL_RISK_FEE];*/
 
 // 计算基数 [定额基价材料费] 要用到的材料类型。
 const baseMaterialTypes = [
@@ -281,7 +277,7 @@ let cpFeeTypes = [
     {type: 'marketLabour', name: '人工费'},
     {type: 'marketMaterial', name: '材料费'},
     {type: 'marketMachine', name: '施工机械使用费'},
-    {type: 'marketEquipment', name: '设备费'},
+    {type: 'marketEquipment', name: '设备购置费'},
     {type: 'marketDirect', name: '直接费'},
     {type: 'labour', name: '定额人工费'},
     {type: 'material', name: '定额材料费'},
@@ -295,8 +291,8 @@ let cpFeeTypes = [
     {type: 'force', name: '规费'},
     {type: 'profit', name: '利润'},
     {type: 'tax', name: '税金'},
-    {type: 'rationCommon', name: '定额建安费'},
-    {type: 'common', name: '建安费'}
+    {type: 'common', name: '建安费'},
+    {type: 'rationCommon', name: '定额建安费'}
     // {type: 'fee1', name: '费用1'},
     // {type: 'fee2', name: '费用2'}
 ];

+ 2 - 2
web/building_saas/main/js/views/fee_rate_view.js

@@ -591,9 +591,9 @@ var feeRateObject={
                          let lastRate = null;
                          temP.value = scMathUtil.roundForObj(value,getDecimal("feeRate")) ;
                          for(let v of valueMaps){
-                            if(parseFloat(v.value)<parseFloat(value)){
+                            if(parseFloat(v.ID)<parseFloat(value)){
                                 ltRate = v;
-                            }else if(parseFloat(v.value)>parseFloat(value)){
+                            }else if( gtRate==null && parseFloat(v.ID)>parseFloat(value)){
                                 gtRate = v;
                             }
                             lastRate = v;

+ 8 - 27
web/building_saas/main/js/views/glj_view.js

@@ -430,16 +430,7 @@ var gljOprObj = {
         }
     },
     hasComposition:function (ration_glj,isRationType) {//判断是否有组成物,有则返回true   现在主材类型的工料机也有可能有组成物。
-        let type = isRationType==true? ration_glj.subType:ration_glj.type;
-        if(gljUtil.notEditType.indexOf(type)!=-1||type==gljType.MAIN_MATERIAL){
-            let keyArray = isRationType==true? rationKeyArray:gljKeyArray;
-            let con_key = this.getIndex(ration_glj,keyArray);
-            var mixRatioMap = projectObj.project.projectGLJ.datas.mixRatioMap;
-            if(mixRatioMap[con_key]&&mixRatioMap[con_key].length>0){
-                return true;
-            }
-        }
-        return false;
+        return gljUtil.hasComposition(ration_glj,isRationType);
     },
     onRangeChanged: function (sender, args) {
         var me = gljOprObj;
@@ -771,14 +762,7 @@ var gljOprObj = {
         return gljUtil.calcPriceDiff(glj,calcOptions);
     },
     getIndex(obj, pops){
-        let t_index = '';
-        let k_arr = [];
-        for (let p of pops) {
-            let tmpK = (obj[p] == undefined || obj[p] == null || obj[p] == '') ? 'null' : obj[p];
-            k_arr.push(tmpK);
-        }
-        t_index = k_arr.join("|-|");
-        return t_index;
+      return gljUtil.getIndex(obj,pops);
     },
     getConditionByKey(conKey){//将连接字符串转换成对象
         let valueArray = conKey.split("|-|");
@@ -827,7 +811,7 @@ var gljOprObj = {
             }
             temRationGLJs.push(tem);
         }
-        temRationGLJs = gljUtil.sortRationGLJ(temRationGLJs);
+        temRationGLJs = gljUtil.sortMixRatio(temRationGLJs);
         return temRationGLJs;
     },
     showQuantityDetailData: function (node) {
@@ -1379,13 +1363,11 @@ var gljOprObj = {
         return cellType;
     },
     marketPriceReadOnly: function (node) {
-        let hasCom = false;
-        if(node.sourceType==ModuleNames.ration&&node.data.type==rationType.gljRation){
-            hasCom = this.hasComposition(node.data,true);
-        }else {
-            hasCom = this.hasComposition(node.data);
-        }
-        return hasCom;//2018-9-14 需求变更暂估工料机也能修改市场价原语句:return hasCom|| node.data.isEstimate == 1
+        let isRationType = node.sourceType==ModuleNames.ration&&node.data.type==rationType.gljRation;
+        let type = isRationType==true? node.data.subType:node.data.type;
+        if(gljUtil.isConcreteType(type)) return true;
+        return this.hasComposition(node.data,isRationType); //2018-9-14 需求变更暂估工料机也能修改市场价原语句:return hasCom|| node.data.isEstimate == 1
+
     },
     locateZTree: function(ID) {
         let zTree = $.fn.zTree.getZTreeObj("gljTree");
@@ -1609,7 +1591,6 @@ $(function () {
     }
 })
 
-
 function  operationWithRound(value1,value2,field,symble) {
     let decimal = getDecimal(field);
     value1 = scMathUtil.roundForObj(value1,decimal);

+ 26 - 7
web/building_saas/main/js/views/project_glj_view.js

@@ -92,6 +92,7 @@ projectGljObject={
         this.mixRatioSheet = this.mixRatioSpread .getSheet(0);
         this.initSheet(this.mixRatioSheet,this.mixRatioSetting);
         this.mixRatioSheet.name('mixRatioSheet');
+        this.mixRatioSheet.bind(GC.Spread.Sheets.Events.EditStarting,this.onMixRatioEditStarting);
         this.mixRatioSheet.bind(GC.Spread.Sheets.Events.RangeChanged, this.onMixRatioRangeChange);
         if(projectReadOnly){
             if(this.mixRatioSetting.view.lockColumns){
@@ -198,7 +199,7 @@ projectGljObject={
             for(let glj of data){
                 ratioList.push(me.getMixRatioSheetData(glj)) ;
             }
-            ratioList = gljUtil.sortRationGLJ(ratioList);
+            ratioList = gljUtil.sortMixRatio(ratioList);
             me.mixRatioData = ratioList;
             me.mixRatioSheet.setRowCount(0);
             sheetCommonObj.showData(me.mixRatioSheet, me.mixRatioSetting,me.mixRatioData);
@@ -258,6 +259,9 @@ projectGljObject={
             return false;
         }
         if(dataCode=='basePrice'||dataCode=='marketPrice'||dataCode=='supply'){//有组成物时,市场单价、定额价、供货方式不能修改
+            if((dataCode=='basePrice'||dataCode=='marketPrice')&&gljUtil.isConcreteType(data.type)){//混凝土,浆砂,配合比,不能修改市场单价,定额价
+                return false;
+            }
             if (data.ratio_data  && data.ratio_data.length > 0){
                 return false;
             }
@@ -342,6 +346,14 @@ projectGljObject={
             me.batchUpdateProjectGLJ(changeInfo,info.sheetName);
         }
     },
+    onMixRatioEditStarting:function (sender,info) {
+        let me = projectGljObject,row = info.row, col = info.col;
+        let parentSheet =  me.projectGljSpread.getActiveSheet();
+        let prow = parentSheet.getActiveRowIndex();//取父机械或组成物的下标
+        let prowData = parentSheet.name() == 'projectGljSheet'?me.projectGljSheetData[prow]:me.materialTree.items[prow].data;
+        console.log(prowData);
+        if(gljUtil.isConcreteType(prowData.type))  info.cancel = true;
+    },
     onMixRatioRangeChange:function (sender,info){
         let me = projectGljObject;
         let canChange = true;
@@ -462,12 +474,14 @@ projectGljObject={
             parentKey = record.connect_key;
             unit_price_file_id = record.unit_price.unit_price_file_id;
         }
-        for(let sub of me.mixRatioData){
-            let marketPrice = scMathUtil.roundForObj(sub.unit_price.market_price,getDecimal("process"));
-            let basePrice = scMathUtil.roundForObj(sub.unit_price.base_price,getDecimal("process"));
-            let consumption =  updateMap[sub.mix_ratio_id]?updateMap[sub.mix_ratio_id].consumption:scMathUtil.roundForObj(sub.consumption,getDecimal("glj.quantity"));
-            parentMarketPrice = scMathUtil.roundForObj(marketPrice*consumption + parentMarketPrice,getDecimal("process"));
-            parentBasePrice = scMathUtil.roundForObj(basePrice*consumption + parentBasePrice,getDecimal("process"));
+        if(!gljUtil.isConcreteType(parseInt(parentKey.split("|-|")[4]))){//父类型不属于混凝土浆砂配合比,才要计算
+            for(let sub of me.mixRatioData){
+                let marketPrice = scMathUtil.roundForObj(sub.unit_price.market_price,getDecimal("process"));
+                let basePrice = scMathUtil.roundForObj(sub.unit_price.base_price,getDecimal("process"));
+                let consumption =  updateMap[sub.mix_ratio_id]?updateMap[sub.mix_ratio_id].consumption:scMathUtil.roundForObj(sub.consumption,getDecimal("glj.quantity"));
+                parentMarketPrice = scMathUtil.roundForObj(marketPrice*consumption + parentMarketPrice,getDecimal("process"));
+                parentBasePrice = scMathUtil.roundForObj(basePrice*consumption + parentBasePrice,getDecimal("process"));
+            }
         }
         parentBasePrice = scMathUtil.roundForObj(parentBasePrice,getDecimal("glj.unitPrice"));
         parentMarketPrice = scMathUtil.roundForObj(parentMarketPrice,getDecimal("glj.unitPrice"));
@@ -700,6 +714,8 @@ projectGljObject={
                 data.bgColour = "#E0E0E0";
             }
         }
+        if(gljUtil.isConcreteType(glj.type)) data.bgColour = "#E0E0E0";//混凝土、砂浆、配合比的底色显示为 灰色#E0E0E0,灰色底色提醒用户不可修改。
+
         return data;
     },
     refreshProjectGljRow:function (row) {
@@ -831,6 +847,9 @@ projectGljObject={
         let me = this;
         let parentMarketPrice = 0;
         let parentBasePrice = 0;
+        let parentKey = me.mixRatioData[affectRow].connect_key;
+        let parentType = parentKey.split("|-|")[4];
+        if(gljUtil.isConcreteType(parseInt(parentType))) return [0,0]; //父工料机是混凝土浆砂,配合比,则父价格为0,不用计算
         for(let i = 0;i < me.mixRatioData.length;i++){
             let ratio = me.mixRatioData[i];
             let marketPrice = ratio.unit_price.market_price;

+ 7 - 3
web/building_saas/main/js/views/project_view.js

@@ -2342,9 +2342,13 @@ $('#poj-set').on('show.bs.modal', function () {
     }
     if (projectObj.project) {
         //江西重定义了leafBillGetFeeType的内容
-        let ft = projectObj.project.property.billsCalcMode !== undefined &&
-                 projectObj.project.property.billsCalcMode !== null ? projectObj.project.property.billsCalcMode : leafBillGetFeeType.rationContent;
-        let zg = projectObj.project.property.zanguCalcMode !== undefined &&
+        // 预算:bill, 正算,rationPrice: 2,
+        // 清单:ration, 反算,rationPriceConverse: 1,
+        let defaultCalcMode = (projectObj.project.property.valuationType == 'bill') ? leafBillGetFeeType.rationPrice : leafBillGetFeeType.rationPriceConverse;
+        let ft = (projectObj.project.property.billsCalcMode !== undefined && projectObj.project.property.billsCalcMode !== null) ?
+            projectObj.project.property.billsCalcMode : defaultCalcMode;
+
+        let zg = projectObj.project.property.zanguCalcMode !== undefined &&``
                  projectObj.project.property.zanguCalcMode !== null ? projectObj.project.property.zanguCalcMode : zanguCalcType.common;
         setCalcFlag($('#rationContent'), leafBillGetFeeType.rationContent, ft);
         setCalcFlag($('#rationPriceConverse'), leafBillGetFeeType.rationPriceConverse, ft);

+ 13 - 10
web/building_saas/pm/js/pm_newMain.js

@@ -184,7 +184,6 @@ const projTreeObj = {
             this.bindEvent(newWorkBook);
             this.loadContextMenu();
             this.loadStartMenu();
-            this.loadBtn();
         }
         return newWorkBook;
     },
@@ -1125,7 +1124,6 @@ const projTreeObj = {
         $("#mr_title").text(title);
         this.initHtmlByFromRadio();
         let result = from == "unitPriceFile"?await this.setUnitFileChangeFileData():await this.setFeeRateChangeFileData();
-        console.log(result);
         this.changeInfo = result;
         this.loadFileOptions(this.changeInfo,from);
 
@@ -1332,8 +1330,6 @@ const projTreeObj = {
         //发送文件改变消息
         data.oldFileIDs = _.uniq(oldFileIDs);
         socket.emit('multiFileChangeNotify', data);
-
-        console.log(result);
     },
     checkFileName:async function (fileID,name,type) {
         let node = this.tree.selected;
@@ -1392,7 +1388,7 @@ const projTreeObj = {
         }
         // projTreeObj.remove(sheet, fromRow, rCout);
 
-        me.renderSheetFuc(sheet, function () {
+       // me.renderSheetFuc(sheet, function () {
             sheet.deleteRows(fromRow, rCout);
             sheet.addRows(newNode.serialNo(),rCout);
             let oldSelection = sheet.getSelections()[0];
@@ -1406,7 +1402,7 @@ const projTreeObj = {
             }
             refreshNodes = refreshNodes.concat(children);
             me.refreshNodeData(refreshNodes);
-        });
+       // });
 
         function addNewNodes(node,parent,next) {
             let newNode = me.tree.addNodeData(node.data, parent, next);
@@ -1445,6 +1441,8 @@ const projTreeObj = {
 };
 
 $(document).ready(function() {
+    //绑定项目管理的升降级、上下移按钮事件
+    projTreeObj.loadBtn();
     $('#sideTab').find('li').click(function () {
        //消除tooltip
         $('[data-toggle="tooltip"]').tooltip('hide');
@@ -1537,7 +1535,6 @@ $(document).ready(function() {
     //选择计价规则
     $("#valuation").change(function () {
         let engineeringList = getEngineeringList();
-        console.log(engineeringList);
         let engineeringHtml = getEngineeringHtml(engineeringList);
         $("#tender-engineering").html(engineeringHtml);
         $('#valuation-info').hide();
@@ -1816,7 +1813,6 @@ $(document).ready(function() {
         $("#copy-to-dialog").modal('hide');
         $.bootstrapLoading.start();
         CommonAjax.post('/pm/api/copyProjects',{projectMap:projectMap,user_id: userID},function (result) {
-            console.log(result);
             let newNode = projTreeObj.insert(result['copy'].document,parent,next);
             let refreshNodes = projTreeObj.calEngineeringCost(newNode);
             projTreeObj.refreshNodeData(refreshNodes);
@@ -2590,8 +2586,14 @@ function AddTender() {
         // 一个项目里面,这两个文件必须得有,而界面又没有像费率、单价文件那样给出可选项。所以这里给出提示。
         if (!libs.artificial_lib)  throw '编办没有绑定人工系数标准文件';
 
-        let featureLibID = "";
-        if(libs.feature_lib && libs.feature_lib.length > 0) featureLibID = libs.feature_lib[0].id;
+        let featureLibID = "",
+            progressiveLibID = "";
+        if(libs.feature_lib && libs.feature_lib.length > 0) {
+            featureLibID = libs.feature_lib[0].id;
+        }
+        if(libs.progressive_lib && libs.progressive_lib.length > 0) {
+            progressiveLibID = libs.progressive_lib[0].id;
+        }
 
 
         let calcProgramName = $('#tender-calcProgram').children("option:selected").text();
@@ -2626,6 +2628,7 @@ function AddTender() {
             templateLibID:templateLibID,
             colLibID:colLibID,
             featureLibID:featureLibID,
+            progressiveLibID:progressiveLibID,
             region: region
         };
         AddTenderItems(selectedItem, projName, tenderName, tenderInfo, callback);