Просмотр исходного кода

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

TonyKang 6 лет назад
Родитель
Сommit
29d687aa82
65 измененных файлов с 1345 добавлено и 2340 удалено
  1. 3 3
      config/config.js
  2. 0 1
      config/gulpConfig.js
  3. 5 0
      modules/all_models/compleGlj_glj.js
  4. 5 0
      modules/all_models/project_glj.js
  5. 0 3
      modules/all_models/stdRation_ration.js
  6. 6 4
      modules/all_models/std_glj.js
  7. 32 0
      modules/all_models/std_progressive_lib.js
  8. 3 1
      modules/common/const/bills_fixed.js
  9. 7 54
      modules/complementary_ration_lib/models/compleRationModel.js
  10. 5 1
      modules/glj/models/glj_list_model.js
  11. 6 2
      modules/main/facade/ration_facade.js
  12. 30 0
      modules/pm/controllers/new_proj_controller.js
  13. 20 6
      modules/pm/facade/pm_facade.js
  14. 18 3
      modules/pm/models/project_model.js
  15. 3 3
      modules/pm/models/project_property_template.js
  16. 64 15
      modules/ration_glj/facade/glj_calculate_facade.js
  17. 5 1
      modules/ration_glj/facade/ration_glj_facade.js
  18. 1 0
      modules/std_billsGuidance_lib/controllers/libController.js
  19. 5 4
      modules/std_billsGuidance_lib/facade/facades.js
  20. 1 1
      modules/users/models/compilation_model.js
  21. 5 1
      public/gljUtil.js
  22. 1 0
      public/web/gljUtil.js
  23. 7 1
      public/web/id_tree.js
  24. 68 1
      public/web/sheet/sheet_common.js
  25. 9 8
      public/web/tools_const.js
  26. 1 1
      public/web/tree_sheet/tree_sheet_helper.js
  27. 1 2
      web/building_saas/complementary_glj_lib/js/components.js
  28. 80 143
      web/building_saas/complementary_glj_lib/js/glj.js
  29. 2 3
      web/building_saas/complementary_glj_lib/js/gljComponent.js
  30. 1 12
      web/building_saas/complementary_glj_lib/js/sheetOpr.js
  31. 3 6
      web/building_saas/complementary_ration_lib/js/ration.js
  32. 5 41
      web/building_saas/complementary_ration_lib/js/ration_glj.js
  33. 0 1
      web/building_saas/js/global.js
  34. 0 1
      web/building_saas/main/html/calc_program_manage.html
  35. 30 151
      web/building_saas/main/html/main.html
  36. 2 2
      web/building_saas/main/js/controllers/block_controller.js
  37. 1 1
      web/building_saas/main/js/main.js
  38. 0 7
      web/building_saas/main/js/models/bills.js
  39. 8 0
      web/building_saas/main/js/models/cache_tree.js
  40. 609 1025
      web/building_saas/main/js/models/calc_base.js
  41. 26 19
      web/building_saas/main/js/models/calc_program.js
  42. 2 3
      web/building_saas/main/js/models/fee_rate.js
  43. 5 2
      web/building_saas/main/js/models/main_consts.js
  44. 4 0
      web/building_saas/main/js/models/project_glj.js
  45. 0 4
      web/building_saas/main/js/models/ration.js
  46. 16 0
      web/building_saas/main/js/models/ration_glj.js
  47. 8 2
      web/building_saas/main/js/views/billsElf.js
  48. 36 110
      web/building_saas/main/js/views/calc_base_view.js
  49. 12 1
      web/building_saas/main/js/views/fee_rate_view.js
  50. 2 2
      web/building_saas/main/js/views/glj_col.js
  51. 12 10
      web/building_saas/main/js/views/glj_view.js
  52. 7 5
      web/building_saas/main/js/views/main_tree_col.js
  53. 4 0
      web/building_saas/main/js/views/project_glj_view.js
  54. 4 8
      web/building_saas/main/js/views/project_property_basicInfo.js
  55. 16 26
      web/building_saas/main/js/views/project_property_projFeature.js
  56. 97 171
      web/building_saas/main/js/views/project_view.js
  57. 22 71
      web/building_saas/main/js/views/quantity_edit_view.js
  58. 0 3
      web/building_saas/main/js/views/side_tools.js
  59. 8 15
      web/building_saas/main/js/views/std_billsGuidance_lib.js
  60. 0 2
      web/building_saas/main/js/views/std_bills_lib.js
  61. 2 369
      web/building_saas/main/js/views/sub_view.js
  62. 4 3
      web/building_saas/pm/js/pm_newMain.js
  63. 1 0
      web/common/html/header.html
  64. 1 1
      web/users/html/login.html
  65. 4 4
      web/users/html/user-set.html

Разница между файлами не показана из-за своего большого размера
+ 3 - 3
config/config.js


+ 0 - 1
config/gulpConfig.js

@@ -152,7 +152,6 @@ module.exports = {
         'web/building_saas/report/js/jpc_output_value_define.js',
         'web/building_saas/report/js/jpc_output.js',
         'web/building_saas/report/js/rpt_print.js',
-        'web/building_saas/main/js/views/character_content_view.js',
         'web/building_saas/main/js/views/glj_view.js',
         'web/building_saas/main/js/views/zmhs_view.js',
         'web/building_saas/main/js/views/mbzm_view.js',

+ 5 - 0
modules/all_models/compleGlj_glj.js

@@ -28,6 +28,11 @@ const comple_glj = new Schema({
     gljType: Number,
     model: Number,
     shortName: String,
+    //以下仅普通材料可用
+    grossWeightCoe: Number, //毛重系数
+    purchaseStorageRate: Number, //采购保管费率
+    offSiteTransportLossRate: Number, //场外运输损耗率
+    handlingLossRate: Number, //每增一次装卸损耗率
     component: [comple_gljComponent]
 }, {versionKey: false});
 

+ 5 - 0
modules/all_models/project_glj.js

@@ -102,6 +102,11 @@ let modelSchema = {
         type: Number,
         default: 0
     },
+    //以下仅普通材料可用
+    grossWeightCoe: Number, //毛重系数
+    purchaseStorageRate: Number, //采购保管费率
+    offSiteTransportLossRate: Number, //场外运输损耗率
+    handlingLossRate: Number, //每增一次装卸损耗率
     ratio_data: Schema.Types.Mixed,
     remark:String
 };

+ 0 - 3
modules/all_models/stdRation_ration.js

@@ -34,9 +34,6 @@ const rationItemSchema = new Schema({
     name: String,
     unit: String,
     basePrice: Number,
-    labourPrice: Number,
-    materialPrice: Number,
-    machinePrice: Number,
     sectionId: Number,
     rationRepId: Number,
     caption: String,

+ 6 - 4
modules/all_models/std_glj.js

@@ -30,14 +30,16 @@ const std_glj = new Schema({
         type: Schema.Types.Mixed,
         default: {}
     },
+    model: Number,
     gljClass: Number,
     gljType: Number,
-    model: Number,// 机型
     shortName: String,
     unit: String,
-    adjCoe: Number,
-    materialType: Number,   //三材类别
-    materialCoe: Number,    //三材系数
+    //以下仅普通材料可用
+    grossWeightCoe: Number, //毛重系数
+    purchaseStorageRate: Number, //采购保管费率
+    offSiteTransportLossRate: Number, //场外运输损耗率
+    handlingLossRate: Number, //每增一次装卸损耗率
     component: [std_gljComponent]
 },{versionKey: false});
 

+ 32 - 0
modules/all_models/std_progressive_lib.js

@@ -0,0 +1,32 @@
+'use strict';
+
+/**
+ *
+ *
+ * @author Zhong
+ * @date 2019/1/25
+ * @version
+ */
+
+/*
+* 累进区间库
+* 设置清单基数中金额区间与费率的对应关系,清单基数累进算法使用
+* */
+
+const mongoose = require('mongoose');
+const Schema = mongoose.Schema;
+const oprSchema = require('../all_schemas/opr_schema');
+
+const progressiveInterval = new Schema({
+    ID: String,
+    name: String,
+    creator: String,
+    createDate: Date,
+    recentOpr: [oprSchema],
+    data: {
+        type: [Schema.Types.Mixed],
+        default: []
+    },
+}, {versionKey: false});
+
+mongoose.model('std_progressive_lib', progressiveInterval, 'std_progressive_lib');

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

@@ -55,7 +55,9 @@ const fixedFlag = {
     //暂列金额
     PROVISIONAL:26,
     //安全生产费
-    SAFE_COST:27
+    SAFE_COST:27,
+    //100章清单
+    ONE_HUNDRED_BILLS: 28
 };
 
 export default fixedFlag;

+ 7 - 54
modules/complementary_ration_lib/models/compleRationModel.js

@@ -324,24 +324,10 @@ class CompleRatoinDao {
                             else{
                                 let gljArr = [];
                                 for(let i=0; i<gljItems.length; i++){
-                                    let gljParentType = -1;
                                     if(gljItems[i].ID === adjGljId){
-                                        gljItems[i].gljType = adjGljType;
-                                    }
-                                    if(gljItems[i].gljType <= 3){
-                                        gljParentType = gljItems[i].gljType;
-                                    }
-                                    if(gljItems[i].gljType > 200 && gljItems[i].gljType < 300){
-                                        gljParentType = 2;
-                                    }
-                                    if(gljItems[i].gljType > 300 && gljItems[i].gljType < 400){
-                                        gljParentType = 3;
-                                    }
-                                    if(gljItems[i].ID === adjGljId){
-                                        gljArr.push({gljId: gljItems[i].ID, basePrice: adjBasePrice, gljParentType: gljParentType});
-                                    }
-                                    else {
-                                        gljArr.push({gljId: gljItems[i].ID, basePrice: parseFloat(gljItems[i].basePrice), gljParentType: gljParentType});
+                                        gljArr.push({gljId: gljItems[i].ID, basePrice: adjBasePrice});
+                                    } else {
+                                        gljArr.push({gljId: gljItems[i].ID, basePrice: parseFloat(gljItems[i].basePrice)});
                                     }
                                 }
                                 gljArr.forEach(function (gljItem) {
@@ -352,46 +338,13 @@ class CompleRatoinDao {
                                     })
                                 });
                                 //recalculate the price of ration
-                                let labourPrc = [], materialPrc = [], machinePrc = [], singlePrc, updatePrc = {labourPrice: 0, materialPrice: 0, machinePrice: 0, basePrice: 0};
+                                let basePrice = 0;
                                 gljArr.forEach(function (gljItem) {
-                                    if(gljItem.gljParentType !== -1){
-                                        singlePrc = scMathUtil.roundTo(gljItem.basePrice * gljItem.consumeAmt, -3);
-                                        if(gljItem.gljParentType === 1){
-                                            labourPrc.push(singlePrc);
-                                        }
-                                        else if(gljItem.gljParentType ===2){
-                                            materialPrc.push(singlePrc);
-                                        }
-                                        else{
-                                            machinePrc.push(singlePrc);
-                                        }
-                                    }
+                                    basePrice += gljItem.basePrice * gljItem.consumeAmt;
                                 });
-                                if(labourPrc.length > 0){
-                                    let sumLaP = 0;
-                                    for(let i=0; i<labourPrc.length; i++){
-                                        sumLaP += labourPrc[i];
-                                    }
-                                    updatePrc.labourPrice = scMathUtil.roundTo(sumLaP, -2);
-                                }
-                                if(materialPrc.length > 0){
-                                    let sumMtP = 0;
-                                    for(let i= 0; i<materialPrc.length; i++){
-                                        sumMtP += materialPrc[i];
-                                    }
-                                    updatePrc.materialPrice = scMathUtil.roundTo(sumMtP, -2);
-                                }
-                                if(machinePrc.length > 0){
-                                    let sumMaP = 0;
-                                    for(let i =0; i< machinePrc.length; i++){
-                                        sumMaP += machinePrc[i];
-                                    }
-                                    updatePrc.machinePrice = scMathUtil.roundTo(sumMaP, -2);
-                                }
-                                updatePrc.basePrice = scMathUtil.roundTo(updatePrc.labourPrice + updatePrc.materialPrice + updatePrc.machinePrice, -2);
+                                basePrice = scMathUtil.roundTo(basePrice, 0);
                                 //updateDataBase
-                                compleRationModel.update({ID: rationItem.ID}, {$set: {labourPrice: updatePrc.labourPrice.toString(), materialPrice: updatePrc.materialPrice.toString(),
-                                        machinePrice: updatePrc.machinePrice.toString(), basePrice: updatePrc.basePrice.toString()}},
+                                compleRationModel.update({ID: rationItem.ID}, {$set: {basePrice: basePrice.toString()}},
                                     function (err, result) {
                                         if(err){
                                             ecb(err);

+ 5 - 1
modules/glj/models/glj_list_model.js

@@ -602,7 +602,11 @@ class GLJListModel extends BaseModel {
                     adjCoe:tmp.adjCoe,
                     original_code:tmp.code,
                     materialType: tmp.materialType,   //三材类别
-                    materialCoe: tmp.materialCoe
+                    materialCoe: tmp.materialCoe,
+                    grossWeightCoe:tmp.grossWeightCoe,
+                    purchaseStorageRate:tmp.purchaseStorageRate,
+                    offSiteTransportLossRate:tmp.offSiteTransportLossRate,
+                    handlingLossRate:tmp.handlingLossRate
                 };
                 gljInsertData.push(gljData);
             }

+ 6 - 2
modules/main/facade/ration_facade.js

@@ -443,6 +443,10 @@ async function addRationGLJ(std,newRation,compilation) {
                 newGLJ.adjCoe = std_glj.adjCoe;
                 newGLJ.materialType = std_glj.materialType;
                 newGLJ.materialCoe = std_glj.materialCoe;
+                newGLJ.grossWeightCoe = std_glj.grossWeightCoe;
+                newGLJ.purchaseStorageRate = std_glj.purchaseStorageRate;
+                newGLJ.offSiteTransportLossRate = std_glj.offSiteTransportLossRate;
+                newGLJ.handlingLossRate = std_glj.handlingLossRate;
                 newGLJ.createType = 'normal';
                 let info =  await ration_glj_facade.getInfoFromProjectGLJ(newGLJ,unitPriceFileId,ext);
                 newGLJ = ration_glj_facade.createNewRecord(info);
@@ -616,10 +620,10 @@ async function CalculateQuantity (ration,billsItemID,projectID) {
     let decimalObject =await decimal_facade.getProjectDecimal(projectID,project);
     let quantity_decimal = (decimalObject&&decimalObject.ration&&decimalObject.ration.quantity)?decimalObject.ration.quantity:3;
     let pbill = await bill_model.model.findOne({projectID:projectID,ID:billsItemID});
-    let  t_unit = ration.unit?ration.unit.replace(/^\d+/,""):"";
+   /* let  t_unit = ration.unit?ration.unit.replace(/^\d+/,""):""; 2019-02-01 养护去掉清单与定额单位的这个判断
     if(t_unit!=pbill.unit){//如果定额工程量的单位去除前面的数字后不等于清单单位,定额工程量保持不变
         return ;
-    }
+    }*/
     let billsQuantity = pbill.quantity ? pbill.quantity : 0;
     let bill_decimal = await decimal_facade.getBillsQuantityDecimal(projectID,pbill.unit,project);
     billsQuantity=scMathUtil.roundForObj(billsQuantity,bill_decimal);

+ 30 - 0
modules/pm/controllers/new_proj_controller.js

@@ -15,6 +15,31 @@ import EngineeringLibModel from "../../users/models/engineering_lib_model";
 
 module.exports = {
     copyTemplateData: async function (property, newProjID, callback) {
+        //转换ID引用,原本@ID ID为原ID,需要替换为新的uuid
+        function parseCalcBase(calcBase, uuidMapping) {
+            let rst = '';
+            let reg = /@\d+/g,
+                numberData = Array.from(new Set(calcBase.match(reg))); //eg: @1
+            let regForOpr = /[\+,\-,\*,\/]/g,
+                oprData = calcBase.match(regForOpr); //eg: +
+            let regForID = /\d+/g;
+            let uuidArr = [];
+            for (let data of numberData) {
+                let orgID = data.match(regForID);
+                if (orgID && orgID[0] && uuidMapping[orgID[0]]) {
+                    uuidArr.push(uuidMapping[orgID[0]]);
+                }
+            }
+            for (let i = 0; i < uuidArr.length; i++) {
+                let uid = uuidArr[i],
+                    opr = oprData[i - 1];
+                if (opr) {
+                    rst += opr;
+                }
+                rst += `@${uid}`;
+            }
+            return rst;
+        }
         async.parallel([
             async function (cb) {
                 // 获取清单模板数据
@@ -27,11 +52,16 @@ module.exports = {
                 for(let bill of billsDatas){
                     uuidMaping[bill.ID] = uuidV1();
                 }
+                let needParseReg = /@/g;
                 billsDatas.forEach(function (template) {
                     template.projectID = newProjID;
                     template.ID = uuidMaping[template.ID] ? uuidMaping[template.ID] : -1;
                     template.ParentID = uuidMaping[template.ParentID] ? uuidMaping[template.ParentID] : -1;
                     template.NextSiblingID = uuidMaping[template.NextSiblingID] ? uuidMaping[template.NextSiblingID] : -1;
+                    //需要转换ID引用
+                    if (template.calcBase && needParseReg.test(template.calcBase)) {
+                        template.calcBase = parseCalcBase(template.calcBase, uuidMaping);
+                    }
                 });
                 billsData.insertData(billsDatas, callback);
             },

+ 20 - 6
modules/pm/facade/pm_facade.js

@@ -18,6 +18,7 @@ module.exports={
     getConstructionProject: getConstructionProject,
     getFullPath: getFullPath,
     getProjectFeature:getProjectFeature,
+    getProgressiveInterval: getProgressiveInterval,
     projectType: projectType,
     getPosterityProjects: getPosterityProjects,
     isShare: isShare,
@@ -57,6 +58,7 @@ let rationTemplateModel = mongoose.model('ration_template');
 let userModel = mongoose.model('user');
 let compleGljSectionModel = mongoose.model('complementary_glj_section');
 let compleGljSectionTModel = mongoose.model('complementary_glj_section_templates');
+let progressiveModel = mongoose.model('std_progressive_lib');
 
 let featureLibModel =  mongoose.model("std_project_feature_lib");
 let scMathUtil = require('../../../public/scMathUtil').getUtil();
@@ -782,17 +784,29 @@ async function getFullPath(projectID) {
     }
 }
 
-async function getProjectFeature(libID,feeStandardName){
-    let lib = await featureLibModel.findOne({'ID':libID})
-    if(lib){
-        let eng = _.find(lib.feature,{'key':'engineering'})
-        if(eng) eng.value = feeStandardName;
+//@param {String}libID(工程特征库ID) {Object}assign(需要赋值的key-value)
+async function getProjectFeature(libID, assign) {
+    let lib = await featureLibModel.findOne({'ID':libID});
+    if (lib) {
+        for (let key in assign) {
+            let obj = _.find(lib.feature, {key: key});
+            if (obj) {
+                obj.value = assign[key];
+            }
+        }
         return lib.feature;
-    }else {
+
+    } else {
         return [];
     }
 }
 
+//获取累进区间数据
+async function getProgressiveInterval(libID) {
+    let lib = await progressiveModel.findOne({ID: libID});
+    return lib ? lib.data : [];
+}
+
 //获取projectIDs文件下所有子项目(不包括projectIDs本身)
 async function getPosterityProjects(projectIDs) {
     let rst = [];

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

@@ -95,6 +95,7 @@ ProjectsDAO.prototype.getUserProject = function (userId, ProjId, callback) {
             if(template && userId !== template.userID){
                 template._doc.readOnly = true;
             }
+
             callback(0, '', template);
         }
     });
@@ -164,12 +165,20 @@ ProjectsDAO.prototype.updateUserProjects = async function (userId, compilationId
                     //data.updateData.property.basicInformation = basicInformation;
                     //工程特征
                     if(data.updateData.property.featureLibID){
-                        //工程专业显示费用定额的名称
-                        data.updateData.property.projectFeature = await pmFacade.getProjectFeature(data.updateData.property.featureLibID, data.updateData.property.feeStandardName);
+                        //项目类别(valuationType)、养护类别(engineering)、费用标准(feeStandard)根据新建分选的选项去赋值
+                        let assign = {
+                            valuationType: data.updateData.property.valuationType === 'bill' ? '预算' : '工程量清单',
+                            engineering: data.updateData.property.engineeringName,
+                            feeStandard: data.updateData.property.feeStandardName
+                        };
+                        data.updateData.property.projectFeature = await pmFacade.getProjectFeature(data.updateData.property.featureLibID, assign);
                     }
                     /*projectFeature[0]['value'] = data.updateData.property.engineeringName || '';
                     data.updateData.property.projectFeature = projectFeature;*/
-
+                    //累进区间
+                    if (data.updateData.property.progressiveLibID) {
+                        data.updateData.property.progressiveInterval = await pmFacade.getProgressiveInterval(data.updateData.property.progressiveLibID);
+                    }
                     //呈现选项
                     data.updateData.property.displaySetting = displaySetting;
                     let defaultCalcMode = (data.updateData.property.valuationType == 'bill') ? 2 : 1;
@@ -177,6 +186,12 @@ ProjectsDAO.prototype.updateUserProjects = async function (userId, compilationId
                     data.updateData.property.zanguCalcMode = 0;
                     //计算选项
                     data.updateData.property.calcOptions = calcOptions;
+                    if (data.updateData.property.valuationType == 'bill') {//价差预备费
+                        //年造价增涨率
+                        data.updateData.property.costGrowthRate = 0;
+                        //增涨计费年限
+                        data.updateData.property.growthPeriod = 0;
+                    }
                     //安装增加费
                     if(data.updateData.property.isInstall == true || data.updateData.property.isInstall=='true'){//判断是否安装工程
                         await installationFacade.copyInstallationFeeFromLib(data.updateData.ID,data.updateData.property.engineering_id);

+ 3 - 3
modules/pm/models/project_property_template.js

@@ -5,8 +5,8 @@
 //默认的小数位数,用于定义用户可编辑的字段(入库),用户不可编辑的字段在前端defaultDecima._def中定义即可
 const defaultDecimal = {
     bills: {unitPrice: 2, totalPrice: 0},
-    ration: {quantity: 4, unitPrice: 2, totalPrice: 0},
-    glj: {quantity: 4, unitPriceHasMix: 2, unitPrice: 3},
+    ration: {quantity: 3, unitPrice: 2, totalPrice: 0},
+    glj: {quantity: 3, unitPriceHasMix: 2, unitPrice: 3},
     feeRate: 3,
     quantity_detail: 4,
     material:5,//三材系数
@@ -25,7 +25,7 @@ const tenderSetting = {
 };
 
 const calcOptions={
-    calc_main:false,
+    calc_main:true,
     calc_add:true,
     calc_est:true
 }

+ 64 - 15
modules/ration_glj/facade/glj_calculate_facade.js

@@ -8,6 +8,8 @@ let _=require("lodash");
 let ration_glj = mongoose.model('ration_glj');
 let ration = mongoose.model('ration');
 let ration_coe = mongoose.model('ration_coe');
+const ProjectModel = require('../../pm/models/project_model').project;
+let mixRatioModel = mongoose.model('mix_ratio');
 let std_ration_lib_ration_items = mongoose.model('std_ration_lib_ration_items');
 let std_glj_lib_gljList_model = mongoose.model('std_glj_lib_gljList');
 let glj_type_util = require('../../../public/cache/std_glj_type_util');
@@ -49,9 +51,7 @@ async function calculateQuantity(query,noNeedCal,refreshRationName = false){
          let impactRation = await ration.findOne({ID:query.rationID,projectID:query.projectID});
          let gljList = await ration_glj.find(query);//{projectID:query.projectID,rationID:query.rationID}
          let coeList = await ration_coe.find({projectID:query.projectID,rationID:query.rationID}).sort('seq').exec();
-         let assList=[];
-         let assRation = null;
-         let adjustState=[];
+         let assList=[], assRation = null, adjustState=[],mixRatioMap = {};
          if(!impactRation){//如果定额不存在或者已删除,返回空
              return null;
          }
@@ -65,12 +65,15 @@ async function calculateQuantity(query,noNeedCal,refreshRationName = false){
                  }
              }
          }
-         gljList = sortRationGLJ(gljList);
-         for(let i =0;i<gljList.length;i++ ){
-             let r = await calculateQuantityPerGLJ(gljList[i],gljList,coeList,assList,adjustState,noNeedCal);
-             result.glj_result.push(r);
+         for(let glj of gljList){//先把混凝土,砂浆,配合比有自定义消耗的挑出来
+             if(gljUtil.isConcreteType(glj.type)&& !noCustomQuantiyt(glj)) await getMixRatioMap(glj,gljList,coeList,assList,mixRatioMap);
          }
 
+        gljList = sortRationGLJ(gljList);
+        for(let i =0;i<gljList.length;i++ ){
+            let r = await calculateQuantityPerGLJ(gljList[i],gljList,coeList,assList,adjustState,mixRatioMap,noNeedCal);
+            result.glj_result.push(r);
+        }
          if(noNeedCal==null){
             await ration_glj.bulkWrite(generateUpdateTasks(result.glj_result));
          }
@@ -137,8 +140,16 @@ function sortRationGLJ(list) {
     return list;
 }
 
-async function calculateQuantityPerGLJ(glj,gljList,coeList,assList,adjustState,noNeedCal) {
-    let decimalObject =await decimal_facade.getProjectDecimal(glj.projectID);
+async function calcWhenNoCustomQuantiyt(decimal,glj,gljList,coeList,assList) {
+    let quantity = glj.rationItemQuantity ? scMathUtil.roundTo(parseFloat(glj.rationItemQuantity),-decimal):0;
+    quantity =scMathUtil.roundTo(await calculateAss(quantity,assList,glj),-decimal);
+    quantity = calculateQuantityByCoes(quantity,coeList,glj,gljList,decimal);
+    return quantity;
+}
+
+
+async function calculateQuantityPerGLJ(glj,gljList,coeList,assList,adjustState,mixRatioMap,noNeedCal) {
+    let decimalObject = await decimal_facade.getProjectDecimal(glj.projectID);
     let decimal = (decimalObject&&decimalObject.glj&&decimalObject.glj.quantity)?decimalObject.glj.quantity:3;
     let quantity =  scMathUtil.roundTo(parseFloat(glj.quantity),-decimal);
     let result={
@@ -151,12 +162,14 @@ async function calculateQuantityPerGLJ(glj,gljList,coeList,assList,adjustState,n
         }
     };
     try {
-        if(noNeedCal==null){
-            if(!glj._doc.hasOwnProperty('customQuantity')||glj.customQuantity==null||glj.customQuantity==""){
-                quantity =scMathUtil.roundTo(parseFloat(glj.rationItemQuantity),-decimal);
-                quantity =scMathUtil.roundTo(await calculateAss(quantity,assList,glj),-decimal);
-                quantity = calculateQuantityByCoes(quantity,coeList,glj,gljList,decimal);
-            }else {
+        if(noNeedCal==null){//计算顺序:辅助定额,附注条件,自定义消耗(如果有就不用前计算两项),自定义乘系数
+            if(noCustomQuantiyt(glj)){
+                quantity = await calcWhenNoCustomQuantiyt(decimal,glj,gljList,coeList,assList);
+                let mIndex = gljUtil.getIndex(glj);
+                if(mixRatioMap[mIndex]){//组成物
+                    quantity = calcQuantityForMix(quantity,mixRatioMap[mIndex],decimal);
+                }
+            }else {//对于有自定义消耗量的,并且是混凝土,浆砂,配合比 这三种类型,其组成物的消耗量要跟据自定义消耗量做相应的换算
                 quantity = glj.customQuantity;
                 result.doc.customQuantity = glj.customQuantity;
             }
@@ -165,6 +178,7 @@ async function calculateQuantityPerGLJ(glj,gljList,coeList,assList,adjustState,n
                 quantity = scMathUtil.roundToString(quantity,decimal);
                 quantity = calculateQuantityByCustomerCoes(quantity,customerCoe,glj,decimal);
             }
+            if(quantity < 0) quantity = 0;
             result.doc.quantity =scMathUtil.roundToString(quantity,decimal);
             //2019-01-03 需求修改中间过程的价格不参与计算
             //glj.quantity = quantity;//这里保存中间过程计算出来的消耗量,后面处理“+*”操作符时要用到
@@ -176,6 +190,41 @@ async function calculateQuantityPerGLJ(glj,gljList,coeList,assList,adjustState,n
     }
 }
 
+function calcQuantityForMix(quantity,plist,decimal) {
+    for(let pglj of plist){
+        let consumption = scMathUtil.roundForObj(pglj.consumption,decimal);
+        let customQuantity = scMathUtil.roundForObj(pglj.customQuantity,decimal);
+        let temQuantity =  scMathUtil.roundForObj(consumption * pglj.assCoeQuantity,6);
+        let pcustomQuantity = scMathUtil.roundForObj(consumption * customQuantity,6);
+        quantity = scMathUtil.roundForObj(quantity - temQuantity,6);
+        quantity = scMathUtil.roundForObj(quantity + pcustomQuantity,decimal);
+    }
+    return quantity;
+}
+
+
+async function getMixRatioMap(glj,gljList,coeList,assList,mixRatioMap) {//生成组成物对应的父工料机的映射表
+    let decimalObject = await decimal_facade.getProjectDecimal(glj.projectID);
+    let decimal = (decimalObject&&decimalObject.glj&&decimalObject.glj.quantity)?decimalObject.glj.quantity:3;
+    let assCoeQuantity = await calcWhenNoCustomQuantiyt(decimal,glj,gljList,coeList,assList);//计算要用父工料机经过辅助子目换算后的量
+    let unitPriceFileId = await ProjectModel.getUnitPriceFileId(glj.projectID);
+    let connect_key = gljUtil.getIndex(glj);
+    let mixList =  await mixRatioModel.find({"unit_price_file_id":unitPriceFileId,'connect_key':connect_key})
+    for(let m of mixList){
+        let mkey = gljUtil.getIndex(m);
+        if(mixRatioMap[mkey]){
+            mixRatioMap[mkey].push({customQuantity:glj.customQuantity,assCoeQuantity:assCoeQuantity,consumption:m.consumption});
+        }else {
+            mixRatioMap[mkey] = [{customQuantity:glj.customQuantity,assCoeQuantity:assCoeQuantity,consumption:m.consumption}];
+        }
+    }
+}
+
+
+function noCustomQuantiyt(glj) {//是否有自定义消耗量
+    return !glj._doc.hasOwnProperty('customQuantity')||glj.customQuantity==null||glj.customQuantity==""
+}
+
 async function calculateAss(quantity,assList,glj) {
     for(let i=0;i<assList.length;i++){
         if(assList[i].assRation){

+ 5 - 1
modules/ration_glj/facade/ration_glj_facade.js

@@ -595,6 +595,10 @@ function getGLJSearchInfo(ration_glj) {
         adjCoe: ration_glj.adjCoe,
         materialType:ration_glj.materialType,
         materialCoe:ration_glj.materialCoe,
+        grossWeightCoe:ration_glj.grossWeightCoe,
+        purchaseStorageRate:ration_glj.purchaseStorageRate,
+        offSiteTransportLossRate:ration_glj.offSiteTransportLossRate,
+        handlingLossRate:ration_glj.handlingLossRate,
         from: ration_glj.from ? ration_glj.from : 'std'//std:标准工料机库, cpt:补充工料机库
     };
     let glj_type_object = glj_type_util.getStdGljTypeCacheObj();
@@ -822,7 +826,7 @@ async function insertGLJAsRation(data,compilation) {
         }
         await ration.update(query, {$inc: {serialNo: gljList.length}}, {multi: true});
     }
-    let [unitFileId,ext] = await prepareExtData(data.doc.projectID,compilation);
+    let [unitFileId,ext] = await prepareExtData(data.projectID,compilation);
     for (let glj of gljList) {
         let p_glj = getGLJSearchInfo(glj);
         let projectGljModel = new GLJListModel();

+ 1 - 0
modules/std_billsGuidance_lib/controllers/libController.js

@@ -23,6 +23,7 @@ class BillsGuideLibController extends BaseController{
             callback(req, res, 0, '', rst);
         }
         catch(err){
+            console.log(err);
             callback(req, res, 1, err, null);
         }
     }

+ 5 - 4
modules/std_billsGuidance_lib/facade/facades.js

@@ -32,16 +32,17 @@ async function getBillsGuideLibs(findData) {
 
 
 async function getLibWithBills(libID){
-    let guidanceLib = await getBillsGuideLibs({ID: libID});
+    /*let guidanceLib = await getBillsGuideLibs({ID: libID});
     if(guidanceLib.length === 0){
         throw '不存在此指引库!';
-    }
-    let billsLib = await stdBillsLibModel.findOne({billsLibId: guidanceLib[0].billsLibId});
+    }*/
+    let billsLib = await stdBillsLibModel.findOne({billsLibId: libID});
     if(!billsLib){
         throw '引用的清单规则库不存在!';
     }
     let bills = await stdBillsModel.find({billsLibId: billsLib.billsLibId}, '-_id');
-    return {guidanceLib: guidanceLib[0], bills};
+    //return {guidanceLib: guidanceLib[0], bills};
+    return {bills};
 }
 
 function getAttrs(field, datas){

+ 1 - 1
modules/users/models/compilation_model.js

@@ -61,7 +61,7 @@ class CompilationModel extends BaseModel {
             let enableValuation = [];
             for (let index in compilationData.ration_valuation) {
                 if (compilationData.ration_valuation[index].enable) {
-                    enableValuation.push(compilationData.bill_valuation[index]);
+                    enableValuation.push(compilationData.ration_valuation[index]);
                 }
             }
             compilationData.ration_valuation = enableValuation;

+ 5 - 1
public/gljUtil.js

@@ -17,7 +17,8 @@ module.exports = {
     getBasePrice:getBasePrice,
     getAdjustPrice:getAdjustPrice,
     getMainType:getMainType,
-    isConcreteType:isConcreteType
+    isConcreteType:isConcreteType,
+    getIndex:getIndex
 };
 
 function calcProjectGLJQuantity(projectGLJDatas,rationGLJDatas,rationDatas,billsDatas,q_decimal) {
@@ -47,6 +48,9 @@ function calcPriceDiff(glj,calcOptions) {
 function getMainType() {
     return gljNodeUtil.getMainType();
 }
+function getIndex(obj, pops) {
+    return gljNodeUtil.getIndex(obj, pops);
+}
 
 function isConcreteType(type) {
     return gljNodeUtil.isConcreteType(type);

+ 1 - 0
public/web/gljUtil.js

@@ -288,6 +288,7 @@ let gljUtil = {
     getIndex(obj, pops){
         let t_index = '';
         let k_arr = [];
+        if(!this.isDef(pops)) pops = this.gljKeyArray;
         for (let p of pops) {
             let tmpK = (obj[p] == undefined || obj[p] == null || obj[p] == '') ? 'null' : obj[p];
             k_arr.push(tmpK);

+ 7 - 1
public/web/id_tree.js

@@ -277,7 +277,13 @@ var idTree = {
                     tools.addUpdateDataForNextSibling(data, this.preSibling, this.tree.setting.rootId);
                 }
                 tools.addUpdateDataForNextSibling(data, this.parent, this.getID());
-                data.push({type: 'update', data: this.tree.getDataTemplate(this.getID(), this.parent.getParentID(), this.parent.getNextSiblingID())});
+                let updateData = this.tree.getDataTemplate(this.getID(), this.parent.getParentID(), this.parent.getNextSiblingID());
+                //如果设置了专项暂定,则需要清空
+                if (this.data.specialProvisional) {
+                    this.data.specialProvisional = '';
+                }
+                updateData.specialProvisional = '';
+                data.push({type: 'update', data: updateData});
             }
             return data;
         };

+ 68 - 1
public/web/sheet/sheet_common.js

@@ -109,7 +109,7 @@ var sheetCommonObj = {
             area.vAlign(GC.Spread.Sheets.VerticalAlign.center);
         }
     },
-    showData: function(sheet, setting, data,distTypeTree) {
+    showData: function(sheet, setting, data,distTypeTree,callback) {//这个callback是为了在showdata后还做了引起重画表格的操作,在callback里调用能提高效率
         var me = this, ch = GC.Spread.Sheets.SheetArea.viewport;
         sheet.suspendPaint();
         sheet.suspendEvent();
@@ -159,6 +159,7 @@ var sheetCommonObj = {
             }
         }
         this.lockCells(sheet,setting);
+        if(callback) callback();
         sheet.resumeEvent();
         sheet.resumePaint();
         //me.shieldAllCells(sheet);
@@ -544,6 +545,72 @@ var sheetCommonObj = {
         };
         return new selectButton();
     },
+    getCusButtonCellType:function (callback,readOnly=false) {
+        var ns = GC.Spread.Sheets;
+        function CusButtonCellType() {
+        }
+        CusButtonCellType.prototype = new ns.CellTypes.Text();
+        CusButtonCellType.prototype.paint = function (ctx, value, x, y, w, h, style, options) {
+
+            if(!readOnly){
+                if(options.sheet.getActiveRowIndex()==options.row&&options.sheet.getActiveColumnIndex()==options.col){
+                    var image = document.getElementById('f_btn'),imageMagin = 3;
+                    var imageHeight = 15;
+                    var imageWidth = 25;
+                    var imageX = x + w - imageWidth- imageMagin, imageY = y + h / 2 - imageHeight / 2;
+                    ctx.save();
+                    ctx.fillStyle = style.backColor;
+                    ctx.fillRect(x,y,w,h);
+                    ctx.drawImage(image, imageX, imageY,imageWidth,imageHeight);
+                    ctx.beginPath();
+                    ctx.arc(imageX+imageWidth/2,imageY+imageHeight/2,1,0,360,false);
+                    ctx.arc(imageX+imageWidth/2-4,imageY+imageHeight/2,1,0,360,false);
+                    ctx.arc(imageX+imageWidth/2+4,imageY+imageHeight/2,1,0,360,false);
+                    ctx.fillStyle="black";//填充颜色,默认是黑色
+                    ctx.fill();//画实心圆
+                    ctx.closePath();
+                    ctx.restore();
+                    w = w - imageWidth - imageMagin;
+                    //这里的左对齐的,当显示的字长度超过空白地方时,要改成右对齐
+                    if(style.hAlign == 0){
+                        if(value){
+                            let textWidth = ctx.measureText(value).width;
+                            let spaceWidth = w;
+                            if(spaceWidth<textWidth){
+                                style.hAlign = 2;
+                            }
+                        }
+                    }
+
+                }
+            }
+            GC.Spread.Sheets.CellTypes.Text.prototype.paint.apply(this, arguments);
+        };
+        CusButtonCellType.prototype.getHitInfo = function (x, y, cellStyle, cellRect, context) {
+            return {
+                x: x,
+                y: y,
+                row: context.row,
+                col: context.col,
+                cellStyle: cellStyle,
+                cellRect: cellRect,
+                sheetArea: context.sheetArea
+            };
+        };
+
+        CusButtonCellType.prototype.processMouseDown = function (hitinfo) {
+            if(hitinfo.sheet.getActiveRowIndex()==hitinfo.row&&hitinfo.sheet.getActiveColumnIndex()==hitinfo.col){
+                var offset=hitinfo.cellRect.x+hitinfo.cellRect.width-6;
+                var imageWidth = 25;
+                if(hitinfo.x<offset&&hitinfo.x>offset-imageWidth){
+                    if(!readOnly){
+                        if(callback) callback(hitinfo)
+                    }
+                }
+            }
+        };
+        return new CusButtonCellType();
+    },
     setReplaceButton(row,col,sheet){
         let replaceButton = function(){
 

+ 9 - 8
public/web/tools_const.js

@@ -7,17 +7,18 @@
  * @date 2018/8/16
  * @version
  */
-//允许使用的工料机类型:人工、普通材料、混凝土、砂浆、配合比、商品混凝土、商品砂浆、机械台班、机械组成物、机上人工、主材、设备
-let allowGljType = [1, 201, 202, 203, 204, 205, 206, 301, 302, 303, 4, 5];
+//允许使用的工料机类型:人工、普通材料、混凝土、砂浆、配合比、商品混凝土、商品砂浆、外购砼构件、绿化苗木
+// 机械台班、机械组成物、机上人工、设备
+let allowGljType = [1, 201, 202, 203, 204, 205, 206, 208, 209, 301, 302, 303,5];
 
-//允许含有组成物的工料机类型:混凝土、砂浆、配合比、机械台班、机械组成物
-let allowComponent = [202, 203, 204, 301, 302];
-//可以作为组成物的工料机类型:普通材料、机械组成物、机上人工、主材
-let componentType = [201, 302, 303, 4];
+//允许含有组成物的工料机类型:混凝土、砂浆、配合比、机械台班
+let allowComponent = [202, 203, 204, 301];
+//可以作为组成物的工料机类型:普通材料、机械组成物、机上人工
+let componentType = [201, 302, 303];
 //允许含有组成物的机械工料机类型:机械台班
 let machineAllowComponent = [301];
-//可以作为机械工料机组成物的工料机类型:机械组成物、机上人工
-let machineComponent = [302, 303];
+//可以作为机械工料机组成物的工料机类型:机械组成物、机上人工、普通材料
+let machineComponent = [201, 302, 303];
 //允许含有组成物的材料工料机类型:混凝土、砂浆、配合比
 let materialAllowComponent = [202, 203, 204];
 //可以作为材料工料机组成物的工料机类型:普通材料

+ 1 - 1
public/web/tree_sheet/tree_sheet_helper.js

@@ -470,7 +470,7 @@ var TREE_SHEET_HELPER = {
             let centerX = hitinfo.cellRect.x + offset + node.depth() * indent + node.depth() * levelIndent + indent / 2;
             let centerY = (hitinfo.cellRect.y + offset + (hitinfo.cellRect.y + offset + hitinfo.cellRect.height)) / 2;
             //方框外1像素内都有效
-            if (hitinfo.x >= centerX - halfBoxLength - 2 && hitinfo.x <= centerX + halfBoxLength + 2 &&
+            if (hitinfo.x >= centerX - halfBoxLength - 3 && hitinfo.x <= centerX + halfBoxLength + 2 &&
                 hitinfo.y >= centerY - halfBoxLength - 2 && hitinfo.y <= centerY + halfBoxLength + 2) {
                 node.setExpanded(!node.expanded);
                 let sheetName = hitinfo.sheet.name();

+ 1 - 2
web/building_saas/complementary_glj_lib/js/components.js

@@ -77,8 +77,7 @@ let componentOprObj = {
         let that = repositoryGljObj, me = componentOprObj;
             for(let i = 0; i < gljList.length; i++){
                 if(machineAllowComponent.includes(that.currentGlj.gljType) && machineComponent.includes(gljList[i].gljType) ||
-                    materialAllowComponent.includes(that.currentGlj.gljType) && gljList[i].gljType === 201||
-                    that.currentGlj.gljType === 302 && gljList[i].gljType === 201){//机械组成物,应可选择无组成物的普通材料
+                    materialAllowComponent.includes(that.currentGlj.gljType) && gljList[i].gljType === 201){
                     //去除与已添加的组成物重复的条目
                     let isExist = false;
                     for(let j = 0; j < that.currentComponent.length; j++){

+ 80 - 143
web/building_saas/complementary_glj_lib/js/glj.js

@@ -73,8 +73,7 @@ let repositoryGljObj = {
     gljList: [],
     stdGljList:[],
     complementaryGljList: [],
-    machineModel: {textArr: ['特', '大', '中', '小'], comboItems: [{text: '特', value: 1}, {text: '大', value: 2},{text: '中', value: 3}, {text: '小', value: 4}]},
-    machineModelIdx: {'1': '特', '2': '大', '3': '中', '4': '小'},
+    feeDataCode: ['grossWeightCoe', 'purchaseStorageRate', 'offSiteTransportLossRate', 'handlingLossRate'],
     distTypeTree: null,//add
     setting: {
         header:[
@@ -84,7 +83,10 @@ let repositoryGljObj = {
             {headerName:"单位",headerWidth:45,dataCode:"unit", dataType: "String", hAlign: "center", vAlign: "center"},
             {headerName:"定额价",headerWidth:80,dataCode:"basePrice", dataType: "Number", formatter: "0.00", hAlign: "right", vAlign: "center"},
             {headerName:"类型",headerWidth:90,dataCode:"gljType", dataType: "String", hAlign: "center", vAlign: "center"},
-            {headerName:"机型",headerWidth:60,dataCode:"model", dataType: "Number", hAlign: "center", vAlign: "center"},
+            {headerName:"毛重系数",headerWidth:90,dataCode:"grossWeightCoe", dataType: "Number", hAlign: "center", vAlign: "center"},
+            {headerName:"采购保管费率",headerWidth:90,dataCode:"purchaseStorageRate", dataType: "Number", hAlign: "center", vAlign: "center"},
+            {headerName:"场外运输损耗率",headerWidth:100,dataCode:"offSiteTransportLossRate", dataType: "Number", hAlign: "center", vAlign: "center"},
+            {headerName:"每增一次装卸损耗率",headerWidth:100,dataCode:"handlingLossRate", dataType: "Number", hAlign: "center", vAlign: "center"},
             {headerName:"是否新增",headerWidth:60,dataCode:"isComplementary", hAlign: "center", vAlign: "center"}
         ],
         view:{
@@ -111,10 +113,9 @@ let repositoryGljObj = {
         sheet.resumeEvent();
     },
     getComboData: function (gljDistType) {
-        let me = this;
         let distType;
         let distTypeTree = {
-            prefix: 'gljType',
+            prefix : 'gljType',
             distTypes: {},
             comboDatas: [],
             distTypesArr: []
@@ -124,20 +125,20 @@ let repositoryGljObj = {
                 data: typeData,
                 children: [],
                 parent: null
-            }
+            };
             distTypeTree.distTypes[distTypeTree.prefix + typeData.ID] = typeObj;
             distTypeTree.distTypesArr.push(typeObj);
         });
         gljDistType.forEach(function (typeData) {
             distType = distTypeTree.distTypes[distTypeTree.prefix + typeData.ID];
             let parent = distTypeTree.distTypes[distTypeTree.prefix + typeData.ParentID];
-            if (parent) {
+            if(parent){
                 distType.parent = parent;
                 parent.children.push(distType);
             }
         });
         distTypeTree.distTypesArr.forEach(function (distTypeObj) {
-            if (distTypeObj.data.fullName !== '材料' && distTypeObj.data.fullName !== '机械') {
+            if(allowGljType.includes(distTypeObj.data.ID)){
                 distTypeTree.comboDatas.push({text: distTypeObj.data.fullName, value: distTypeObj.data.ID});
             }
         });
@@ -170,7 +171,6 @@ let repositoryGljObj = {
         });
     },
     getGljItems: function(stdGljLibId, callback) {
-        console.log('enterGG');
         let me = this;
         CommonAjax.post('complementartGlj/api/getGljItems', {stdGljLibId: stdGljLibId}, function (rstData) {
             me.stdGljList = rstData.stdGljs;
@@ -217,11 +217,8 @@ let repositoryGljObj = {
                     sheet.setCellType(row, isComplementaryCol, baseCell);
                 }
             });
-            sheetOpr.showData(sheet, me.setting, cacheSection, me.distTypeTree, me.machineModelIdx);
+            sheetOpr.showData(sheet, me.setting, cacheSection, me.distTypeTree);
             sheetCommonObj.setDynamicCombo(sheet, 0, 5, sheet.getRowCount(), me.distTypeTree.comboDatas, false, 'text');
-            sheetCommonObj.setDynamicCombo(sheet, 0, 6, sheet.getRowCount(), me.machineModel.comboItems, false, 'text');
-
-
             cacheSection = null;
         }
     },
@@ -277,21 +274,6 @@ let repositoryGljObj = {
         return v !== undefined && v !== null;
     },
 
-    //成为了组成物,暂时只需要判断主材的
-    isComponent: function (gljId, gljList) {
-        for(let i = 0, len = gljList.length; i < len; i++){
-            let gljComponent = gljList[i].component;
-            if(gljList[i].gljType === 4 && this.isDef(gljComponent) && gljComponent.length > 0){
-                for(let j = 0, jLen = gljComponent.length; j < jLen; j++){
-                    if(gljComponent[j].ID === gljId){
-                        return true;
-                    }
-                }
-            }
-        }
-        return false;
-    },
-
     getCurrentComponent: function (gljComponent) {
         let me = repositoryGljObj, rst = [];
         for(let i = 0; i < gljComponent.length; i++){
@@ -405,11 +387,9 @@ let repositoryGljObj = {
                     }
                 }
             }
-        }
-        else{
+        } else{
             me.currentGlj = null;
         }
-
         //组成物表能编辑则显示,否则隐藏该工作表
         let rightWidth = getLocalCache('compleGLjrightContentWidth') || '25%';
         rightWidth = rightWidth.replace('%', '');
@@ -503,7 +483,7 @@ let repositoryGljObj = {
     },
     onButtonClicked: function (sender, args) {
         let me = repositoryGljObj;
-        if(args.col === 6 && args.row < me.currentCache.length){
+        if(me.setting.header[args.col].dataCode === 'isComplementary' && args.row < me.currentCache.length){
             args.sheet.setValue(args.row, args.col, true);
         }
     },
@@ -512,18 +492,19 @@ let repositoryGljObj = {
         let rObj = sheetOpr.combineRowData(me.workBook.getSheet(0), me.setting, args.row);
         me.currentEditingGlj = rObj;
         me.orgCode = me.workBook.getSheet(0).getValue(args.row, 0);
+        let dataCode = me.setting.header[args.col].dataCode;
         if(args.row < me.currentCache.length){
             me.currentGlj = me.currentCache[args.row];
-            if(args.col === 0 || (args.col === 4 && allowComponent.includes(me.currentGlj.gljType) && me.currentGlj.component.length > 0)
-                || (args.col === 6 && me.currentGlj.gljType !== 301) || args.col === 7){
+            //费率数据列只有普通材料能用,可添加组成物的人材机,基价只读
+            if (dataCode === 'code'|| (me.feeDataCode.includes(dataCode) && me.currentGlj.gljType !== 201) ||
+                (dataCode === 'basePrice' && allowComponent.includes(me.currentGlj.gljType)) ||
+                dataCode === 'isComplementary'){
                 args.cancel = true;
-            }
-            else {
+            } else {
                 rObj.ID = me.currentGlj.ID;
                 rObj.gljClass = me.currentGlj.gljClass;
             }
-        }
-        else {
+        } else {
             me.currentGlj = null;
         }
     },
@@ -531,29 +512,29 @@ let repositoryGljObj = {
         let me = repositoryGljObj, that = gljComponentOprObj,
             rObj = sheetOpr.combineRowData(me.workBook.getSheet(0), me.setting, args.row, me),
             updateArr = [], addArr = [], updateBasePrcArr = [];
+        let dataCode = me.setting.header[args.col].dataCode;
         me.editingRowIdx = args.row;
         rObj.basePrice = rObj.basePrice ? rObj.basePrice : 0;
         //更新
         if (me.currentEditingGlj["ID"]) {
             rObj["ID"] = me.currentEditingGlj["ID"];
             rObj.gljClass = me.currentEditingGlj.gljClass;
-            //for(let col =0; col< me.setting.header.length; col++){
-                if(me.currentEditingGlj[me.setting.header[args.col].dataCode] !== rObj[me.setting.header[args.col].dataCode]){
-                    //me.addGljObj = rObj;
+                if(me.currentEditingGlj[dataCode] !== rObj[dataCode]){
                     //编码、名称、单位、类型不可为空
-                    if(rObj[me.setting.header[0].dataCode] && rObj[me.setting.header[1].dataCode] && rObj[me.setting.header[3].dataCode] && rObj[me.setting.header[5].dataCode]
-                    &&rObj[me.setting.header[0].dataCode].toString().trim().length !== 0 && rObj[me.setting.header[1].dataCode].toString().trim().length !== 0 && rObj[me.setting.header[3].dataCode].toString().trim().length !== 0&&
-                        rObj[me.setting.header[5].dataCode].toString().trim().length !== 0){
+                    if(rObj.code && rObj.name && rObj.unit && rObj.gljType
+                    &&rObj.code.toString().trim().length !== 0 && rObj.name.toString().trim().length !== 0 && rObj.unit.toString().trim().length !== 0&&
+                        rObj.gljType.toString().trim().length !== 0){
                         if(rObj.gljType !== me.currentEditingGlj.gljType){//修改了工料机类型
-                                if(me.currentGlj){
-                                    me.currentGlj.component = [];
+                            if(me.currentGlj){
+                                me.currentGlj.component = [];
+                            }
+                            //工料机类型不为普通材料时,情况费率数据
+                            if (me.currentEditingGlj.gljType === 201 && rObj.gljType !== 201) {
+                                for (let feeCode of me.feeDataCode) {
+                                    if (me.currentEditingGlj[feeCode]) {
+                                        rObj[feeCode] = null;
+                                    }
                                 }
-                               /* if(me.allowComponent.indexOf(rObj.gljType) !== -1){
-                                    rObj.basePrice = 0;
-                                }*/
-                            //工料机类型不为机械台班时,清空机型
-                            if(me.currentEditingGlj.gljType === 301 && rObj.gljType !== 301 && me.currentEditingGlj.model){
-                                rObj.model = null;
                             }
                             if(componentType.includes(me.currentEditingGlj.gljType) &&
                                 !(machineComponent.includes(me.currentEditingGlj.gljType) && machineComponent.includes(rObj.gljType))
@@ -570,8 +551,13 @@ let repositoryGljObj = {
                                 }
                             }
                             sheetOpr.cleanData(that.workBook.getSheet(0), that.setting, 5);
-                        }
-                        else if(rObj.basePrice !== me.currentEditingGlj.basePrice){//修改了单价,可修改单价的必为可成为组成物的
+                        } else if (me.feeDataCode.includes(dataCode) && rObj[dataCode] !== me.currentEditingGlj[dataCode]) {
+                            if(isNaN(rObj[dataCode])){
+                                args.sheet.setValue(args.row, args.col, me.currentEditingGlj[dataCode] ? me.currentEditingGlj[dataCode] : '');
+                                alert(`${me.setting.header[args.col].headerName}只能输入数值!`);
+                                return;
+                            }
+                        } else if(rObj.basePrice !== me.currentEditingGlj.basePrice){//修改了单价,可修改单价的必为可成为组成物的
                             //寻找所有引用了此组成物的工料机,并从组成物中删去此工料机,并重算单价
                             if(isNaN(parseFloat(rObj.basePrice))){
                                 alert('单价只能为数值!');
@@ -588,22 +574,20 @@ let repositoryGljObj = {
                                     updateArr.push(updateGljs.updateBasePrcArr[i]);
                                 }
                             }
-                            //rObj.basePrice = !isNaN(parseFloat(rObj.basePrice)) && (rObj.basePrice && typeof rObj.basePrice !== 'undefined') ? that.round(parseFloat(rObj.basePrice), 2) : 0;
                         }
                         rObj.component = me.currentGlj.component;
                         updateArr.push(rObj);
                     }
                     else{
-                        if(me.setting.header[args.col].dataCode === 'gljType'){
-                            let distTypeVal =  me.distTypeTree.distTypes[me.distTypeTree.prefix + me.currentEditingGlj[me.setting.header[args.col].dataCode]].data.fullName;
+                        if(dataCode === 'gljType'){
+                            let distTypeVal =  me.distTypeTree.distTypes[me.distTypeTree.prefix + me.currentEditingGlj[dataCode]].data.fullName;
                             args.sheet.setValue(args.row, args.col, distTypeVal);
                         }
                         else{
-                            args.sheet.setValue(args.row, args.col, me.currentEditingGlj[me.setting.header[args.col].dataCode]);
+                            args.sheet.setValue(args.row, args.col, me.currentEditingGlj[dataCode]);
                         }
                     }
                 }
-          //  }
             //--------------------------------------
             if(me.currentEditingGlj.basePrice !== rObj.basePrice){
                 //update basePrice of ration when editting basePrice of glj
@@ -634,16 +618,12 @@ let repositoryGljObj = {
             if(typeof rObj.code !== 'undefined'){
                 me.addGljObj = rObj;
                 let isCanSav = true;
-                if(!rObj[me.setting.header[0].dataCode] || !rObj[me.setting.header[1].dataCode] || !rObj[me.setting.header[3].dataCode] || !rObj[me.setting.header[5].dataCode]){
+                if(!rObj.code || !rObj.name || !rObj.unit || !rObj.gljType){
                     isCanSav = false;
                 }
                 if(isCanSav){
                     me.addGljObj = null;
                     rObj.component = [];
-                    //如果类型为混凝土、砂浆、配合比、机械台班时,添加时填写的单价清空
-                   /* if(me.allowComponent.indexOf(rObj.gljType) !== -1){
-                        rObj.basePrice = 0;
-                    }*/
                     rObj.basePrice = !isNaN(parseFloat(rObj.basePrice)) && (rObj.basePrice && typeof rObj.basePrice !== 'undefined') ? parseFloat(rObj.basePrice) : 0;
                     addArr.push(rObj);
                 }
@@ -659,10 +639,7 @@ let repositoryGljObj = {
     },
     delGljs: function (sels) {
         let me = repositoryGljObj;
-        let sheet = me.workBook.getSheet(0),
-            updateArr = [], removeArr = [],
-            tempRemoveArr= [],
-            refGljCodes = [], //已被引用的工料机
+        let updateArr = [], removeArr = [],
             updateBasePrcArr = [],//删除基价单位后重新计算
             canUpdate = false,
             cacheSection = me.currentCache;
@@ -682,7 +659,6 @@ let repositoryGljObj = {
                                 }
                             }
                             removeArr.push(cacheSection[sels[i].row + j].ID);
-                            //tempRemoveArr.push({ID: cacheSection[sels[i].row + j].ID, code: cacheSection[sels[i].row + j].code});
                             //删除后重新计算引用了此工料机的定额单价
                             updateBasePrcArr.push({gljId: cacheSection[sels[i].row + j].ID, gljType: cacheSection[sels[i].row + j].gljType, basePrice: 0, delete: 1});
                         }
@@ -807,7 +783,6 @@ let repositoryGljObj = {
     validUpdateObj: function (pasteObj, rowIdx) {
         let rst = {updateGlj: [], updateBasePrcArr: []}, backUpObj = {},
             me = repositoryGljObj,
-            that = gljComponentOprObj,
             tempObj = me.currentCache[rowIdx],
             reCalBasePrc = false,
             isValid = true;
@@ -856,8 +831,10 @@ let repositoryGljObj = {
                     pasteObj.gljType = me.distTypeTree.comboDatas[i].value;
                     isExsit = true;
                     reCalBasePrc = true;
-                    if(pasteObj.gljType !== 301 && tempObj.gljType === 301){
-                        tempObj.model = null;
+                    if (pasteObj.gljType !== 201 && tempObj.gljType === 201) {
+                        for (let feeCode of me.feeDataCode) {
+                            tempObj[feeCode] = null;
+                        }
                     }
                     if(componentType.includes(tempObj.gljType)&&
                         !(machineComponent.includes(tempObj.gljType) && machineComponent.includes(pasteObj.gljType)) &&
@@ -874,9 +851,6 @@ let repositoryGljObj = {
                         }
                     }
                     tempObj.component = tempObj.gljType === me.distTypeTree.comboDatas[i].value ? tempObj.component : [];
-                    /*if(me.allowComponent.indexOf(tempObj.gljType) !== -1){
-                        tempObj.basePrice = tempObj.gljType === me.distTypeTree.comboDatas[i].value ? tempObj.basePrice : 0;
-                    }*/
                     tempObj.gljType = me.distTypeTree.comboDatas[i].value;
                     tempObj.shortName = me.distTypeTree.distTypes[me.distTypeTree.prefix + tempObj.gljType].data.shortName;
                     break;
@@ -884,6 +858,16 @@ let repositoryGljObj = {
             }
             if(!isExsit) isValid = false;
         }
+        for (let feeCode of me.feeDataCode) {
+            if (typeof pasteObj[feeCode] !== 'undefined' && !isNaN(pasteObj[feeCode])) {
+                if ((typeof pasteObj.gljType !== 'undefined' && pasteObj.gljType === 201) ||
+                    (tempObj.gljType && tempObj.gljType === 201)) {
+                    tempObj[feeCode] = pasteObj[feeCode];
+                } else {
+                    isValid = false;
+                }
+            }
+        }
         //
         pasteObj.basePrice = !isNaN(parseFloat(pasteObj.basePrice)) && (pasteObj.basePrice && typeof pasteObj.basePrice !== 'undefined') ? scMathUtil.roundTo(parseFloat(pasteObj.basePrice), 2) :
             me.currentCache[rowIdx].basePrice;
@@ -900,34 +884,10 @@ let repositoryGljObj = {
                 }
             }
         }
-        if(typeof pasteObj.model !== 'undefined'){
-            if(!me.machineModel.textArr.includes(pasteObj.model)){
-                isValid = false;
-            }
-            else {
-                let existsModel = false;
-                if((typeof pasteObj.gljType !== 'undefined' && pasteObj.gljType === 301) ||
-                    (tempObj.gljType && tempObj.gljType === 301)){
-                    me.machineModel.comboItems.forEach(function (item) {
-                        if(item.text === pasteObj.model){
-                            tempObj.model = item.value;
-                            existsModel = true;
-                        }
-                    });
-                    if(!existsModel){
-                        isValid = false;
-                    }
-                }
-                else {
-                    isValid = false;
-                }
-            }
-        }
         if(isValid){
             rst.updateGlj.push(tempObj);
             if(reCalBasePrc){
                 //重新计算定额基价对象
-                //rst.updateBasePrc = {gljId: tempObj.ID, gljType: tempObj.gljType, basePrice: tempObj.basePrice};
                 let newReObj = {gljId: tempObj.ID, gljType: tempObj.gljType, basePrice: tempObj.basePrice};
                 rst.updateBasePrcArr.push(newReObj);
             }
@@ -973,15 +933,10 @@ let repositoryGljObj = {
             }
 
         }
-        if(typeof pasteObj.model !== 'undefined' && pasteObj.model){
-            if(!me.machineModel.textArr.includes(pasteObj.model) || pasteObj.gljType !== 301){
+        for (let feeCode of me.feeDataCode) {
+            if (typeof pasteObj[feeCode] !== 'undefined' && (isNaN(pasteObj[feeCode]) || pasteObj.gljType !== 201)) {
                 return false;
             }
-            me.machineModel.comboItems.forEach(function (item) {
-                if(item.text === pasteObj.model){
-                    pasteObj.model = item.value;
-                }
-            });
         }
         pasteObj.basePrice = !isNaN(parseFloat(pasteObj.basePrice)) && (pasteObj.basePrice && typeof pasteObj.basePrice !== 'undefined') ? parseFloat(pasteObj.basePrice) : 0;
         if(!me.parentNodeIds["_pNodeId_" + me.gljCurTypeId]){
@@ -1002,6 +957,7 @@ let repositoryGljObj = {
             if(info.cellRange.col === 0){
                 return false;
             }
+            //可添加组成物的人材机基价由组成物基价计算得来,基价列只读
             else if(info.cellRange.col <= 4 && info.cellRange.col + info.cellRange.colCount - 1 >= 4){
                 for(let i = 0, len = info.cellRange.rowCount; i < len; i++){
                     let row = i + info.cellRange.row;
@@ -1020,13 +976,11 @@ let repositoryGljObj = {
     },
     onClipboardPasting: function(sender, args) {
         let me = repositoryGljObj;
-        let maxCol = args.cellRange.col + args.cellRange.colCount - 1;
         if (!me.canPasted(args)) {
             args.cancel = true;
         }
     },
     onClipboardPasted: function(e, info) {
-        //  if(info.pasteData.text.trim().length > 0){
         let me = repositoryGljObj;
         let updateArr = [], addArr = [];
         let items = sheetOpr.analyzePasteData(me.setting, info);
@@ -1034,20 +988,17 @@ let repositoryGljObj = {
             maxRow = me.currentCache.length - 1,//当前数据最大行数
             updateBasePrcArr = [] ,
             updateCount, resumeArr = [];
-        if(endRow <= maxRow){
-            //updateItems = items;
+        if(endRow <= maxRow){//只有更新
             for(let i = 0; i < items.length; i++){
                 let updateObj = me.validUpdateObj(items[i], info.cellRange.row + i);
                 if(updateObj && typeof updateObj.updateGlj !== 'undefined' && updateObj.updateGlj.length > 0){
-                    //updateArr = updateObj.updateGlj;
                     updateArr = updateArr.concat(updateObj.updateGlj);
                     if(typeof updateObj.updateBasePrcArr !== 'undefined'){
                         updateBasePrcArr = updateBasePrcArr.concat(updateObj.updateBasePrcArr);
                     }
                 }
             }
-        }
-        else if(beginRow <= maxRow && endRow > maxRow){
+        } else if(beginRow <= maxRow && endRow > maxRow){//更新+新增
             updateCount = maxRow - beginRow + 1;
             for(let i = 0; i < updateCount; i++){
                 let updateObj = me.validUpdateObj(items[i], info.cellRange.row + i);
@@ -1059,29 +1010,17 @@ let repositoryGljObj = {
                     }
                 }
             }
-            if(info.cellRange.colCount === me.setting.header.length -1){
-                for(let i = updateCount ; i < items.length; i++){
-                    if(me.isValidObj(items[i])){
-                        items[i].component = [];
-                        //类型为混凝土、砂浆、配合比、机械时,基价只能组成物计算
-                        /* if(me.allowComponent.indexOf(items[i].gljType) !== -1){
-                         items[i].basePrice = 0;
-                         }*/
-                        addArr.push(items[i]);
-                    }
+            for(let i = updateCount ; i < items.length; i++){
+                if(me.isValidObj(items[i])){
+                    items[i].component = [];
+                    addArr.push(items[i]);
                 }
             }
-        }
-        else{
-            if(info.cellRange.colCount === me.setting.header.length -1){
-                for(let i = 0; i < items.length; i++){
-                    if(me.isValidObj(items[i])){
-                        items[i].component = [];
-                        /*if(me.allowComponent.indexOf(items[i].gljType) !== -1){
-                         items[i].basePrice = 0;
-                         }*/
-                        addArr.push(items[i]);
-                    }
+        } else{//新增
+            for(let i = 0; i < items.length; i++){
+                if(me.isValidObj(items[i])){
+                    items[i].component = [];
+                    addArr.push(items[i]);
                 }
             }
         }
@@ -1095,15 +1034,13 @@ let repositoryGljObj = {
             for(let i = 0; i < resumeArr.length ; i++){
                 if(resumeArr[i] < me.currentCache.length){
                     for(let col = 0; col < me.setting.header.length -1; col++){
-                        if(me.setting.header[col].dataCode === 'gljType'){
-                            let gljType = me.currentCache[resumeArr[i]][me.setting.header[col].dataCode];
+                        let dCode = me.setting.header[col].dataCode;
+                        if(dCode === 'gljType'){
+                            let gljType = me.currentCache[resumeArr[i]][dCode];
                             sheet.setValue(resumeArr[i], col, me.distTypeTree.distTypes["gljType" + gljType].data.fullName);
                         }
-                        else if(me.setting.header[col].dataCode === 'model'){
-                            sheet.setValue(resumeArr[i], col, me.currentCache[resumeArr[i]][me.setting.header[col].dataCode] ? me.machineModelIdx[me.currentCache[resumeArr[i]][me.setting.header[col].dataCode]]: '');
-                        }
                         else{
-                            sheet.setValue(resumeArr[i], col, me.currentCache[resumeArr[i]][me.setting.header[col].dataCode]);
+                            sheet.setValue(resumeArr[i], col, me.currentCache[resumeArr[i]][dCode]);
                         }
                     }
                 }
@@ -1121,7 +1058,6 @@ let repositoryGljObj = {
         if(updateBasePrcArr.length > 0 && me.rationLibs.length > 0){
             me.updateRationBasePrcRq(updateBasePrcArr);
         }
-        // }
     },
     updateRationBasePrcRq: function (basePrcArr) {
         CommonAjax.post('/complementartGlj/api/updateRationBasePrc', {basePrcArr: basePrcArr}, function (rstData) {
@@ -1163,10 +1099,11 @@ let repositoryGljObj = {
             me.showGljItems(me.complementaryGljList, me.gljCurTypeId);
             //getCurrentGlj
             let row = me.workBook.getSheet(0).getSelections()[0].row;
-            me.currentGlj = row < me.currentCache.length ? me.currentCache[row] : null;
+           /* me.currentGlj = row < me.currentCache.length ? me.currentCache[row] : null;
             me.currentComponent = me.currentGlj ?  me.getCurrentComponent(me.currentGlj.component) : [];
             sheetOpr.cleanData(gljComponentOprObj.workBook.getSheet(0), gljComponentOprObj.setting, -1);
-            sheetOpr.showData(gljComponentOprObj.workBook.getSheet(0), gljComponentOprObj.setting, me.currentComponent);
+            sheetOpr.showData(gljComponentOprObj.workBook.getSheet(0), gljComponentOprObj.setting, me.currentComponent);*/
+            me.initSel(row);
         }
         let errCaller = function (err) {
             alert('保存失败');

+ 2 - 3
web/building_saas/complementary_glj_lib/js/gljComponent.js

@@ -220,7 +220,6 @@ let gljComponentOprObj = {
         if(thatRow < that.currentCache.length){
             that.currentGlj = that.currentCache[thatRow];
             if(me.setting.view.lockedCols.indexOf(args.col) !== -1 || !allowComponent.includes(that.currentGlj.gljType) ||
-                (that.currentGlj.gljType === 4 && that.isComponent(that.currentGlj.ID, that.stdGljList.concat(that.complementaryGljList))) ||
                 (args.col === 4 && (!that.currentComponent|| args.row >= that.currentComponent.length))){
                 args.cancel = true;
             }
@@ -359,8 +358,8 @@ let gljComponentOprObj = {
         let me = gljComponentOprObj, that = repositoryGljObj;
         let maxCol = info.cellRange.col + info.cellRange.colCount - 1;
         //复制的列数超过正确的列数,不可复制
-        if(info.cellRange.col !== 4 && info.cellRange.colCount > 1 || (that.currentGlj.gljType === 4 && that.isComponent(that.currentGlj.ID, that.stdGljList.concat(that.complementaryGljList)))){
-            args.cancel = true;
+        if(info.cellRange.col !== 4 && info.cellRange.colCount > 1){
+            info.cancel = true;
         }
     },
     onClipboardPasted: function (sender, info) {

+ 1 - 12
web/building_saas/complementary_glj_lib/js/sheetOpr.js

@@ -113,7 +113,7 @@ let sheetOpr = {
             area.vAlign(GC.Spread.Sheets.VerticalAlign.center);
         }
     },
-    showData: function(sheet, setting, data, distTypeTree, machineModelIdx) {
+    showData: function(sheet, setting, data, distTypeTree) {
         var me = this, ch = GC.Spread.Sheets.SheetArea.viewport;
         sheet.suspendPaint();
         sheet.suspendEvent();
@@ -141,9 +141,6 @@ let sheetOpr = {
                     let distTypeVal =  distTypeTree.distTypes[distTypeTree.prefix + data[row].gljType].data.fullName;
                     sheet.setValue(row, col, distTypeVal, ch);
                 }
-                else if(setting.header[col].dataCode === 'model' && data[row].model){
-                    sheet.setValue(row, col, machineModelIdx ? machineModelIdx[data[row].model] : '');
-                }
                 else {
                     sheet.setValue(row, col, data[row][setting.header[col].dataCode], ch);
                     sheet.setTag(row, 0, data[row].ID, ch);
@@ -200,7 +197,6 @@ let sheetOpr = {
         var rst = {};
         let comboBoxCellType = sheet.getCellType(row, 5);
         let items = comboBoxCellType.items();
-        let machineItems = sheet.getCellType(row, 6).items();
         for (var col = 0; col < setting.header.length; col++) {
             if(setting.header[col].dataCode === 'gljType'){
                 items.forEach(function(item){
@@ -212,13 +208,6 @@ let sheetOpr = {
                     }
                 });
             }
-            else if(setting.header[col].dataCode === 'model'){
-                machineItems.forEach(function(item){
-                    if(sheet.getValue(row, col) === item.text){
-                        rst[setting.header[col].dataCode] = item.value;
-                    }
-                });
-            }
             else if (setting.header[col].dataCode === 'code'){
                 if(repositoryGljObj){
                     let stdGljList = repositoryGljObj.stdGljList,

+ 3 - 6
web/building_saas/complementary_ration_lib/js/ration.js

@@ -71,9 +71,9 @@ let rationOprObj = {
             {headerName:"编码",headerWidth:70,dataCode:"code", dataType: "String", formatter: "@"},
             {headerName:"名称",headerWidth:240,dataCode:"name", dataType: "String"},
             {headerName:"计量单位",headerWidth:70,dataCode:"unit", dataType: "String", hAlign: "center"},
-            {headerName:"人工费",headerWidth:80,dataCode:"labourPrice", dataType: "Number", formatter: "0.00", hAlign: "right"},
+            /*{headerName:"人工费",headerWidth:80,dataCode:"labourPrice", dataType: "Number", formatter: "0.00", hAlign: "right"},
             {headerName:"材料费",headerWidth:80,dataCode:"materialPrice", dataType: "Number", formatter: "0.00",  hAlign: "right"},
-            {headerName:"机械费",headerWidth:80,dataCode:"machinePrice", dataType: "Number", formatter: "0.00", hAlign: "right"},
+            {headerName:"机械费",headerWidth:80,dataCode:"machinePrice", dataType: "Number", formatter: "0.00", hAlign: "right"},*/
             {headerName:"基价",headerWidth:80,dataCode:"basePrice", dataType: "Number", formatter: "0.00", hAlign: "right"},
             {headerName:"显示名称(以%s表示参数)",headerWidth:240,dataCode:"caption", dataType: "String"},
             {headerName:"取费专业",headerWidth:70,dataCode:"feeType", dataType: "Number", hAlign: "center"}
@@ -82,11 +82,8 @@ let rationOprObj = {
             comboBox:[
                 {row:-1,col:2,rowCount:-1,colCount:1}
             ],
-            lockedCells:[
-                {row:-1,col:3,rowCount:-1, colCount:1}
-            ],
             lockColumns: [
-                3, 4, 5, 6
+                3
             ]
         }
     },

+ 5 - 41
web/building_saas/complementary_ration_lib/js/ration_glj.js

@@ -511,50 +511,17 @@ var rationGLJOprObj = {
     },
     rationCal: function () {
         let me = rationGLJOprObj;
-        let price = {gljType1: [], gljType2: [], gljType3: []}, rst = {labourPrice: 0, materialPrice: 0, machinePrice: 0}, rationBasePrc = 0;
+        let rationBasePrc = 0;
         if(me.currentRationItem && me.cache['_GLJ_' + me.currentRationItem.ID]){
             let cacheArr = me.cache['_GLJ_' + me.currentRationItem.ID];
             cacheArr.forEach(function (gljData) {
                 if(gljData.gljType && gljData.basePrice && gljData.consumeAmt){
-                    let parent = me.distTypeTree.distTypes[me.distTypeTree.prefix + gljData.gljType].parent;
-                    if(parent && parent.data.ID <= 3){
-                        price['gljType' + parent.data.ID].push(scMathUtil.roundTo( gljData.basePrice * gljData.consumeAmt, -3));//取三位
-                    }
-                    if(!parent && gljData.gljType <= 3){
-                        price['gljType' + gljData.gljType].push(scMathUtil.roundTo( gljData.basePrice * gljData.consumeAmt, -3));//取三位
-                    }
+                    rationBasePrc += gljData.basePrice * gljData.consumeAmt;
                 }
             });
-            if(price.gljType1.length > 0){
-                let labourPrice = 0;
-                price.gljType1.forEach(function (singlePrc) {
-                    labourPrice = scMathUtil.roundTo(labourPrice + singlePrc, me.processDecimal);
-                });
-                let roundPrice = scMathUtil.roundTo(labourPrice, -2);
-                rst.labourPrice = roundPrice;
-                rationBasePrc = scMathUtil.roundTo(rationBasePrc + roundPrice, -2);
-            }
-            if(price.gljType2.length > 0){
-                let materialPrice = 0;
-                price.gljType2.forEach(function (singlePrc) {
-                    materialPrice = scMathUtil.roundTo(materialPrice + singlePrc, me.processDecimal);
-                });
-                let roundPrice = scMathUtil.roundTo(materialPrice, -2);
-                rst.materialPrice = roundPrice;
-                rationBasePrc = scMathUtil.roundTo(rationBasePrc + roundPrice, -2);
-            }
-            if(price.gljType3.length > 0){
-                let machinePrice = 0;
-                price.gljType3.forEach(function (singlePrc) {
-                    machinePrice = scMathUtil.roundTo(machinePrice + singlePrc, me.processDecimal);
-                });
-                let roundPrice = scMathUtil.roundTo(machinePrice, -2);
-                rst.machinePrice = roundPrice;
-                rationBasePrc = scMathUtil.roundTo(rationBasePrc + roundPrice, -2);
-            }
-            rst.rationBasePrc = rationBasePrc;
+            rationBasePrc = scMathUtil.roundTo(rationBasePrc, 0);
         }
-        return rst;
+        return rationBasePrc;
     },
     updateRationItem: function(callback) {
         var me = this, updateArr = [];
@@ -562,10 +529,7 @@ var rationGLJOprObj = {
             me.currentRationItem.rationGljList = me.buildRationItemGlj();
             //recalculate ration basePrice
             let price = me.rationCal();
-            me.currentRationItem.labourPrice = price.labourPrice;
-            me.currentRationItem.materialPrice = price.materialPrice;
-            me.currentRationItem.machinePrice = price.machinePrice;
-            me.currentRationItem.basePrice = price.rationBasePrc;
+            me.currentRationItem.basePrice = price;
             updateArr.push(me.currentRationItem);
             rationOprObj.mixUpdateRequest(updateArr, [], [], function () {
                 if(callback) callback();

+ 0 - 1
web/building_saas/js/global.js

@@ -32,7 +32,6 @@ function autoFlashHeight(){
     $(".form-view").height($(window).height()-headerHeight-ftoolsbarHeight);
     $(".form-list").height($(window).height()-headerHeight);
     $('#comments').find('textarea').height($('#comments').height() - 25);
-    typeof(adaptiveTzjnrWidth)== 'function' ?adaptiveTzjnrWidth():''
     $('#project-glj-main').width($(window).width()-($('.main-nav').width()+ 2)-($('.filterType').width()+12)-5); //2、12是padding宽度,width 是不算padding宽度的
     //typeof zmhs_obj === 'object' ? zmhs_obj.loadSideResize() : '';
 };

+ 0 - 1
web/building_saas/main/html/calc_program_manage.html

@@ -10,7 +10,6 @@
 
 <body>
     <div style="">
-        <img id="f_btn" src="/web/dest/css/img/feeRate_btn.jpg" alt="" style="display: none" />
     </div>
     <div class="toolsbar px-1" />
     <div class="container-fluid">

+ 30 - 151
web/building_saas/main/html/main.html

@@ -88,13 +88,13 @@
                       <span id="openProjSet" class="btn btn-light btn-sm" data-toggle="tooltip" data-original-title="项目属性" data-placement="bottom">
                         <a href="javascript:void(0);"><i class="fa fa-cog"></i></a>
                     </span>
-                    <span class="btn btn-light btn-sm" id="importSpan" data-toggle="tooltip" data-original-title="导入" data-placement="bottom">
+                    <!--<span class="btn btn-light btn-sm" id="importSpan" data-toggle="tooltip" data-original-title="导入" data-placement="bottom">
                         <a id="importDropDown" class="dropdown-toggle" href="#"><i class="fa fa-cloud-upload"></i></a>
                         <div class="dropdown-menu">
                             <a id="uploadLj" class="dropdown-item" href="#import" data-toggle="modal" data-target="#import">导入报表Excel清单</a>
                             <a id="uploadGld" class="dropdown-item" href="#import" data-toggle="modal" data-target="#import">导入广联达算量Excel清单</a>
                         </div>
-                    </span>
+                    </span>-->
                     <a href="javascript:void(0)" class="btn btn-light btn-sm" id="insertRation" data-toggle="tooltip" data-placement="bottom" data-original-title="插入定额"><i class="fa fa-sign-in" aria-hidden="true"></i></a>
                     <!--2018-11-15 隐藏删除按钮   <a href="javascript:void(0)" class="btn btn-light btn-sm" id="delete" data-toggle="tooltip" data-placement="bottom" data-original-title="删除"><i class="fa fa-remove" aria-hidden="true"></i></a>-->
                     <a href="javascript:void(0)" class="btn btn-light btn-sm" id="upLevel" data-toggle="tooltip" data-placement="bottom" data-original-title="升级"><i class="fa fa-arrow-left" aria-hidden="true"></i></a>
@@ -106,22 +106,20 @@
                           <div class="dropdown-menu dropright" id="moreMenu">
                               <a id="displayA" href="javascript:void(0);" data-toggle="dropdown" class="dropdown-item dropdown-toggle"><i class="fa fa-list-ol"></i> 显示至...</a>
                               <div id="subDisplay" class="dropdown-menu dropdown-menu-left" style="min-width: 6.5rem; position: absolute; transform: translate3d(158px, 3px, 0px); top: 0px; left: 0px; will-change: transform;" x-placement="right-start">
-                                  <a class="dropdown-item btn-sm" href="javascript:void(0);" id="displayDXFY">大项费用</a>
-                                  <a class="dropdown-item btn-sm" href="javascript:void(0);"  id="displayFB1">一级分部</a>
-                                  <a class="dropdown-item btn-sm" href="javascript:void(0);" id="displayFB2">二级分部</a>
-                                  <a class="dropdown-item btn-sm" href="javascript:void(0);" id="displayFB3">三级分部</a>
-                                  <a class="dropdown-item btn-sm" href="javascript:void(0);"  id="displayFB4">四级分部</a>
-                                  <a class="dropdown-item btn-sm" href="javascript:void(0);"  id="displayFX">分项(清单)</a>
-                                  <a class="dropdown-item btn-sm" href="javascript:void(0);" id="displayZM">子目</a>
-                                  <a class="dropdown-item btn-sm" href="javascript:void(0);"  id="displayZD">最底层</a>
+                                  <a class="dropdown-item btn-sm" href="javascript:void(0);" id="displayX">项</a>
+                                  <a class="dropdown-item btn-sm" href="javascript:void(0);"  id="displayM">目</a>
+                                  <a class="dropdown-item btn-sm" href="javascript:void(0);" id="displayJ">节</a>
+                                  <a class="dropdown-item btn-sm" href="javascript:void(0);" id="displayXM">细目</a>
+                                  <a class="dropdown-item btn-sm" href="javascript:void(0);"  id="displayZDCXM">最底层细目</a>
+                                  <a class="dropdown-item btn-sm" href="javascript:void(0);"  id="displayDE">定额</a>
                               </div>
-                              <a href="javascript:void(0);" id="ZLFB_btn" class="dropdown-item" data-placement="bottom"><i class="fa fa-retweet" aria-hidden="true"></i> 整理分部</a>
+                              <!--<a href="javascript:void(0);" id="ZLFB_btn" class="dropdown-item" data-placement="bottom"><i class="fa fa-retweet" aria-hidden="true"></i> 整理分部</a>
                               <% if (projectData.property.lockBills == true) { %>
                               <a href="javascript:void(0)"  class="dropdown-item" name="lockBills"> <i class="fa fa-unlock-alt" aria-hidden="true"></i> 解锁清单</a>
                               <% } else { %>
                               <a href="javascript:void(0)"  class="dropdown-item" name="lockBills"> <i class="fa fa-lock" aria-hidden="true"></i> 锁定清单</a>
                               <% } %>
-                              <a id="switchTznr" href="javascript:void(0);"  class="dropdown-item"><i class="fa fa-eye" aria-hidden="true"></i> 显示特征</a>
+                              <a id="switchTznr" href="javascript:void(0);"  class="dropdown-item"><i class="fa fa-eye" aria-hidden="true"></i> 显示特征</a>-->
                               <a id = "menu_calc_program_manage"  href="javascript:void(0);" class="dropdown-item"><i class="fa fa-calculator" aria-hidden="true"></i> 总计算程序</a>
                           </div>
                       </div>
@@ -216,12 +214,9 @@
                                  <!-- <li class="nav-item">   2018-11-08  新需求,隐藏说明信息
                                       <a class="nav-link" data-toggle="tab" href="#comments" role="tab" id="linkComments">说明信息</a>
                                   </li>-->
-                                  <li class="nav-item" id = "TZJNR_div">
-                                      <a class="nav-link sub-item" id="linkTZJNR" data-toggle="tab" href="#subSpread" role="tab">特征及内容</a>
-                                  </li>
-                                  <li class="nav-item" id="MBZM_div">
+                                  <!--<li class="nav-item" id="MBZM_div">
                                       <a class="nav-link sub-item" id="linkMBZM" data-toggle="tab" href="#subSpread" role="tab">模板子目</a>
-                                  </li>
+                                  </li>-->
                               </ul>
                               <!-- Tab panes -->
                               <div class="tab-content" id="tabCon">
@@ -316,141 +311,16 @@
                                       <div class="main-data-bottom ovf-hidden" style="display: none" id="comments">
                                           <textarea style="font-size: 0.9rem" class="form-control" rows="8" readonly=""></textarea>
                                       </div>
-                                      <div id="tzjnrCon" class="container-fluid main-data-bottom" style="background: #F1F1F1; overflow: hidden">
-                                          <div class="row" style="overflow: hidden">
-                                              <div class="p-0" id="contentDiv" style="width: 90%; float: left">
-                                                  <div id="jobDiv" style="width: 33%; height: 100%;float: left">
-                                                      <div class="main-data-bottom ovf-hidden" id="jobSpread" style="width: 99%; float: left; position: relative">
-                                                          <!--工具栏-->
-                                                          <div class="bottom-tznrTools btn-group position-absolute">
-                                                              <a href="javascript:void(0);" id="jobInsert" class="btn btn-sm disabled" data-toggle="tooltip" data-placement="bottom" title="" data-original-title="插入"><i class="fa fa-sign-in" aria-hidden="true"></i></a>
-                                                              <a href="javascript:void(0);" id="jobAdd" class="btn btn-sm " data-toggle="tooltip" data-placement="bottom" title="" data-original-title="添加"><i class="fa fa-plus" aria-hidden="true"></i></a>
-                                                              <a href="javascript:void(0);" id="jobDel" class="btn btn-sm disabled" data-toggle="tooltip" data-placement="bottom" title="" data-original-title="删除"><i class="fa fa-remove" aria-hidden="true"></i></a>
-                                                              <a href="javascript:void(0);" id="jobDown" class="btn btn-sm disabled" data-toggle="tooltip" data-placement="bottom" title="" data-original-title="下移"><i class="fa fa-arrow-down" aria-hidden="true"></i></a>
-                                                              <a href="javascript:void(0);" id="jobUp" class="btn btn-sm disabled" data-toggle="tooltip" data-placement="bottom" title="" data-original-title="上移"><i class="fa fa-arrow-up" aria-hidden="true"></i></a>
-                                                          </div>
-                                                      </div>
-                                                      <div class="resize-x" id="TZJNRResize"></div>
-                                                  </div>
-                                                  <div id="itemDiv" style="width: 67%; height: 100%; float: left;">
-                                                      <div class="main-data-bottom ovf-hidden" id="itemSpread" style="position: relative;">
-                                                          <!--工具栏-->
-                                                          <div class="bottom-tznrTools btn-group position-absolute">
-                                                              <a href="javascript:void(0);" id="itemInsert" class="btn btn-sm disabled" data-toggle="tooltip" data-placement="bottom" title="" data-original-title="插入"><i class="fa fa-sign-in" aria-hidden="true"></i></a>
-                                                              <a href="javascript:void(0);" id="itemAdd" class="btn btn-sm " data-toggle="tooltip" data-placement="bottom" title="" data-original-title="添加"><i class="fa fa-plus" aria-hidden="true"></i></a>
-                                                              <a href="javascript:void(0);" id="itemDel" class="btn btn-sm disabled" data-toggle="tooltip" data-placement="bottom" title="" data-original-title="删除"><i class="fa fa-remove" aria-hidden="true"></i></a>
-                                                              <a href="javascript:void(0);" id="itemDown" class="btn btn-sm disabled" data-toggle="tooltip" data-placement="bottom" title="" data-original-title="下移"><i class="fa fa-arrow-down" aria-hidden="true"></i></a>
-                                                              <a href="javascript:void(0);" id="itemUp" class="btn btn-sm disabled" data-toggle="tooltip" data-placement="bottom" title="" data-original-title="上移"><i class="fa fa-arrow-up" aria-hidden="true"></i></a>
-                                                          </div>
-                                                      </div>
-                                                  </div>
-                                              </div>
-                                              <div class="p-0" id="ruleDiv" style="width: 10%; float: left;">
-                                                  <div class="p-0" id="openTypeSetting" >
-                                                      <div class="tn-nav d-flex align-items-start flex-column" data-toggle="tooltip" data-placement="left" title="" data-original-title="打开排版规则">
-                                                          <span class="mt-3 ml-2 text-primary">排版规则</span>
-                                                          <i class="fa fa-arrow-left mt-auto mb-3 text-primary ml-2"></i>
-                                                      </div>
-                                                  </div>
-                                                  <div class="p-0">
-                                                      <div class="main-data-bottom" id="add-rule" style="display: none;">
-                                                          <div class="container-fluid my-2">
-                                                              <div class="mb-1 row" style="text-align: center">
-                                                                  <label class="col-5 px-0 col-form-label text-right">排版规则</label>
-                                                                  <a id="closeTypeSetting" data-toggle="tooltip" data-placement="top" data-original-title="关闭排版规则" class="col-7 px-0 col-form-label" href="javascript:void(0);"><i class="fa fa-arrow-right"></i></a>
-                                                              </div>
-                                                              <p style="text-align: center">
-                                                                  <% if (projectData.property.lockBills == true) { %>
-                                                                  <button class="btn btn-primary btn-sm disabled" type="button" id="use-to-current">应用到选中清单</button>
-                                                                  <button class="btn btn-primary btn-sm disabled" type="button" id="use-to-all">应用到所有清单</button>
-                                                                  <% } else { %>
-                                                                  <button class="btn btn-primary btn-sm" type="button" id="use-to-current">应用到选中清单</button>
-                                                                  <button class="btn btn-primary btn-sm" type="button" id="use-to-all">应用到所有清单</button>
-                                                                  <% } %>
-                                                              </p>
-                                                              <div class="mb-1 row">
-                                                                  <label class="col-5 px-0 col-form-label text-right">添加位置:</label>
-                                                                  <div class="col-7">
-                                                                      <select id="add-position" class="form-control form-control-sm">
-                                                                          <option value="1" selected="selected">添加到项目特征列</option>
-                                                                          <option value="2">添加到清单名称列</option>
-                                                                          <option value="3">添加到工作内容列</option>
-                                                                          <option value="4">分别添加到对应列</option>
-                                                                      </select>
-                                                                  </div>
-                                                              </div>
-                                                              <div class="mb-1 row">
-                                                                  <label class="col-sm-5 px-0 col-form-label text-right">添加内容:</label>
-                                                                  <div class="col-sm-7">
-                                                                      <select id="add-content" class="form-control form-control-sm">
-                                                                          <option value="">无</option>
-                                                                          <option value="1" selected="selected">项目特征+工作内容</option>
-                                                                          <option value="2">工作内容+项目特征</option>
-                                                                          <option value="3">项目特征</option>
-                                                                          <option value="4">工作内容</option>
-                                                                          <option value="5">定额子目</option>
-                                                                      </select>
-                                                                  </div>
-                                                              </div>
-                                                              <div class="mb-1 row">
-                                                                  <label class="col-5 px-0 col-form-label text-right">显示格式:</label>
-                                                                  <div class="col-7">
-                                                                      <select id="display-format" class="form-control form-control-sm">
-                                                                          <option value="1" selected="selected">换行分隔</option>
-                                                                          <option value="2">逗号分隔</option>
-                                                                          <option value="3">括号分隔</option>
-                                                                      </select>
-                                                                  </div>
-                                                              </div>
-                                                              <div class="mb-1 row">
-                                                                  <label class="col-5 px-0 col-form-label text-right">特征生成方式:</label>
-                                                                  <div class="col-7">
-                                                                      <select id="character-format" class="form-control form-control-sm">
-                                                                          <option value="1">特征值</option>
-                                                                          <option value="2" selected="selected">特征:特征值</option>
-                                                                      </select>
-                                                                  </div>
-                                                              </div>
-                                                              <div class="mb-1 row">
-                                                                  <label class="col-5 px-0 col-form-label text-right">子目生成方式:</label>
-                                                                  <div class="col-7">
-                                                                      <select id="child-display-format" disabled="disabled" class="form-control form-control-sm">
-                                                                          <option value="1" selected="selected">编号+定额名称</option>
-                                                                          <option value="2">序号+定额名称</option>
-                                                                      </select>
-                                                                  </div>
-                                                              </div>
-                                                              <div class="mb-1 row">
-                                                                  <label class="col-5 px-0 col-form-label text-right">序号格式:</label>
-                                                                  <div class="col-7">
-                                                                      <select id="serial-type" class="form-control form-control-sm">
-                                                                          <option value="">无</option>
-                                                                          <option value="1" selected="selected">1.</option>
-                                                                          <option value="2">a.</option>
-                                                                          <option value="3">A.</option>
-                                                                      </select>
-                                                                  </div>
-                                                              </div>
-                                                          </div>
-                                                      </div>
-                                                  </div>
-                                              </div>
-                                          </div>
-                                      </div>
-                                      <div class="container-fluid" id="qdjl" role="tabpanel">
+                                      <div class="container-fluid main-data-bottom ovf-hidden" id="qdjl" role="tabpanel">
                                           <div class="row p-0" style="background: #efefef">
                                               <div class="col-6 p-0">
                                                   <div id="qdjlTools" style="width: calc(100% - 5px); border-bottom: solid 1px lightgrey;">
-                                                      <a id="elfInsertRation" href="javascript:void(0);" class="btn btn-sm btn-primary px-1 m-1">应用选项</a>
-                                                      <a id="elfInsertSingle" href="javascript:void(0)" class="btn btn-sm btn-primary px-1">应用单条</a>
+                                                      <a id="elfInsertRation" href="javascript:void(0);" class="btn btn-sm btn-primary px-1 ml-1">应用选项</a>
+                                                      <a id="elfInsertSingle" href="javascript:void(0)" class="btn btn-sm btn-primary px-1 ml-1">应用单条</a>
                                                   </div>
-                                                  <div class="main-data-bottom ovf-hidden" id="elfItems">
+                                                  <div class="ovf-hidden" id="elfItems">
                                                   </div>
                                               </div>
-                                              <!--<div class="p-1">
-                                                  <p class="mt-3"><a id="elfInsertRation" href="javascript:void(0);" class="btn btn-sm btn-primary">应用选项</a></p>
-                                                  <p><a id="elfInsertSingle" href="javascript:void(0)" class="btn btn-sm btn-primary">应用单条</a></p>
-                                              </div>-->
                                           </div>
                                       </div>
                                   </div>
@@ -761,8 +631,8 @@
                     <div class="row">
                         <div class="col-3">
                             <ul class="nav flex-column nav-pills" role="tablist">
-                                <li class="nav-item"><a class="nav-link active" data-toggle="pill" href="#poj-settings-basicInfo" role="tab" id="tab_poj-settings-basicInfo">建设项目基本信息</a></li>
-                                <li class="nav-item"><a class="nav-link" data-toggle="pill" href="#poj-settings-projFeature" id="tab_poj-settings-projFeature" role="tab">工程特征</a></li>
+                                <!--<li class="nav-item"><a class="nav-link active" data-toggle="pill" href="#poj-settings-basicInfo" role="tab" id="tab_poj-settings-basicInfo">建设项目基本信息</a></li>-->
+                                <li class="nav-item"><a class="nav-link active" data-toggle="pill" href="#poj-settings-projFeature" id="tab_poj-settings-projFeature" role="tab">工程特征</a></li>
                                 <li class="nav-item"><a class="nav-link" data-toggle="pill" href="#poj-settings-indicativeInfo" id="tab_poj-settings-indicativeInfo" role="tab">指标信息</a></li>
                                 <li class="nav-item"><a class="nav-link" data-toggle="pill" href="#poj-settings-4" id="about-calc" role="tab">关于计算</a></li>
                                 <li class="nav-item"><a class="nav-link" data-toggle="pill" href="#poj-settings-billsQuanDecimal" id="tab_poj-settings-bqDecimal" role="tab">清单工程量精度</a></li>
@@ -775,12 +645,12 @@
                         <div class="col-9">
                             <div class="tab-content">
                                 <!--基本信息-->
-                                <div class="tab-pane fade show active" id="poj-settings-basicInfo" role="tabpanel">
+                                <div class="tab-pane fade" id="poj-settings-basicInfo" role="tabpanel">
                                     <div class="modal-auto-height" style="overflow: hidden;" id="basicInfoSpread">
                                     </div>
                                 </div>
                                 <!--工程特征-->
-                                <div class="tab-pane fade" id="poj-settings-projFeature" role="tabpanel">
+                                <div class="tab-pane fade show active" id="poj-settings-projFeature" role="tabpanel">
                                     <div class="modal-auto-height" style="overflow: hidden" id="projFeatureSpread">
                                     </div>
                                 </div>
@@ -855,6 +725,16 @@
                                                 </label>
                                             </div>
                                         </fieldset>
+                                        <fieldset class="form-group" id="jcybf" style="display: none;">
+                                            <h5>价差预备费</h5>
+                                            <div class="mt-1">
+                                                年造价增涨率<input id="costGrowthRate" class="form-control form-control-sm"  value="0" type="teext" style="display: inline-block; width: 90px;">%
+                                            </div>
+                                            <div class="mt-1">
+                                                增涨计费年限<input id="growthPeriod" class="form-control form-control-sm"  value="0" type="teext" style="display: inline-block; width: 90px;">
+                                            </div>
+
+                                        </fieldset>
                                     </div>
                                 </div>
                                 <!--清单工程精度-->
@@ -2059,7 +1939,6 @@
     <script type="text/javascript" src="/web/building_saas/report/js/jpc_output_value_define.js"></script>
     <script type="text/javascript" src="/web/building_saas/report/js/jpc_output.js"></script>
     <script type="text/javascript" src="/web/building_saas/report/js/rpt_print.js"></script>
-    <script type="text/javascript" src="/web/building_saas/main/js/views/character_content_view.js"></script>
     <script type="text/javascript" src="/web/building_saas/main/js/views/glj_view.js"></script>
     <script type="text/javascript" src="/web/building_saas/main/js/views/zmhs_view.js"></script>
     <script type="text/javascript" src="/web/building_saas/main/js/views/mbzm_view.js"></script>

+ 2 - 2
web/building_saas/main/js/controllers/block_controller.js

@@ -586,10 +586,10 @@ let BlockController = {
         let EXPString = ration.quantityEXP+"";
         if(EXPString.indexOf("QDL") != -1){
             if(EXPString=="QDL"){//定额的工程量是直接通过清单量填进来的;
-                let  t_unit = ration.unit?ration.unit.replace(/^\d+/,""):"";
+                /*let  t_unit = ration.unit?ration.unit.replace(/^\d+/,""):""; 2019-02-01 养护去掉清单与定额单位的这个判断
                 if(t_unit!=billsUnit){//如果定额的单位去除前面的数字后不等于清单单位,定额工程量保持不变
                     return ;
-                }
+                }*/
                 let times = parseInt(ration.unit);
                 if(isNaN(times)){
                     times = 1;

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

@@ -68,7 +68,7 @@ function getMainResizeEles() {
         min: 180,
         max: `$(window).height()-$('.header').height()-$('#headerToolsBar').height()-180-5`,
         notTopSpread: 0,
-        notBottomSpread: $('#bottom_div ul').height() + $('#qdjlTools').height(),
+        notBottomSpread: $('#bottom_div ul').height(),
         totalHeight: `$(window).height()-$('.header').height()-$('#headerToolsBar').height()-5`
     };
     return mainResizeEles;

+ 0 - 7
web/building_saas/main/js/models/bills.js

@@ -792,13 +792,6 @@ var Bills = {
                     }
                     gljOprObj.refreshView();
                 });
-                //添加内容为定额子目时,根据特征及内容添加规则刷新清单
-                if(updateData['ration']){
-                    let addRuleSetting = getAddRuleSetting();
-                    if(addRuleSetting && addRuleSetting.addContent === '5'){
-                        addRuleUseToBills(getAddRuleSetting(), projectObj.project.mainTree.items);
-                    }
-                };
 
                 if (isDeleteChild){
                     calcTools.forceSelect(parentNode);

+ 8 - 0
web/building_saas/main/js/models/cache_tree.js

@@ -294,6 +294,14 @@ var cacheTree = {
             }
             return success;
         };
+        //获取节点的祖先节点(最顶父节点)
+        Node.prototype.getAncestor = function () {
+            let node = this;
+            while (node.parent) {
+                node = node.parent;
+            }
+            return node;
+        };
 
         var Tree = function (owner) {
             this.owner = owner;

Разница между файлами не показана из-за своего большого размера
+ 609 - 1025
web/building_saas/main/js/models/calc_base.js


+ 26 - 19
web/building_saas/main/js/models/calc_program.js

@@ -216,16 +216,22 @@ let calcTools = {
         };
     },
     setFieldValue: function (treeNode, fieldName, value){
+        if (value == null) value = 0;
         if (fieldName.includes('feesIndex')){
             let arr = fieldName.split('.');
             this.initFeeField(treeNode, arr[1]);
-            treeNode.data.feesIndex[arr[1]][arr[2]] = value;
-            treeNode.updateData.feesIndex[arr[1]][arr[2]] = value;
+            if (treeNode.data.feesIndex[arr[1]][arr[2]] != value) {
+                treeNode.data.feesIndex[arr[1]][arr[2]] = value;
+                treeNode.updateData.feesIndex = treeNode.data.feesIndex;
+                treeNode.changed = true;
+            }
         }
         else{
-            treeNode.updateData[fieldName] = value;
+            if (treeNode.data[fieldName] != value){
+                treeNode.updateData[fieldName] = value;
+                treeNode.changed = true;
+            }
         };
-        treeNode.changed = true;
     },
     initSummaryFee: function (treeNode){
         if (!treeNode.data.summaryFees){
@@ -675,6 +681,7 @@ let calcTools = {
         };
         // 优化掉 undefined 属性
         data = JSON.parse(JSON.stringify(data));
+        delete data.feesIndex;
         return data;
     },
 
@@ -1581,26 +1588,26 @@ class CalcProgram {
         fieldNameArr 值取自:遍历treeNode的计算规则,取有绑定的字段名。这些字段名以外的fee是因旧计算多出来的,需要删除。 */
         function deleteUselessFees(treeNode, fieldNameArr){
             if (fieldNameArr){   // 用于计算程序没有绑定的费用类别,不要同步到清单,而清单因为以前计算过该类别又有值,需删除。如切换取费类别,旧费要清掉。
-                for (var i = 0; i < treeNode.data.fees.length; i++) {
-                    let fee = treeNode.data.fees[i];
-                    if ((fee.fieldName != 'estimate') && !fieldNameArr.includes(fee.fieldName)){
-                        treeNode.data.fees.splice(i, 1);
-                        delete treeNode.data.feesIndex[fee.fieldName];
+                treeNode.data.fees = _.filter(treeNode.data.fees, function (item) {
+                    if(!fieldNameArr.includes(item.fieldName)){
+                        delete treeNode.data.feesIndex[item.fieldName];
                         treeNode.changed = true;
+                        return false;
                     }
-                }
+                    return true;
+                });
             }
             else{   // 总造价清单只留common, estimate两个费用类别。其它公式清单只留common。
                 let reserveArr = calcTools.isTotalCostBill(treeNode)? ['common', 'estimate']:['common'];
                 if (treeNode.data.fees && treeNode.data.fees.length > 0){
-                    let feesArr = treeNode.data.fees;
-                    for (let i = 0; i < feesArr.length; i++) {
-                        if (!reserveArr.includes(feesArr[i].fieldName)) {
-                            delete treeNode.data.feesIndex[feesArr[i].fieldName];
-                            feesArr.splice(i, 1);
+                    treeNode.data.fees = _.filter(treeNode.data.fees, function (item) {
+                        if(!reserveArr.includes(item.fieldName)){
+                            delete treeNode.data.feesIndex[item.fieldName];
                             treeNode.changed = true;
+                            return false;
                         }
-                    }
+                        return true;
+                    });
                 };
             };
         };
@@ -2026,9 +2033,8 @@ class CalcProgram {
     };
 
     // 排除指定项的综合合价计算(用于带循环计算的情况。这里的汇总只到清单级别即可:清单单价取费时,汇总到清单和汇总到定额两个值不一样)
-    getTotalFee(baseNodes, excludeNodes, tender){
+    getTotalFee(baseNodes, excludeNodes, feeField){
         let rst = 0;
-        const totalFeeType = tender ? 'common.tenderTotalFee' : 'common.totalFee';
         function calcNodes(nodes) {
             for (let node of nodes) {
                 if(!node){
@@ -2040,7 +2046,8 @@ class CalcProgram {
                     }
                     else{
                         if (node.sourceType == ModuleNames.bills) {
-                            rst = (rst + calcTools.getFee(node, totalFeeType)).toDecimal(decimalObj.decimal("totalPrice", node));
+                            //这里不四舍五入,保证中间过程不四舍五入
+                            rst += calcTools.getFee(node, feeField);
                         };
                     }
                 }

+ 2 - 3
web/building_saas/main/js/models/fee_rate.js

@@ -60,7 +60,7 @@ var FeeRate = {
         };
         FeeRate.prototype.getAllSubRates = function () {
             let rates =  this.getActivateFeeRate().rates;
-            let subRates = [],nameMap={};
+            let subRates = [],nameMap={},temRates=[];
             for(let r of rates){
                 if(gljUtil.isDef(r.subFeeRate)){
                     for(let p of r.subFeeRate.recodes){
@@ -74,11 +74,10 @@ var FeeRate = {
                                 subRates.push(sub);
                             }
                         }
-
                     }
                 }
             }
-            return subRates;
+            return _.sortByAll(subRates,['ID'])//要保证树节点的ID子项是紧跟着父项的,不然的话显示会有问题
         };
         FeeRate.prototype.getSubViewData= function(item) {
             var datas = [];

+ 5 - 2
web/building_saas/main/js/models/main_consts.js

@@ -252,7 +252,9 @@ const fixedFlag = {
     //暂列金额
     PROVISIONAL:26,
     //安全生产费
-    SAFE_COST:27
+    SAFE_COST:27,
+    //100章清单
+    ONE_HUNDRED_BILLS: 28
 };
 
 const gljKeyArray =['code','name','specs','unit','type'];
@@ -277,6 +279,7 @@ let cpFeeTypes = [
     {type: 'marketLabour', name: '人工费'},
     {type: 'marketMaterial', name: '材料费'},
     {type: 'marketMachine', name: '施工机械使用费'},
+    {type: 'marketMachineLabour', name: '施工机械人工费'},
     {type: 'marketEquipment', name: '设备购置费'},
     {type: 'marketDirect', name: '直接费'},
     {type: 'labour', name: '定额人工费'},
@@ -360,4 +363,4 @@ const materialComboMap = [
     {text:materialType[materialTypeMap.MC],value:materialTypeMap.MC},
     {text:materialType[materialTypeMap.SN],value:materialTypeMap.SN},
     {text:materialType[materialTypeMap.SZ],value:materialTypeMap.SZ}
-];
+];

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

@@ -537,6 +537,10 @@ ProjectGLJ.prototype.addMixRatio = function(selections,callback){
                 repositoryId:glj.repositoryId,
                 materialType:glj.materialType,
                 materialCoe:glj.materialCoe,
+                grossWeightCoe:glj.grossWeightCoe,
+                purchaseStorageRate:glj.purchaseStorageRate,
+                offSiteTransportLossRate:glj.offSiteTransportLossRate,
+                handlingLossRate:glj.handlingLossRate
             };
             if (glj.hasOwnProperty("compilationId")) {
                 pglj.from = "cpt";

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

@@ -336,7 +336,6 @@ var Ration = {
             } else {
                 data[field] = newValue;
             }
-            updateBillsOprRation();
             updateData.push({'updateType': 'ut_update', 'updateData': data});
             this.project.pushNow('updateBills', this.getSourceType(), updateData);
         };
@@ -433,7 +432,6 @@ var Ration = {
                 if(data.length < nodeInfo.length && nodeInfo[data.length].newCode!=null){//说明有部分定额编号没找到记录
                     alert('当前库中找不到定额"' + nodeInfo[data.length].newCode + '"');
                 }
-                updateBillsOprRation();
             })
         };
         ration.prototype.addMultiRation = function (items, callback) {
@@ -531,7 +529,6 @@ var Ration = {
                         }else {
                             project.calcProgram.calcNodesAndSave(newNodes);
                         }
-                        updateBillsOprRation();
                         if(callback){
                             callback();
                         }
@@ -617,7 +614,6 @@ var Ration = {
                             }
                         });
                         //如果添加规则中,添加内容为定额子目,则更新相关清单
-                        updateBillsOprRation();
                         if(callback){
                             callback(newNode);
                         }

+ 16 - 0
web/building_saas/main/js/models/ration_glj.js

@@ -584,6 +584,10 @@ let ration_glj = {
                         adjCoe: glj.adjCoe,
                         materialType:glj.materialType,
                         materialCoe:glj.materialCoe,
+                        grossWeightCoe:glj.grossWeightCoe,
+                        purchaseStorageRate:glj.purchaseStorageRate,
+                        offSiteTransportLossRate:glj.offSiteTransportLossRate,
+                        handlingLossRate:glj.handlingLossRate,
                         repositoryId: glj.repositoryId
                     };
                     if(pEngineer) new_glj.programID = pEngineer;
@@ -663,6 +667,10 @@ let ration_glj = {
                 createType: 'add',
                 materialType:glj.materialType,
                 materialCoe:glj.materialCoe,
+                grossWeightCoe:glj.grossWeightCoe,
+                purchaseStorageRate:glj.purchaseStorageRate,
+                offSiteTransportLossRate:glj.offSiteTransportLossRate,
+                handlingLossRate:glj.handlingLossRate,
                 repositoryId: glj.repositoryId
             };
             if (glj.hasOwnProperty("compilationId")) {
@@ -766,6 +774,10 @@ let ration_glj = {
             oldData.repositoryId = glj.repositoryId;
             oldData.materialType = glj.materialType;
             oldData. materialCoe =  glj.materialCoe;
+            oldData.grossWeightCoe= glj.grossWeightCoe;
+            oldData.purchaseStorageRate = glj.purchaseStorageRate;
+            oldData.offSiteTransportLossRate = glj.offSiteTransportLossRate;
+            oldData.handlingLossRate = glj.handlingLossRate;
             if (glj.hasOwnProperty("compilationId")) {
                 oldData.from = "cpt";
                 if (glj.code.indexOf('-') != -1) {//这条工料机是用户通过修改包称、规格、型号等保存到补充工料机库的
@@ -830,6 +842,10 @@ let ration_glj = {
                 repositoryId: glj.repositoryId,
                 materialType: glj.materialType,   //三材类别
                 materialCoe: glj.materialCoe,
+                grossWeightCoe:glj.grossWeightCoe,
+                purchaseStorageRate:glj.purchaseStorageRate,
+                offSiteTransportLossRate:glj.offSiteTransportLossRate,
+                handlingLossRate:glj.handlingLossRate,
                 projectID: oldData.projectID
             };
             if (glj.hasOwnProperty("compilationId")) {

+ 8 - 2
web/building_saas/main/js/views/billsElf.js

@@ -212,8 +212,14 @@ const BillsElf = (function() {
     //刷新表
     //@return {void}
     function refreshWorkBook(){
-        if (elfItem.workBook) {
-            elfItem.workBook.refresh();
+        //计算内部的表格高度
+        if ($('#qdjl').is(':visible')) {
+            let totalHeight = $('#qdjl').height(),
+                elfToolsHeight = $('#qdjlTools').height();
+            $('#elfItems').height(totalHeight - elfToolsHeight);
+            if (elfItem.workBook) {
+                elfItem.workBook.refresh();
+            }
         }
     }
     //清空表数据

+ 36 - 110
web/building_saas/main/js/views/calc_base_view.js

@@ -15,7 +15,7 @@ let calcBaseView = {
     workBook: null,
     setting:{
         billsHeader: [
-            {name: '计算基础名称', dataCode: 'base', width: 220, vAlign: 'center', hAlign: 'left'},
+            {name: '计算基础名称', dataCode: 'base', width: 300, vAlign: 'center', hAlign: 'left'},
             {name: '金额', dataCode: 'price', width: 100, vAlign: 'center', hAlign: 'right'}
         ],
         rationHeader: [
@@ -168,7 +168,6 @@ let calcBaseView = {
             rst.push(figureObj);
             //set class datas
             this.billsCBClass.ALL.push(figureObj);
-            this.billsCBClass[obj[figure]['class']].push(figureObj);
         }
         return this.billsCBClass.ALL;
     },
@@ -178,32 +177,30 @@ let calcBaseView = {
         let showDatas;
         me.inputExpr = $('#calcBaseExp');
         me.curType = type;
+        //去除清单基数分类
+        $('#cbClassList').hide();
+        $('#cbRowDiv').removeClass('row');
+        $('#billsBaseSpread').removeClass('col-9');
         if (type === me.type.bills) {
-            //锁定的清单不显示
-            if(projectObj.project.isBillsLocked() && projectObj.project.withinBillsLocked(projectObj.project.mainTree.selected)){
-                return;
-            }
-            //显示清单基数分类
-            $('#cbClassList').show();
-            $('#cbRowDiv').addClass('row');
-            $('#billsBaseSpread').addClass('col-9');
-            let row = projectObj.mainSpread.getActiveSheet().getActiveRowIndex();
-            let node = projectObj.project.mainTree.items[row];
-            //输入框显示原本的
-            if (me.isDef(node.data.calcBase)) {
-                me.inputExpr.val(cbParser.toFExpr(node.data.calcBase));
+            try{
+                //锁定的清单不显示
+                if(projectObj.project.isBillsLocked() && projectObj.project.withinBillsLocked(projectObj.project.mainTree.selected)){
+                    return;
+                }
+                let row = projectObj.mainSpread.getActiveSheet().getActiveRowIndex();
+                let node = projectObj.project.mainTree.items[row];
+                //输入框显示原本的
+                if (me.isDef(node.data.calcBase)) {
+                    me.inputExpr.val(cbParser.toFExpr(node.data.calcBase));
+                }
+                let baseObj = projectObj.project.calcBase.getBaseByClass(node);
+                showDatas = me.toViewData(baseObj);
+                $('#cbClassList li .btn ').removeClass('btn btn-outline-secondary btn-sm active');
+                $('#cb_ALL').addClass('btn btn-outline-secondary btn-sm active');
+            } catch (err) {
+                alert(err);
             }
-            let baseObj = projectObj.project.calcBase.getBaseByClass(node);
-            showDatas = me.toViewData(baseObj);
-            $('#cbClassList li .btn ').removeClass('btn btn-outline-secondary btn-sm active');
-            $('#cb_ALL').addClass('btn btn-outline-secondary btn-sm active');
-        }
-        else if (type == me.type.ration) {
-            //去除清单基数分类
-            $('#cbClassList').hide();
-            //$('#qd-jsjs .modal-content').css('width', '');
-            $('#cbRowDiv').removeClass('row');
-            $('#billsBaseSpread').removeClass('col-9');
+        } else if (type == me.type.ration) {
             let calcItem = calcProgramManage.getSelectionInfo().calcItem;
             if (calcItem.dispExprUser) {
                 me.inputExpr.val(calcItem.dispExpr);
@@ -355,18 +352,15 @@ let calcBaseView = {
         }
         CalcBaseCellType.prototype = new ns.CellTypes.Text();
         CalcBaseCellType.prototype.paint = function (ctx, value, x, y, w, h, style, options) {
-            //  if(value!=null){
-            // ctx.fillText(value,x+3+ctx.measureText(value).width,y+h-3);
-            // ctx.fillText(value,x+w-3,y+h-3);
-            GC.Spread.Sheets.CellTypes.Text.prototype.paint.apply(this, arguments);
-            // }
-            if(calcBaseView.editingCell && !projectReadOnly && calcBaseView.ifEdit(type, options.row)){
-                if(calcBaseView.editingCell.row==options.row&&calcBaseView.editingCell.col==options.col){
+            if(!projectReadOnly && calcBaseView.ifEdit(type, options.row)){
+                if(options.sheet.getActiveRowIndex()==options.row&&options.sheet.getActiveColumnIndex()==options.col){
                     var image = document.getElementById('f_btn'),imageMagin = 3;
-                    var imageHeight = h-2*imageMagin;
-                    var imageWidth = w*2/(type=='bills'?7:20);
+                    var imageHeight = 15;
+                    var imageWidth = 25;
                     var imageX = x + w - imageWidth- imageMagin, imageY = y + h / 2 - imageHeight / 2;
                     ctx.save();
+                    ctx.fillStyle = style.backColor;
+                    ctx.fillRect(x,y,w,h);
                     ctx.drawImage(image, imageX, imageY,imageWidth,imageHeight);
                     ctx.beginPath();
                     ctx.arc(imageX+imageWidth/2,imageY+imageHeight/2,1,0,360,false);
@@ -376,8 +370,10 @@ let calcBaseView = {
                     ctx.fill();//画实心圆
                     ctx.closePath();
                     ctx.restore();
+                    w = w - imageWidth - imageMagin;
                 }
             }
+            GC.Spread.Sheets.CellTypes.Text.prototype.paint.apply(this, arguments);
         };
         CalcBaseCellType.prototype.getHitInfo = function (x, y, cellStyle, cellRect, context) {
             return {
@@ -390,96 +386,26 @@ let calcBaseView = {
                 sheetArea: context.sheetArea
             };
         };
-        /*CalcBaseCellType.prototype.processMouseDown = function (hitinfo) {
-            let me=calcBaseView;
-            me.pmLeave = false;
-            if(me.editingCell==null){
-                var showSelectBtn = true;
-                if(hitinfo.sheet.name()!='calc_detail'){
-                    showSelectBtn=me.ifEdit(type, hitinfo.row);
-                }
-                if(showSelectBtn){
-                    me.editingCell={
-                        row:hitinfo.row,
-                        col:hitinfo.col
-                    }
-                    hitinfo.sheet.invalidateLayout();
-                    hitinfo.sheet.repaint();
-                }
-            }else if(hitinfo.row==me.editingCell.row){
-                var offset=hitinfo.cellRect.x+hitinfo.cellRect.width-6;
-                var imageMagin=3;
-                var imageHeight = hitinfo.cellRect.height-2*imageMagin;
-                var imageWidth = hitinfo.cellRect.width*2/7;
-                if(hitinfo.x<offset&&hitinfo.x>offset-imageWidth){
-                    if(!projectReadOnly && me.ifEdit(type, hitinfo.row)){
-                        calcBaseView.confirmBtn.attr('toggle', 'calcBase');
-                        changeCalcBaseFeeRate('calcBase');
-                        $('#tabCalcBase').tab('show');
-                        calcBaseView.initCalctor(type);
-                    }
-                }
-            }
-        };
-        CalcBaseCellType.prototype.processMouseLeave = function (hitinfo) {
-            if(!calcBaseView.pmLeave){
-                calcBaseView.editingCell=null;
-                hitinfo.sheet.invalidateLayout();
-                hitinfo.sheet.repaint();
-                calcBaseView.pmLeave = true;
-            }
-        };*/
         CalcBaseCellType.prototype.processMouseDown = function (hitinfo) {
             let me = calcBaseView;
-            if(me.editingCell && hitinfo.row==me.editingCell.row){
+            if(hitinfo.sheet.getActiveRowIndex()==hitinfo.row&&hitinfo.sheet.getActiveColumnIndex()==hitinfo.col){
                 var offset=hitinfo.cellRect.x+hitinfo.cellRect.width-6;
-                var imageMagin=3;
-                var imageHeight = hitinfo.cellRect.height-2*imageMagin;
-                var imageWidth = hitinfo.cellRect.width*2/7;
+                var imageWidth = 25;
                 if(hitinfo.x<offset&&hitinfo.x>offset-imageWidth){
                     if(!projectReadOnly && me.ifEdit(type, hitinfo.row)){
-                        hitinfo.sheet.setActiveCell(hitinfo.row, hitinfo.col);
+                        let node = projectObj.project.mainTree.items[hitinfo.row] ? projectObj.project.mainTree.items[hitinfo.row] : null;
                         if(hitinfo.sheet.getParent() === projectObj.mainSpread){
-                            projectObj.project.mainTree.selected = projectObj.project.mainTree.items[hitinfo.row] ? projectObj.project.mainTree.items[hitinfo.row] : null;
+                            projectObj.mainController.setTreeSelected(node);
                         }
+                        hitinfo.sheet.setActiveCell(hitinfo.row, hitinfo.col);
                         calcBaseView.confirmBtn.attr('toggle', 'calcBase');
                         changeCalcBaseFeeRate('calcBase');
                         $('#tabCalcBase').tab('show');
                         calcBaseView.initCalctor(type);
                     }
-                }else {//鼠标点击其它地方,消失
-                    hideButton(hitinfo);
                 }
             }
         };
-        CalcBaseCellType.prototype.processMouseEnter = function (hitinfo){
-            let me = calcBaseView;
-            me.pmLeave = false;
-            if(me.editingCell==null){
-                var showSelectBtn = true;
-                showSelectBtn=me.ifEdit(type, hitinfo.row);
-                if(showSelectBtn){
-                    me.editingCell={
-                        row:hitinfo.row,
-                        col:hitinfo.col
-                    };
-                    hitinfo.sheet.invalidateLayout();
-                    hitinfo.sheet.repaint();
-                }
-            }
-        };
-        CalcBaseCellType.prototype.processMouseLeave = function (hitinfo) {
-            hideButton(hitinfo);
-        };
-
-        function hideButton(hitinfo) {
-            if(!calcBaseView.pmLeave){
-                calcBaseView.editingCell=null;
-                hitinfo.sheet.invalidateLayout();
-                hitinfo.sheet.repaint();
-                calcBaseView.pmLeave = true;
-            }
-        }
         return new CalcBaseCellType();
     },
 };

+ 12 - 1
web/building_saas/main/js/views/fee_rate_view.js

@@ -173,13 +173,24 @@ var feeRateObject={
                     let treeType = sheetCommonObj.getTreeNodeCellType(data,row,parentMap);
                     sheet.getCell(row, 0).cellType(treeType);
                     visibleMap[data[row].ID] = treeType.collapsed;
-                    if(visibleMap[data[row].ParentID] ) sheet.getRange(row , -1, 1, -1).visible(!visibleMap[data[row].ParentID]);//显示或隐藏
+                    feeRateObject.setRowVisible(data,row,visibleMap,sheet);
                 }
             }
         }
         sheet.resumeEvent();
         sheet.resumePaint();
     },
+    setRowVisible:function (data,row,visibleMap,sheet) {
+        sheet.getRange(row , -1, 1, -1).visible(getVisible(data[row].ParentID));//显示或隐藏
+        function getVisible(ParentID) {
+            if(visibleMap[ParentID]) return false //如果父节点是缩起的,那就隐藏本身。
+            if(visibleMap[ParentID] == false){//如果父节点不是缩起的,要再往父节点找看
+                let pnode = _.find(data,{'ID':ParentID});
+                if(pnode) return getVisible(pnode.ParentID);//如果有父节点,递归调用
+                return true;//没有,返回显示
+            }
+        }
+    },
     getFeeRateLevel:function (rate,data) {
         if(rate.ParentID){
          let prate =  _.find(data,{'ID':rate.ParentID});

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

@@ -14,8 +14,8 @@ let gljCol = {
             {headerName: "消耗量", headerWidth: 65, dataCode: "quantity", dataType: "Number", hAlign: "right", decimalField: "glj.quantity"},
             {headerName: "定额价", headerWidth: 65, dataCode: "basePrice", dataType: "Number", hAlign: "right"},//, decimalField: "glj.unitPrice"
             {headerName: "定额消耗", headerWidth: 65, dataCode: "rationItemQuantity", dataType: "Number", hAlign: "right", decimalField: "glj.quantity"},   // dataType: "Number", formatter: "0.00"
-            {headerName: "总消耗量", headerWidth: 80, dataCode: "totalQuantity", dataType: "Number", hAlign: "right", decimalField: "glj.quantity"},
-            {headerName: "暂估", headerWidth: 45, dataCode: "isEstimate", dataType: "String", hAlign: "center", vAlign: "center", cellType: "checkBox"}
+            {headerName: "总消耗量", headerWidth: 80, dataCode: "totalQuantity", dataType: "Number", hAlign: "right", decimalField: "glj.quantity"}
+            //{headerName: "暂估", headerWidth: 45, dataCode: "isEstimate", dataType: "String", hAlign: "center", vAlign: "center", cellType: "checkBox"}
         ],
         view: {
             lockColumns: [ "adjustPrice", "rationItemQuantity", "quantity", "totalQuantity", "isEstimate"],//这里以后改成dataCode好一点

+ 12 - 10
web/building_saas/main/js/views/glj_view.js

@@ -575,6 +575,7 @@ var gljOprObj = {
         }
     },
     showRationGLJSheetData: function (init) {
+        let me = this;
         let selected = this.sheet.getSelections();
         this.combineWithProjectGlj(this.sheetData);
         this.sheet.setRowCount(0);
@@ -582,16 +583,17 @@ var gljOprObj = {
         this.sumQuantity();//计算总消耗量
         this.addMixRatioToShow();//显示组成物信息
         this.initRationTree(init,this.getUnitPriceCodeMap());
-        sheetCommonObj.showData(this.sheet, this.setting, this.sheetData);
-        if(this.mainTreeSelectedChange == true){
-            this.sheet.setSelection(0,1,1,1);//默认选中第一行,第二列(名称列)
-            this.mainTreeSelectedChange = false;
-        }else if(selected){//定位光标到之前的位置
-            this.sheet.setSelection(selected[0].row,selected[0].col,selected[0].rowCount,selected[0].colCount);
-        }
-        //初始选择
-        this.preGljSelection = null;
-        this.sheetInitSelection({row: this.sheet.getActiveRowIndex(), col: this.sheet.getActiveColumnIndex()});
+        sheetCommonObj.showData(this.sheet, this.setting, this.sheetData,null,function () {
+            if(me.mainTreeSelectedChange == true){
+                me.sheet.setSelection(0,1,1,1);//默认选中第一行,第二列(名称列)
+                me.mainTreeSelectedChange = false;
+            }else if(selected){//定位光标到之前的位置
+                me.sheet.setSelection(selected[0].row,selected[0].col,selected[0].rowCount,selected[0].colCount);
+            }
+            //初始选择
+            me.preGljSelection = null;
+            me.sheetInitSelection({row: me.sheet.getActiveRowIndex(), col: me.sheet.getActiveColumnIndex()});
+        });
 
     },
     getSelectedRationGlj:function () {

+ 7 - 5
web/building_saas/main/js/views/main_tree_col.js

@@ -119,12 +119,11 @@ let MainTreeCol = {
         },
         commonTotalFee: function (node) {
             // 09-29 zhang
-            let Bills =projectObj.project.Bills;
             // 当前属于分部分项、施工技术措施项目,综合单价只读。
-            if(Bills.isFBFX(node)||Bills.isTechMeasure(node)){
+            /*if(Bills.isFBFX(node)||Bills.isTechMeasure(node)){
                 return true;
-            }
-            // 不属于分部分项、施工技术措施项目的部分,如果不是叶子清单,或有基数计算/定额/量价/人材机 只读
+            }*/
+            //如果不是叶子清单,或有基数计算/定额/量价/人材机 只读
             if(!calcTools.isLeafBill(node)||calcTools.isCalcBaseBill(node)||node.children.length > 0){
                 return true;
             }
@@ -172,7 +171,10 @@ let MainTreeCol = {
             return node.sourceType == projectObj.project.ration_glj.getSourceType();
         },
         specialProvisional:function (node) {
-            return !(node.sourceType == ModuleNames.bills && node.source.children.length == 0)
+            //是否使用了专项暂定合计基数,使用了的节点不可设置专项暂定(会造成循环计算)
+            //只允许“第100章至700章清单”下的叶子清单可选
+            let belongFlagList = cbTools.getBelongFlagList(node);
+            return !(node.sourceType == ModuleNames.bills && node.source.children.length == 0 && belongFlagList.includes(fixedFlag.ONE_SEVEN_BILLS));
         },
         volumePrice: function (node) {
             return (node.data.type == rationType.volumePrice || node.data.type == rationType.gljRation);

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

@@ -680,6 +680,10 @@ projectGljObject={
             supply_quantity:glj.supply_quantity,
             materialType:glj.materialType,
             materialCoe:glj.materialCoe,
+            grossWeightCoe:glj.grossWeightCoe,
+            purchaseStorageRate:glj.purchaseStorageRate,
+            offSiteTransportLossRate:glj.offSiteTransportLossRate,
+            handlingLossRate:glj.handlingLossRate,
             delivery:glj.delivery,
             delivery_address:glj.delivery_address,
             is_adjust_price:glj.is_adjust_price,

+ 4 - 8
web/building_saas/main/js/views/project_property_basicInfo.js

@@ -406,7 +406,7 @@ let basicInfoView = {
             if(recode&&recode.hasOwnProperty('items')){
                 //方框外1像素内都有效
                 const boxLengh = 10;
-                if (hitinfo.x >= centerX - halfBoxLength - 1 && hitinfo.x <= centerX + halfBoxLength + 1 &&
+                if (hitinfo.x >= centerX - halfBoxLength - 2 && hitinfo.x <= centerX + halfBoxLength + 1 &&
                     hitinfo.y >= centerY - halfBoxLength - 1 && hitinfo.y <= centerY + halfBoxLength + 1) {
                     var collapsed = recode.collapsed==undefined?true:recode.collapsed;
                     collapsed = !collapsed
@@ -473,7 +473,8 @@ let basicInfoView = {
 };
 
 $(document).ready(function () {
-    $('#poj-set').on('shown.bs.modal', function (e) {
+    //暂时隐藏
+   /* $('#poj-set').on('shown.bs.modal', function (e) {
         //init Spread
         basicInfoView.initDatas(basicInfoView.orgDatas);
         basicInfoView.buildSheet();
@@ -494,14 +495,9 @@ $(document).ready(function () {
 
     $('#tab_poj-settings-basicInfo').on('shown.bs.tab', function () {
         basicInfoView.workBook.refresh();
-    });
+    });*/
     $('#openProjSet').click(function () {
         $('[data-toggle="tooltip"]').tooltip('hide');
         $('#poj-set').modal('show');
     });
-   /* $('#property_ok').bind('click', function () {
-        if(basicInfoView.toUpdate(basicInfoView.orgDatas, basicInfoView.datas)){
-            basicInfoView.a_updateInfo(basicInfoView.toSaveDatas(basicInfoView.datas));
-        }
-    });*/
 });

+ 16 - 26
web/building_saas/main/js/views/project_property_projFeature.js

@@ -20,10 +20,11 @@ let projFeatureView = {
             allowUserDragFill: false,
             scrollbarMaxAlign : true
         },
-        numRows: [],//6, 7, 8, 9, 10, 11, 12, 13, 14, 15
+        numRows: [],
+        combos: [],
         dateRows: [],
         locked: {
-            rows: [0, 1],
+            rows: [0],
             cols: [0]
         }
     },
@@ -79,7 +80,7 @@ let projFeatureView = {
         if(!this.workBook){
             this.workBook = new GC.Spread.Sheets.Workbook($('#projFeatureSpread')[0], {sheetCount: 1});
             sheetCommonObj.spreadDefaultStyle(this.workBook);
-            sheetCommonObj.bindEscKey(this.workBook, [{sheet: this.workBook.getSheet(0), editStarting: this.onEditStarting, editEnded: this.onEditEnded}]);
+            sheetCommonObj.bindEscKey(this.workBook, [{sheet: this.workBook.getSheet(0), editStarting: null, editEnded: this.onEditEnded}]);
             this.setOptions(this.workBook, this.setting.options);
             this.buildHeader(this.workBook.getActiveSheet(), this.setting.header);
             this.bindEvent(this.workBook);
@@ -89,10 +90,9 @@ let projFeatureView = {
     bindEvent: function (workBook) {
         const _events = GC.Spread.Sheets.Events;
         let sheet = workBook.getActiveSheet();
-        sheet.bind(_events.EditStarting, this.onEditStarting);
+        sheet.options.isProtected = true;
         sheet.bind(_events.EditEnded, this.onEditEnded);
         sheet.bind(_events.EnterCell, this.onEnterCell);
-        sheet.bind(_events.ClipboardPasting, this.onClipboardPasting);
         sheet.bind(_events.ClipboardPasted, this.onClipboardPasted);
     },
 
@@ -105,6 +105,10 @@ let projFeatureView = {
             me.initTree(sheet, true, datas);
             sheet.setFormatter(-1, 1, '@');
            for(let row = 0;row < datas.length ; row ++){
+               //锁定
+               if (!me.setting.locked.rows.includes(row)) {
+                   sheet.getCell(row, 1).locked(false);
+               }
                if(datas[row].cellType == 'comboBox'){
                    let options = datas[row].options?datas[row].options.split("@"):[];
                    me.setCombo(sheet, row, options);
@@ -119,16 +123,6 @@ let projFeatureView = {
         this.renderSheetFuc(sheet, fuc);
     },
 
-    onEditStarting: function (sender, args) {
-        let me = projFeatureView;
-        if(me.setting.locked.cols.indexOf(args.col) !== -1){
-            args.cancel = true;
-        }
-        if(args.col === 1 && me.setting.locked.rows.indexOf(args.row) !== -1){
-            args.cancel = true;
-        }
-    },
-
     onEditEnded: function (sender, args) {
         let me = projFeatureView;
         let v =  args.editingText ? args.editingText.toString().trim() : '';
@@ -148,13 +142,6 @@ let projFeatureView = {
         args.sheet.repaint();
     },
 
-    onClipboardPasting: function (sender, args) {
-        let me = projFeatureView;
-        if(me.setting.locked.cols.indexOf(args.cellRange.col) !== -1){
-            args.cancel = true;
-        }
-    },
-
     onClipboardPasted: function (sender, args) {
         let me = projFeatureView;
         let items = sheetCommonObj.analyzePasteData(me.setting, args);
@@ -165,11 +152,8 @@ let projFeatureView = {
         for(let i = 0, len = items.length; i < len; i++){
             let row = i + args.cellRange.row;
             let comboItems = me.getComboItemsByRow(row);
-            if(me.setting.locked.rows.indexOf(row) !== -1){
-                recRows.push(row);
-            }
             //粘贴下拉框数据过滤
-            else if(comboItems && comboItems.indexOf(items[i].value) !== -1){
+            if(comboItems && comboItems.indexOf(items[i].value) !== -1){
                 recRows.push(row);
             }
             else if(me.setting.numRows.indexOf(row) !== -1 && !me.isNum(items[i].value)){
@@ -220,6 +204,12 @@ let projFeatureView = {
     initDatas: function (datas) {
         this.datas = [];
         for(let i = 0, len = datas.length; i < len; i++){
+            if (typeof datas[i].readOnly === 'string') {
+                datas[i].readOnly = JSON.parse(datas[i].readOnly);
+            }
+            if (datas[i].readOnly && !this.setting.locked.rows.includes(i)) {
+                this.setting.locked.rows.push(i);
+            }
             this.datas.push(this.copyObj(datas[i]));
         }
     },

+ 97 - 171
web/building_saas/main/js/views/project_view.js

@@ -58,12 +58,6 @@ var projectObj = {
              gljOprObj.showDataIfRationSelect(node);
              if (activeSubSheetIsCalcProgram())
              calcProgramObj.refreshCalcProgram(node, 3);*/
-
-            //zhong 2017-9-1 特征及内容
-            if(pageCCOprObj.active){
-                pageCCOprObj.mainActiveCell = projectObj.mainSpread.getActiveSheet().getSelections()[0];//mainSpread焦点单元格
-                pageCCOprObj.setCacheAndShow(node);
-            }
         });
     },
     refreshBaseActn: function (tree) {
@@ -321,10 +315,6 @@ var projectObj = {
                             if(node.data.type == billType.BX){//从清单库中找到标准清单的话,要把补项改成分项
                                 node.data.type = billType.FX;
                             }
-                            //sortItems(data.items, data.itemCharacter);//2018-12-03 这里改成在后端获取
-                           // sortItems(data.jobs, data.jobContent);
-                            pageCCOprObj.setItemContentNode(node, data.jobContent, data.itemCharacter, node.data.name);
-                            pageCCOprObj.setCacheAndShow(node);
                         }
                         if (/\//.test(data.unit)) {
                             let existB = projectObj.project.Bills.sameStdCodeBillsData(data.code);
@@ -504,7 +494,7 @@ var projectObj = {
                     if(value === node.data.calcBase){
                         return;
                     }
-                    node.updateData.userCalcBase = value;
+                    node.data.userCalcBase = value;
                     project.calcBase.calculate(node);
                     if(!project.calcBase.success){
                         let activeCell = projectObj.mainSpread.getActiveSheet().getSelections()[0];
@@ -1337,29 +1327,7 @@ var projectObj = {
                             callback:function(key){
                                 project.Ration.insertVolumePrice(gljType.GENERAL_MACHINE);
                             }
-                        },
-                        insertMainMaterial:{
-                            name:"主材" ,
-                            icon: 'fa-sign-in',
-                            callback:function(key){
-                                project.Ration.insertVolumePrice(gljType.MAIN_MATERIAL);
-                            }
-                        },
-                        insertEquipment:{
-                            name:"设备" ,
-                            icon: 'fa-sign-in',
-                            visible: function () {
-                                if (typeof isCQ2018 != 'undefined') {
-                                    return false;
-                                }else{
-                                    return true;
-                                }
-                            },
-                            callback:function(key){
-                                project.Ration.insertVolumePrice(gljType.EQUIPMENT);
-                            }
                         }
-
                     }
                 },
                 "insertGLJ": {
@@ -1960,18 +1928,15 @@ var projectObj = {
         }
         CommonTotalFeeCellType.prototype = new ns.CellTypes.Text();
         CommonTotalFeeCellType.prototype.paint = function (ctx, value, x, y, w, h, style, options) {
-            //  if(value!=null){
-            // ctx.fillText(value,x+3+ctx.measureText(value).width,y+h-3);
-            // ctx.fillText(value,x+w-3,y+h-3);
-            GC.Spread.Sheets.CellTypes.Text.prototype.paint.apply(this, arguments);
-            // }
-            if(calcBaseView.editingCell && !projectReadOnly && calcBaseView.ifEdit(type, options.row)){
-                if(calcBaseView.editingCell.row==options.row&&calcBaseView.editingCell.col==options.col){
+            if(!projectReadOnly && calcBaseView.ifEdit(type, options.row)){
+                if(options.sheet.getActiveRowIndex()==options.row&&options.sheet.getActiveColumnIndex()==options.col){
                     var image = document.getElementById('f_btn'),imageMagin = 3;
-                    var imageHeight = h-2*imageMagin;
-                    var imageWidth = w*2/(type=='bills'?7:20);
+                    var imageHeight = 15;
+                    var imageWidth = 25;
                     var imageX = x + w - imageWidth- imageMagin, imageY = y + h / 2 - imageHeight / 2;
                     ctx.save();
+                    ctx.fillStyle = style.backColor;
+                    ctx.fillRect(x,y,w,h);
                     ctx.drawImage(image, imageX, imageY,imageWidth,imageHeight);
                     ctx.beginPath();
                     ctx.arc(imageX+imageWidth/2,imageY+imageHeight/2,1,0,360,false);
@@ -1981,8 +1946,10 @@ var projectObj = {
                     ctx.fill();//画实心圆
                     ctx.closePath();
                     ctx.restore();
+                    w = w - imageWidth - imageMagin;
                 }
             }
+             GC.Spread.Sheets.CellTypes.Text.prototype.paint.apply(this, arguments);
         };
         CommonTotalFeeCellType.prototype.getHitInfo = function (x, y, cellStyle, cellRect, context) {
             return {
@@ -1995,98 +1962,28 @@ var projectObj = {
                 sheetArea: context.sheetArea
             };
         };
-        /*CommonTotalFeeCellType.prototype.processMouseDown = function (hitinfo) {
-            let me=calcBaseView;
-            me.pmLeave = false;
-            if(me.editingCell==null){
-                var showSelectBtn = true;
-                if(hitinfo.sheet.name()!='calc_detail'){
-                    showSelectBtn=me.ifEdit(type, hitinfo.row);
-                }
-                if(showSelectBtn){
-                    me.editingCell={
-                        row:hitinfo.row,
-                        col:hitinfo.col
-                    }
-                    hitinfo.sheet.invalidateLayout();
-                    hitinfo.sheet.repaint();
-                }
-            }else if(hitinfo.row==me.editingCell.row){
-                var offset=hitinfo.cellRect.x+hitinfo.cellRect.width-6;
-                var imageMagin=3;
-                var imageHeight = hitinfo.cellRect.height-2*imageMagin;
-                var imageWidth = hitinfo.cellRect.width*2/7;
-                if(hitinfo.x<offset&&hitinfo.x>offset-imageWidth){
-                    if(!projectReadOnly && me.ifEdit(type, hitinfo.row)){
-                        calcBaseView.confirmBtn.attr('toggle', 'commonTotalFee');
-                        changeCalcBaseFeeRate('commonTotalFee');
-                        $('#tabCalcBase').tab('show');
-                        calcBaseView.initCalctor(type);
-                        feeRateObject.showSelectModal(hitinfo);
-                    }
-                }
-            }
-        };
-        CommonTotalFeeCellType.prototype.processMouseLeave = function (hitinfo) {
-            if(!calcBaseView.pmLeave){
-                calcBaseView.editingCell=null;
-                hitinfo.sheet.invalidateLayout();
-                hitinfo.sheet.repaint();
-                calcBaseView.pmLeave = true;
-            }
-        };*/
         CommonTotalFeeCellType.prototype.processMouseDown = function (hitinfo) {
             let me = calcBaseView;
-            if(me.editingCell && hitinfo.row==me.editingCell.row){
+            if(hitinfo.sheet.getActiveRowIndex()==hitinfo.row&&hitinfo.sheet.getActiveColumnIndex()==hitinfo.col){
                 var offset=hitinfo.cellRect.x+hitinfo.cellRect.width-6;
-                var imageMagin=3;
-                var imageHeight = hitinfo.cellRect.height-2*imageMagin;
-                var imageWidth = hitinfo.cellRect.width*2/7;
+                var imageWidth = 25;
                 if(hitinfo.x<offset&&hitinfo.x>offset-imageWidth){
                     if(!projectReadOnly && me.ifEdit(type, hitinfo.row)){
+                        let node = projectObj.project.mainTree.items[hitinfo.row] ? projectObj.project.mainTree.items[hitinfo.row] : null;
                         if(hitinfo.sheet.getParent() === projectObj.mainSpread){
-                            projectObj.project.mainTree.selected = projectObj.project.mainTree.items[hitinfo.row] ? projectObj.project.mainTree.items[hitinfo.row] : null;
+                            projectObj.mainController.setTreeSelected(node);
                         }
                         hitinfo.sheet.setActiveCell(hitinfo.row, hitinfo.col);
                         calcBaseView.confirmBtn.attr('toggle', 'commonTotalFee');
-                        changeCalcBaseFeeRate('commonTotalFee');
+                        //changeCalcBaseFeeRate('commonTotalFee');//公路上不需要费率选项页
+                        changeCalcBaseFeeRate('calcBase');
                         $('#tabCalcBase').tab('show');
                         calcBaseView.initCalctor(type);
-                        feeRateObject.showSelectModal(hitinfo);
+                        //feeRateObject.showSelectModal(hitinfo);
                     }
-                }else {//鼠标点击其它地方,消失
-                    hideButton(hitinfo);
-                }
-            }
-        };
-        CommonTotalFeeCellType.prototype.processMouseEnter = function (hitinfo){
-            let me = calcBaseView;
-            me.pmLeave = false;
-            if(me.editingCell==null){
-                var showSelectBtn = true;
-                showSelectBtn=me.ifEdit(type, hitinfo.row);
-                if(showSelectBtn){
-                    me.editingCell={
-                        row:hitinfo.row,
-                        col:hitinfo.col
-                    };
-                    hitinfo.sheet.invalidateLayout();
-                    hitinfo.sheet.repaint();
                 }
             }
         };
-        CommonTotalFeeCellType.prototype.processMouseLeave = function (hitinfo) {
-            hideButton(hitinfo);
-        };
-
-        function hideButton(hitinfo) {
-            if(!calcBaseView.pmLeave){
-                calcBaseView.editingCell=null;
-                hitinfo.sheet.invalidateLayout();
-                hitinfo.sheet.repaint();
-                calcBaseView.pmLeave = true;
-            }
-        }
         return new CommonTotalFeeCellType();
     },
     selectColAndFocus :function (newNode,field = 'code') {//选中单元格并设置焦点
@@ -2145,11 +2042,10 @@ $('#delete').click(function () {
 $('#upLevel').click(function () {
     var controller = projectObj.mainController, project = projectObj.project;
     var selected = controller.tree.selected, orgParent = selected.parent;
-
     if (selected && selected.sourceType === project.Bills.getSourceType()) {
         project.Bills.upLevelBills(selected.source);
         controller.upLevel();
-        controller.refreshTreeNode([orgParent]);
+        controller.refreshTreeNode([orgParent, selected]);
         projectObj.project.calcProgram.calcNodesAndSave([selected,orgParent]);
     }
 });
@@ -2204,10 +2100,6 @@ $("a[name='lockBills']").click(function () {//点击锁定/解锁清单
         controller.refreshTreeNode(nodes);
         projectObj.mainController.setTreeSelected(selected);//触发树节点选中事件
         projectObj.loadLockBillsButton();
-        if(!projectReadOnly){
-            pageCCOprObj.refreshRuleTools(lockBills);
-        }
-        //$("[data-toggle='tooltip']").tooltip('hide'); bs 与 jqueryUI冲突
     });
 });
 $('#ZLFB_btn').click(function () {
@@ -2218,17 +2110,12 @@ $('#ZLFB_btn').click(function () {
 let displayLevel = function(nodes, depth, type){
     let refreshNodes = [];
     function getExpandedController(){
-        if(type === 'DXFY' || type === 'FB'){
-            if(type === 'FB'){
-                projectObj.project.mainTree.items[0].setExpanded(true);
-                refreshNodes.push(projectObj.project.mainTree.items[0]);
-            }
+        if(['X', 'M', 'J', 'XM'].includes(type)){//项、目、节、细目
             return  function expandedControl(nodes, depth){
-                let bType = type === 'FB' ? billType.FB : billType.DXFY;
                 for(let node of nodes){
                     let nodeDepth = node.depth();
                     if(nodeDepth <= depth){
-                        let expanded = nodeDepth === depth && !node.children[0] || nodeDepth < depth && node.children[0] && node.children[0].data.type === bType ? true : false;
+                        let expanded = nodeDepth === depth && !node.children[0] || nodeDepth < depth && node.children[0] && node.children[0].data.type === billType.BILL ? true : false;
                         node.setExpanded(expanded);
                         refreshNodes.push(node);
                         if(nodeDepth < depth){
@@ -2237,17 +2124,13 @@ let displayLevel = function(nodes, depth, type){
                     }
                 }
             }
-        }
-        else if(type === 'FX' || type === 'ZM' || type === 'ZD'){
+        } else {
             return  function expandedControl(nodes){
                 for(let node of nodes){
-                    if(type !== 'FX' || node.sourceType === projectObj.project.Bills.getSourceType()){
+                    if(node.sourceType === projectObj.project.Bills.getSourceType()){
                         let expanded = true;
-                        if(type === 'FX'){
-                            expanded =  !node.children[0] || node.children[0] && node.children[0].sourceType === projectObj.project.Bills.getSourceType() ? true : false;
-                        }
-                        else if(type === 'ZM'){
-                            expanded =  !node.children[0] || node.children[0] && node.children[0].sourceType !== projectObj.project.ration_glj.getSourceType() ? true : false;
+                        if(type === 'ZDCXM'){
+                            expanded = !node.children[0] || node.children[0] && node.children[0].sourceType !== projectObj.project.Ration.getSourceType() ? true : false;
                         }
                         node.setExpanded(expanded);
                         refreshNodes.push(node);
@@ -2299,36 +2182,29 @@ $('#moreMenu > a').mouseenter(function () {
    }
 });
 
-$('#displayDXFY').click(function () {
-   displayLevel(projectObj.project.mainTree.items, 0, 'DXFY')
+//项
+$('#displayX').click(function () {
+   displayLevel(projectObj.project.mainTree.items, 1, 'X')
 });
-//显示至一级分部
-$('#displayFB1').click(function () {
-   displayLevel(projectObj.project.mainTree.items[0].children, 1, 'FB');
+//
+$('#displayM').click(function () {
+   displayLevel(projectObj.project.mainTree.items, 2, 'M');
 });
-//二级分部
-$('#displayFB2').click(function () {
-    displayLevel(projectObj.project.mainTree.items[0].children, 2, 'FB');
+//
+$('#displayJ').click(function () {
+    displayLevel(projectObj.project.mainTree.items, 3, 'J');
 });
-//三级分部
-$('#displayFB3').click(function () {
-    displayLevel(projectObj.project.mainTree.items[0].children, 3, 'FB');
+//细目
+$('#displayXM').click(function () {
+    displayLevel(projectObj.project.mainTree.items, 4, 'XM');
 });
-//四级分部
-$('#displayFB4').click(function () {
-    displayLevel(projectObj.project.mainTree.items[0].children, 4, 'FB');
+//最底层细目
+$('#displayZDCXM').click(function () {
+    displayLevel(projectObj.project.mainTree.items, null, 'ZDCXM');
 });
-//分项
-$('#displayFX').click(function () {
-    displayLevel(projectObj.project.mainTree.items, null, 'FX');
-});
-//子目
-$('#displayZM').click(function () {
-    displayLevel(projectObj.project.mainTree.items, null, 'ZM');
-});
-//最底层
-$('#displayZD').click(function () {
-   displayLevel(projectObj.project.mainTree.roots, null, 'ZD');
+//定额
+$('#displayDE').click(function () {
+    displayLevel(projectObj.project.mainTree.items, null, 'DE');
 });
 
 $('#poj-set').on('show.bs.modal', function () {
@@ -2348,7 +2224,7 @@ $('#poj-set').on('show.bs.modal', function () {
         let ft = (projectObj.project.property.billsCalcMode !== undefined && projectObj.project.property.billsCalcMode !== null) ?
             projectObj.project.property.billsCalcMode : defaultCalcMode;
 
-        let zg = projectObj.project.property.zanguCalcMode !== undefined &&``
+        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);
@@ -2362,6 +2238,38 @@ $('#poj-set').on('show.bs.modal', function () {
         projDisplayView.init();
         calcOptions.init();
     }
+    let propertyInfo = projectInfoObj.projectInfo.property;
+    //关于计算-价差预备费//预算项目才有
+    if (propertyInfo.valuationType === 'bill') {
+        $('#jcybf').show();
+        //年造价增涨率,单位为%
+        $('#costGrowthRate').val(propertyInfo.costGrowthRate ? propertyInfo.costGrowthRate * 100 : 0);
+        //增涨计费年限
+        $('#growthPeriod').val(propertyInfo.growthPeriod ? propertyInfo.growthPeriod : 0);
+    }
+});
+
+function isKeyNumber(keyCode) {
+    // 数字
+    if (keyCode >= 48 && keyCode <= 57 ) {
+        return true;
+    } else if (keyCode >= 96 && keyCode <= 105) { //小键盘数字
+        return true;
+    } else if (keyCode == 8 || keyCode == 46 || keyCode == 37 || keyCode == 39 || keyCode == 108 || keyCode == 110) {  // Backspace, del, 左右方向键
+        return true;
+    } else if (keyCode >= 112 && keyCode <= 123) { //F1 -F12
+        return true;
+    }
+    return false;
+}
+
+//年造价增涨率
+$('#costGrowthRate').keydown(function (e) {
+    return isKeyNumber(e.keyCode);
+});
+//计费年限
+$("#growthPeriod").keydown(function (e) {
+    return isKeyNumber(e.keyCode);
 });
 
 //恢复默认列设置
@@ -2482,6 +2390,23 @@ $('#property_ok').click(function () {
         project.property.zanguCalcMode = zg;
         reCalcRations = true;
     };
+    //价差预备费,预算项目才有
+    if (project.property.valuationType === 'bill') {
+        let costGrowthRateV = $('#costGrowthRate').val(),
+            costGrowthRate = costGrowthRateV ? parseFloat(costGrowthRateV / 100) : 0,
+            growthPeriodV = $('#growthPeriod').val(),
+            growthPeriod = growthPeriodV ? parseFloat(growthPeriodV) : 0;
+        if (project.property.costGrowthRate !== costGrowthRate) {
+            properties['property.costGrowthRate'] = costGrowthRate;
+            project.property.costGrowthRate = costGrowthRate;
+            reCalcBills = true;
+        }
+        if (project.property.growthPeriod !== growthPeriod) {
+            properties['property.growthPeriod'] = growthPeriod;
+            project.property.growthPeriod = growthPeriod;
+            reCalcBills = true;
+        }
+    }
 
     //基本信息
     if(basicInfoView.toUpdate(basicInfoView.orgDatas, basicInfoView.datas)){
@@ -2559,9 +2484,6 @@ $('#property_ok').click(function () {
         };
     };
 
-    // for test.
-/*    console.log(mixDatas);
-    return; */
     function hasMixData() {
         return Object.keys(mixDatas.properties).length > 0 || mixDatas.options.updateData ||
             mixDatas.labourCoes.updateData || mixDatas.rations.length > 0 || mixDatas.bills.length > 0;
@@ -2575,6 +2497,8 @@ $('#property_ok').click(function () {
             if(mixDatas.properties.hasOwnProperty('property.billsCalcMode') ||
                 mixDatas.properties.hasOwnProperty('property.zanguCalcMode') ||
                 mixDatas.properties.hasOwnProperty('property.calcOptions')||
+                mixDatas.properties.hasOwnProperty('property.costGrowthRate')||
+                mixDatas.properties.hasOwnProperty('property.growthPeriod')||
                 mixDatas.properties.hasOwnProperty('property.billsQuantityDecimal')||
                 mixDatas.properties.hasOwnProperty('property.decimal')||
                 mixDatas.properties.hasOwnProperty('property.displaySetting')){
@@ -3304,8 +3228,10 @@ function changeCalcBaseFeeRate(toggle) {
         $('#calcBaseFeeRate').find('.modal-body').find('button:first').hide();
         $('#calcBaseFeeRate').find('.modal-body').find('ul:first').hide();
         $('#calcBaseExp').remove();
-        let $input = $('<input>').attr('id', 'calcBaseExp').addClass('form-control');
-        $('#expArea').prepend($input);
+        /*let $input = $('<input>').attr('id', 'calcBaseExp').addClass('form-control');
+        $('#expArea').prepend($input);*/
+        let $textarea = $('<textarea>').attr('id', 'calcBaseExp').prop('rows', 3).addClass('form-control').css('resize', 'none');
+        $('#expArea').prepend($textarea);
     }
     else if(toggle === 'feeRate'){
         $('#calcBaseFeeRate').find('.modal-header').show();

+ 22 - 71
web/building_saas/main/js/views/quantity_edit_view.js

@@ -54,7 +54,7 @@ let quantityEditObj = {
         $("#quantityEXPValue").val(strartString+value+endString);
         setCursor($("#quantityEXPValue")[0],startIndex+value.length);//设置回光标位置
     },
-    getQuantityEditCellType:function () {
+    getQuantityEditCellType:function () {//这个需配合整个表的selection change事件,当change的时候会repaint,按钮会显示
         var ns = GC.Spread.Sheets;
         function QuantityEditCellType() {
             var init=false;
@@ -62,17 +62,15 @@ let quantityEditObj = {
         }
         QuantityEditCellType.prototype = new ns.CellTypes.Text();
         QuantityEditCellType.prototype.paint = function (ctx, value, x, y, w, h, style, options) {
-            // if(value!=null){
-            // ctx.fillText(value,x+3+ctx.measureText(value).width,y+h-3);
-            // }
-            GC.Spread.Sheets.CellTypes.Text.prototype.paint.apply(this, arguments);
-            if(quantityEditObj.editingCell && !projectReadOnly){
-                if(quantityEditObj.editingCell.row==options.row&&quantityEditObj.editingCell.col==options.col){
+            if(!projectReadOnly){
+                if(options.sheet.getActiveRowIndex()==options.row&&options.sheet.getActiveColumnIndex()==options.col){
                     var image = document.getElementById('f_btn'),imageMagin = 3;
-                    var imageHeight = h-2*imageMagin;
-                    var imageWidth = w*2/7;
+                    var imageHeight = 15;
+                    var imageWidth = 25;
                     var imageX = x + w - imageWidth- imageMagin, imageY = y + h / 2 - imageHeight / 2;
                     ctx.save();
+                    ctx.fillStyle = style.backColor;
+                    ctx.fillRect(x,y,w,h);
                     ctx.drawImage(image, imageX, imageY,imageWidth,imageHeight);
                     ctx.beginPath();
                     ctx.arc(imageX+imageWidth/2,imageY+imageHeight/2,1,0,360,false);
@@ -82,9 +80,10 @@ let quantityEditObj = {
                     ctx.fill();//画实心圆
                     ctx.closePath();
                     ctx.restore();
+                    w = w - imageWidth - imageMagin;
                 }
             }
-
+            GC.Spread.Sheets.CellTypes.Text.prototype.paint.apply(this, arguments);
         };
         QuantityEditCellType.prototype.getHitInfo = function (x, y, cellStyle, cellRect, context) {
             return {
@@ -99,71 +98,18 @@ let quantityEditObj = {
         };
 
         //2018 -09 -26  修改工程量这个输入控件,删除悬浮提示注释,还原时通过git 历史
-
         QuantityEditCellType.prototype.processMouseDown = function (hitinfo) {
             let me=quantityEditObj;
-           /* if(isDoubleClick(this) == true && !projectReadOnly){//如果是双击,直接显示 2019-1-17 需求更改,取消双击弹出
-                me.showSelectModal(hitinfo);
-                return ;
-            }*/
-           if(me.editingCell && hitinfo.row==me.editingCell.row){
-               if(me.editingCell.isBtn == false){//是第一次点击,刷新显示按钮
-                   me.editingCell.isBtn = true;
-                   hitinfo.sheet.invalidateLayout();
-                   hitinfo.sheet.repaint();
-               }else {
-                   var offset=hitinfo.cellRect.x+hitinfo.cellRect.width-6;
-                   var imageMagin=3;
-                   var imageHeight = hitinfo.cellRect.height-2*imageMagin;
-                   var imageWidth = hitinfo.cellRect.width*2/7;
-                   if(hitinfo.x<offset&&hitinfo.x>offset-imageWidth){
-                       if(!projectReadOnly){
-                           me.showSelectModal(hitinfo);
-                       }
-                   }/*else {//点击其它地方,按钮消失
-                    hideButton(hitinfo)
-                    }*/
-               }
-            }
-        };
-        QuantityEditCellType.prototype.processMouseEnter = function (hitinfo) {
-            var me=quantityEditObj;
-            me.pmLeave = false;
-            if(me.editingCell==null){
-                me.editingCell={
-                    row:hitinfo.row,
-                    col:hitinfo.col,
-                    isBtn :false//鼠标刚进入的时候按钮还是没显示的状态
+            if(hitinfo.sheet.getActiveRowIndex()==hitinfo.row&&hitinfo.sheet.getActiveColumnIndex()==hitinfo.col){
+                var offset=hitinfo.cellRect.x+hitinfo.cellRect.width-6;
+                var imageWidth = 25;
+                if(hitinfo.x<offset&&hitinfo.x>offset-imageWidth){
+                    if(!projectReadOnly){
+                        me.showSelectModal(hitinfo);
+                    }
                 }
-               // hitinfo.sheet.invalidateLayout();
-                //hitinfo.sheet.repaint();
             }
         };
-        QuantityEditCellType.prototype.processMouseLeave = function (hitinfo) {
-            hideButton(hitinfo);
-        };
-
-        function hideButton(hitinfo) {
-            if(!quantityEditObj.pmLeave){//鼠标进入显示三个点按钮
-                quantityEditObj.editingCell=null;
-                hitinfo.sheet.invalidateLayout();
-                hitinfo.sheet.repaint();
-                quantityEditObj.pmLeave = true;
-            }
-        }
-
-        function isDoubleClick(quantityCell) {
-            let nowTime = +new Date();
-            if(quantityCell.clickTime !=0){
-                if(nowTime - quantityCell.clickTime < 280) {//判断为双击
-                    quantityCell.clickTime = 0;
-                    return true;
-                }
-            }
-            quantityCell.clickTime = nowTime;//计录点击时间
-            return false
-        }
-
         return new QuantityEditCellType();
     },
     showSelectModal:function (hitinfo) {
@@ -219,7 +165,12 @@ let quantityEditObj = {
         let evalString = quantityEXP;
         if( node.sourceType == ModuleNames.ration && quantityEXP.indexOf('QDL')!=-1){
             let billNode = node.parent;
-            let bQuantity = billNode.data.quantity?scMathUtil.roundForObj(billNode.data.quantity,getDecimal("quantity",billNode)):0;
+            let bQuantity = 0;
+            if(billNode.updateData.quantity){
+                bQuantity = scMathUtil.roundForObj(billNode.updateData.quantity,getDecimal("quantity",billNode));
+            }else {
+                bQuantity = billNode.data.quantity?scMathUtil.roundForObj(billNode.data.quantity,getDecimal("quantity",billNode)):0;
+            }
             evalString = replaceAll("QDL","("+bQuantity+")",evalString);
         }
         try {

+ 0 - 3
web/building_saas/main/js/views/side_tools.js

@@ -31,7 +31,6 @@ sideResizeEles.limit = {
 SlideResize.horizontalSlide(sideResizeEles.eleObj, sideResizeEles.limit, function(){
    // MaterialController.showReplaceDiv();
     subObj.initGljSubTab();
-    pageCCOprObj.resizeWidth();
     //BillsElf.setColumnWidthByRate();
     projectObj.refreshMainSpread();
     refreshSubSpread();
@@ -192,10 +191,8 @@ var sideToolsObj = {
             sideResizeEles.eleObj.right.css('width', '0%');
             tabPanel.hide();
         }
-        adaptiveTzjnrWidth();
         autoFlashHeight();
         subObj.initGljSubTab();
-        pageCCOprObj.resizeWidth();
         billsGuidance.refreshWorkBook();
         billsLibObj.refreshBillsSpread();
         refreshSubSpread();

+ 8 - 15
web/building_saas/main/js/views/std_billsGuidance_lib.js

@@ -14,7 +14,6 @@ let doAfterLoadGuidance = null;
 const billsGuidance = (function () {
     //更新类型
     const updateType = {update: 'update', create: 'create'};
-    let currentLib = null;
     //库类型
     const libType = {'guidance': 1, 'elf': 2}; //清单指引、清单精灵
     const libSel = $('#stdBillsGuidanceLibSelect');
@@ -39,7 +38,7 @@ const billsGuidance = (function () {
             headRowHeight: [40],
             defaultRowHeight: 21,
             cols: [{
-                width: 140,
+                width: 105,
                 readOnly: true,
                 showHint: true,
                 head: {
@@ -75,7 +74,7 @@ const billsGuidance = (function () {
                 }
             },
                {
-                width: 45,
+                width: 60,
                 readOnly: true,
                  head: {
                      titleNames: ["计量单位"],
@@ -95,9 +94,9 @@ const billsGuidance = (function () {
             ]
         },
         headers: [
-            {name: '项目编码', dataCode: 'code', width: 140, vAlign: 'center', hAlign: 'left', formatter: '@'},
+            {name: '项目编码', dataCode: 'code', width: 105, vAlign: 'center', hAlign: 'left', formatter: '@'},
             {name: '项目名称', dataCode: 'name', width: 190, vAlign: 'center', hAlign: 'left', formatter: '@'},
-            {name: '单位', dataCode: 'unit', width: 45, vAlign: 'center', hAlign: 'center', formatter: '@'},
+            {name: '单位', dataCode: 'unit', width: 60, vAlign: 'center', hAlign: 'center', formatter: '@'},
         ],
         rowHeaderWidth:1,
         events: {
@@ -920,13 +919,12 @@ const billsGuidance = (function () {
             }
         });
     }
-    //初始选择清单指引库
+    //初始选择标准清单
     //@param {Number}libID @return {void}
     function libInitSel(libID){
         //获取清单
         $.bootstrapLoading.start();
         CommonAjax.post('/billsGuidance/api/getLibWithBills', {libID: libID}, function(rstData){
-            currentLib = rstData.guidanceLib;
             if(guideItem.workBook){
                 guideItem.workBook.destroy();
                 guideItem.workBook = null;
@@ -944,7 +942,7 @@ const billsGuidance = (function () {
                 $.bootstrapLoading.end();
             };
             //获取清单库中的工作内容和项目特征
-            initJobAndCharacter(rstData.guidanceLib.billsLibId, callback);
+            initJobAndCharacter(libID, callback);
         }, function () {
             $.bootstrapLoading.end();
         });
@@ -977,12 +975,7 @@ const billsGuidance = (function () {
             $('#billsGuidance_items').height(height / 2);
         }
         let modules = [bills];
-        if(currentLib.type && currentLib.type === libType.elf){
-            modules.push(elfItem);
-        }
-        else {
-            modules.push(guideItem);
-        }
+        modules.push(elfItem);
         initWorkBooks(modules);
 
     }
@@ -1013,7 +1006,7 @@ const billsGuidance = (function () {
         //打开清单指引库
         $('#stdBillsGuidanceTab').click(function () {
             if(libSel.children().length === 0 && !$(this).hasClass('disabled')){
-                initLibs(projectInfoObj.projectInfo.engineeringInfo.billsGuidance_lib);
+                initLibs(projectInfoObj.projectInfo.engineeringInfo.bill_lib);
             }
         });
         //更改清单指引库

+ 0 - 2
web/building_saas/main/js/views/std_bills_lib.js

@@ -136,8 +136,6 @@ var billsLibObj = {
         if(node.parent && node.parent.data.recharge){
             node.data.comments = node.parent.data.recharge;
         }
-        //特征及内容转化
-        pageCCOprObj.setItemContentNode(node, this.getBillsJobs(stdBillsJobData, node), this.getBillsFeatures(stdBillsFeatureData, node), node.data.name);
         if (/\//.test(node.data.unit)) {
             let existB = projectObj.project.Bills.sameStdCodeBillsData(node.data.code);
             if (existB) {

+ 2 - 369
web/building_saas/main/js/views/sub_view.js

@@ -14,13 +14,6 @@ let subObj = {
     initSubSpread:function () {
         //清单精灵
         BillsElf.buildSheet();
-        contentOprObj.buildSheet($("#jobSpread")[0]);
-        //sheetCommonObj.bindEscKey(contentOprObj.workBook, [{sheet: contentOprObj.workBook.getSheet(0), editStarting: contentOprObj.onEditStart, editEnded: contentOprObj.onEditEnded}]);
-        sheetCommonObj.spreadDefaultStyle(contentOprObj.workBook);
-        characterOprObj.buildSheet($("#itemSpread")[0]);
-        //sheetCommonObj.bindEscKey(characterOprObj.workBook, [{sheet: characterOprObj.workBook.getSheet(0), editStarting: characterOprObj.onEditStart, editEnded: characterOprObj.onEditEnded}]);
-        sheetCommonObj.spreadDefaultStyle(characterOprObj.workBook);
-        $("#tzjnrCon").hide();
         $("#subSpread").show();
         subSpread = sheetCommonObj.createSpread($("#subSpread")[0], 4);
         sheetCommonObj.spreadDefaultStyle(subSpread);
@@ -28,8 +21,6 @@ let subObj = {
         subSpread.options.allowUserDragFill = false;
         subSpread.getSheet(2).name('JSCX');
 
-        pageCCOprObj.active = false;
-
         // 工料机
         gljOprObj.initSheet(subSpread.getSheet(0));
         //sheetCommonObj.shieldAllCells(subSpread.getSheet(0), gljOprObj.setting);
@@ -76,7 +67,6 @@ let subObj = {
             $("#ZMHS_div").show();
             $("#MBZM_div").show();
             installationFeeObj.engineeringTypeChecking();//检查是否安装工程
-            $("#TZJNR_div").hide();
   			$('#QDJL_div').hide();
             $("#linkGLJ").addClass();
             $(gljOprObj.rationTab).click();
@@ -85,7 +75,6 @@ let subObj = {
             $("#ZMHS_div").hide();
             $("#MBZM_div").hide();
             $("#AZZJF_div").hide();
-            $("#TZJNR_div").show();
             $('#QDJL_div').show();
             $(gljOprObj.billsTab).click();
         }
@@ -151,7 +140,6 @@ $("#linkGLJ").click(function(){
     $("#subSpread").show();
     $("#itemTextDiv").show();
     $("#gljItemTab").show();
-    pageCCOprObj.active = false;
     subSpread.options.allowUserDragFill = false;
     refreshSubSpread();
     subSpread.setActiveSheetIndex(0);
@@ -164,7 +152,6 @@ $("#linkAZZJF").click(function(){
     $("#subItems").children().hide();
     MaterialController.hideReplaceDiv();
     $("#subSpread").show();
-    pageCCOprObj.active = false;
     refreshSubSpread();
     subSpread.setActiveSheetIndex(3);
     gljOprObj.activeTab='#linkAZZJF';
@@ -176,7 +163,6 @@ $("#linkGCLMX").click(function(){
     MaterialController.hideReplaceDiv();
     $("#subSpread").show();
     subSpread.options.allowUserDragFill = true;
-    pageCCOprObj.active = false;
     refreshSubSpread();
     subSpread.setActiveSheetIndex(1);
     gljOprObj.activeTab='#linkGCLMX';
@@ -187,7 +173,6 @@ $("#linkJSCX").click(function(){        // 计算程序
     $("#subItems").children().hide();
     MaterialController.hideReplaceDiv();
     $("#subSpread").show();
-    pageCCOprObj.active = false;
     refreshSubSpread();
     subSpread.setActiveSheetIndex(2);
     calcProgramObj.initSheet(subSpread.getSheet(2));
@@ -206,7 +191,6 @@ $("#linkZMHS").click(function(){        // 子目换算
     $("#subItems").children().hide();
     $("#tabZMHS").show();
     zmhs_obj.loadSideResize();
-    pageCCOprObj.active = false;
     refreshSubSpread();
     gljOprObj.activeTab='#linkZMHS';
     gljOprObj.setNodeShowTab();
@@ -214,63 +198,11 @@ $("#linkZMHS").click(function(){        // 子目换算
 $("#linkMBZM").click(function(){        // 模板子目
     $("#subItems").children().hide();
     $("#tabMBZM").show();
-    pageCCOprObj.active = false;
     refreshSubSpread();
     gljOprObj.activeTab='#linkMBZM';
     gljOprObj.setNodeShowTab();
 });
 
-//特征及内容、工作内容与项目特征左右拖动
-let TZJNR_sideResizeEles = {};
-TZJNR_sideResizeEles.eleObj = {
-    module: 'tzjnr',
-    resize: $('#TZJNRResize'),
-    parent: $('#contentDiv'),
-    left: $('#jobDiv'),
-    right: $('#itemDiv')
-};
-TZJNR_sideResizeEles.limit = {
-    min: 100,
-    max: `$('#contentDiv').width()-100`
-};
-SlideResize.horizontalSlide(TZJNR_sideResizeEles.eleObj, TZJNR_sideResizeEles.limit, function () {
-    pageCCOprObj.resizeWidth();
-    refreshSubSpread();
-});
-
-//刷新特征内容与添加规则宽度
-function initTznrWidth(){
-    //特征及内容总宽度
-    let totalWidth = $('#tzjnrCon').width();
-    //特征及内容和排版规则比例
-    const typeSettingWidth = 30;//排版规则工具条
-    let addRuleVisible = $('#add-rule').is(':visible'),
-        addRulePercent = '33.3%',
-        contentPercent = '66.7%';
-    //排版规则没显示,则排版规则工具条固定30px转换百分比
-    if (!addRuleVisible) {
-        addRulePercent = typeSettingWidth / totalWidth;
-        contentPercent = 1 - addRulePercent;
-        addRulePercent = addRulePercent * 100 + '%';
-        contentPercent = contentPercent * 100 + '%';
-    }
-    //设置特征及内容与排版规则的比例
-    $('#contentDiv').css('width', contentPercent);
-    $('#ruleDiv').css('width', addRulePercent);
-}
-
-//特征及内容各模块宽度自适应
-function adaptiveTzjnrWidth() {
-    if(gljOprObj.activeTab !== '#linkTZJNR'){
-        return;
-    }
-    initTznrWidth();
-    //加载特征及内容里,工作内容和项目特征的比例
-    SlideResize.loadHorizonWidth(TZJNR_sideResizeEles.eleObj.module, [TZJNR_sideResizeEles.eleObj.resize],
-        [TZJNR_sideResizeEles.eleObj.left, TZJNR_sideResizeEles.eleObj.right]);
-    pageCCOprObj.resizeWidth();
-    refreshSubSpread();
-}
 //清单精灵
 $('#linkQDJL').click(function () {
     gljOprObj.activeTab='#linkQDJL';
@@ -283,36 +215,6 @@ $('#linkQDJL').click(function () {
     BillsElf.refreshWorkBook();
 
 });
-//特征及内容
-$("#linkTZJNR").click(function () {
-    gljOprObj.activeTab='#linkTZJNR';
-    $("#subItems").children().hide();
-    $("#tzjnrCon").show();
-    $("#add-rule p").not(":first").css('margin-bottom', 4);
-    pageCCOprObj.active = true;
-    adaptiveTzjnrWidth();
-    contentOprObj.workBook.getActiveSheet().showColumn(0, GC.Spread.Sheets.HorizontalPosition.left);
-    characterOprObj.workBook.getActiveSheet().showColumn(0, GC.Spread.Sheets.HorizontalPosition.left);
-    let selectedNode = projectObj.mainController.tree.selected;
-    if (projectObj.project.property.addRule !== undefined) {
-        setRule(projectObj.project.property.addRule);
-    }
-    pageCCOprObj.mainActiveCell = projectObj.mainSpread.getActiveSheet().getSelections()[0];
-    pageCCOprObj.setCacheAndShow(selectedNode);
-    gljOprObj.setNodeShowTab();
-});
-//打开排版规则
-$('#openTypeSetting').click(function () {
-    $('#add-rule').show();
-    $(this).hide();
-    adaptiveTzjnrWidth();
-});
-//关闭排版规则
-$('#closeTypeSetting').click(function () {
-    $('#add-rule').hide();
-    $('#openTypeSetting').show();
-    adaptiveTzjnrWidth();
-});
 
 //应用到选中清单、应用到所有,添加位置列如果隐藏了,则重新显示
 function colSettingAddPosition(addPosition){
@@ -348,270 +250,6 @@ function colSettingAddPosition(addPosition){
     }
 }
 
-//如果,添加内容为定额子目时进行定额的增删改,更新相关其清单
-function updateBillsOprRation() {
-    const setting = getAddRuleSetting();
-    if(setting && setting.addContent && setting.addContent === '5'){
-        $('#use-to-current').click();
-    }
-}
-
-// 应用到选中清单
-let isSaving = false;
-$("#use-to-current").click(function() {
-    if($(this).hasClass('disabled')){
-        return false;
-    }
-    if(projectReadOnly){
-        return false;
-    }
-    if (isSaving) {
-        return false;
-    }
-    const setting = getAddRuleSetting();
-    colSettingAddPosition(setting.position);
-    isSaving = true;
-    const self = $(this);
-    self.attr('disabled', 'disabled');
-    let selectedNode = projectObj.mainController.tree.selected;
-    function findBill(node){
-        while(node && node.sourceType !== projectObj.project.Bills.getSourceType()){
-            node = node.parent;
-        }
-        return node;
-    }
-    let billsNode = findBill(selectedNode);
-    // 操作内容
-    pageCCOprObj.setCharacterBySetting(billsNode, setting);
-
-    // 防止连续点击1秒后才能再次发起请求
-    setTimeout(function() {
-        isSaving = false;
-        self.removeAttr('disabled');
-    }, 1000);
-});
-//todo: 优化成批量
-function addRuleUseToBills(setting, nodes) {
-    pageCCOprObj.bulkSetCharacterBySetting(nodes, setting);
-}
-// 应用到所有的清单
-$("#use-to-all").click(function() {
-    if($(this).hasClass('disabled')){
-        return false;
-    }
-    if(projectReadOnly){
-        return false;
-    }
-    let treeNode = projectObj.mainController.tree;
-    const setting = getAddRuleSetting();
-    colSettingAddPosition(setting.position);
-    if (treeNode.items === undefined || treeNode.items.length <= 0) {
-        return false;
-    }
-    // 处理
-    addRuleUseToBills(setting, treeNode.items);
-});
-
-function saveAddRule(){
-    let setting = getAddRuleSetting();
-    let toUpdate = false;
-    if(!projectObj.project.property.addRule){
-        toUpdate = true;
-    }
-    else {
-        for(let attr in setting){
-            if(setting[attr] !== projectObj.project.property.addRule[attr]){
-                toUpdate = true;
-                break;
-            }
-        }
-    }
-    if(toUpdate){
-        projectObj.project.property.addRule = setting;
-        projectObj.project.saveProperty('addRule', setting);
-    }
-}
-
-// 添加位置选择
-function changeAddPosition(save = false) {
-    const selected = $('#add-position').children(":selected").val();
-    const addContentEle = $("#add-content");
-    const displayFormatEle = $("#display-format");
-    const characterFormatEle = $("#character-format");
-    const serialTypeEle = $("#serial-type");
-    switch (selected) {
-        case '4':
-            // 分别添加到对应列
-            // 当“添加位置”是“分别添加到对应列”,则“添加内容”恢复默认“无”,且灰显;“显示格式”恢复默认“换行分隔”,且灰显。
-            addContentEle.val('');
-            addContentEle.attr('disabled', 'disabled');
-            displayFormatEle.val(1);
-            characterFormatEle.val(2);
-            serialTypeEle.val(1);
-            break;
-        default:
-            addContentEle.removeAttr('disabled');
-            displayFormatEle.removeAttr('disabled');
-            characterFormatEle.removeAttr('disabled');
-            addContentEle.val(1);
-            break;
-    }
-    if (save) {
-        saveAddRule();
-    }
-}
-$("#add-position").change(function() {
-    changeAddPosition(true);
-});
-// 添加内容选择
-function changeAddContent(save = false) {
-    const selected = $('#add-content').children(":selected").val();
-    const characterFormatEle = $("#character-format");
-    const childDisplayFormatEle = $("#child-display-format");
-    const serialTypeEle = $("#serial-type");
-
-    switch (selected) {
-        case '5':
-            // 当“添加内容”是“定额子目”或“工作内容”,则“特征生成方式”灰显,不需选择;否则有效可选。
-            characterFormatEle.attr('disabled', 'disabled');
-            characterFormatEle.val(2);
-            // 当“添加内容”是“定额子目”,则“子目生成方式”有效可选;否则灰显,不需选择。
-            childDisplayFormatEle.removeAttr('disabled');
-            serialTypeEle.val('');
-            serialTypeEle.attr('disabled', 'disabled');
-            break;
-        case '':
-            characterFormatEle.attr('disabled', 'disabled');
-            break;
-        case '1':
-        case '2':
-        case '3':
-            characterFormatEle.removeAttr('disabled');
-            if (serialTypeEle.val() === '') {
-                serialTypeEle.val(1);
-            }
-            serialTypeEle.removeAttr('disabled');
-            childDisplayFormatEle.attr('disabled', 'disabled');
-            break;
-        case '4':
-            // 当“添加内容”是“定额子目”或“工作内容”,则“特征生成方式”灰显,不需选择;否则有效可选。
-            characterFormatEle.attr('disabled', 'disabled');
-            characterFormatEle.val(2);
-        default:
-            serialTypeEle.removeAttr('disabled');
-            if (serialTypeEle.val() === '') {
-                serialTypeEle.val(1);
-            }
-            childDisplayFormatEle.attr('disabled', 'disabled');
-            break;
-    }
-    if (save) {
-        saveAddRule();
-    }
-}
-$("#add-content").change(function() {
-    changeAddContent(true);
-});
-
-//显示格式
-$('#display-format').change(function () {
-    saveAddRule();
-});
-
-//特征生成方式
-$('#character-format').change(function () {
-    saveAddRule();
-});
-
-// 子目生成方式选择事件
-function changeChildDisplay(save = false) {
-    const selected = $('#child-display-format').children(":selected").val();
-    const serialTypeEle = $("#serial-type");
-    const addContent = $('#add-content').val();
-    // 如果添加内容是定额子目且子目生成方式是编号+定额名称则序号格式不能选择
-    if (addContent === '5' && selected === '1') {
-        // 默认选中数字显示模式
-        serialTypeEle.val("");
-        serialTypeEle.attr('disabled', 'disabled');
-    } else {
-        serialTypeEle.val(1);
-        serialTypeEle.removeAttr('disabled');
-    }
-    if (save) {
-        saveAddRule();
-    }
-
-}
-$("#child-display-format").change(function() {
-    changeChildDisplay(true);
-});
-
-//序号格式
-$('#serial-type').change(function () {
-    saveAddRule();
-});
-
-/**
- * 获取添加规则的设置
- *
- * @return {Object} - 返回设置内容
- */
-function getAddRuleSetting() {
-    // 添加位置
-    const position = $("#add-position").val();
-    // 添加内容
-    const addContent = $("#add-content").val();
-    // 显示格式
-    const displayFormat = $("#display-format").val();
-    // 特征生成方式
-    const characterFormat = $("#character-format").val();
-    // 子目生成方式
-    const childDisplayFormat = $("#child-display-format").val();
-
-    // 序号格式
-    const serialType = $("#serial-type").val();
-    const setting = {
-        serialType,
-        characterFormat,
-        addContent,
-        position,
-        displayFormat,
-        childDisplayFormat,
-    };
-
-    return setting;
-}
-
-/**
- * 根据配置设置规则
- *
- * @param {Object} setting - 数据库中读取的数据
- * @return {void}
- */
-function setRule(setting) {
-    if (Object.keys(setting).length <= 0) {
-        return;
-    }
-    $("#add-position").val(setting.position);
-    changeAddPosition(false);
-
-    $("#add-content").val(setting.addContent);
-    changeAddContent(false);
-
-    $("#display-format").val(setting.displayFormat);
-
-    $("#character-format").val(setting.characterFormat);
-
-    $("#child-display-format").val(setting.childDisplayFormat);
-    changeChildDisplay(false);
-
-    $("#serial-type").val(setting.serialType);
-
-    if(projectReadOnly){
-        disableTools();
-    }
-}
-
 function activeSubSheetIs(idx){
     let rst = subSpread.getActiveSheetIndex() == idx;
     return rst;
@@ -623,13 +261,8 @@ function activeSubSheetIsCalcProgram(){
 
 //弹出清单规则或定额库后导致subSpread和特征及内容spread显示出问题
 function refreshSubSpread(){
-    if(pageCCOprObj.active){
-        contentOprObj.workBook.refresh();
-        characterOprObj.workBook.refresh();
-    } else{
-        if(subSpread) subSpread.refresh();
-        if(MaterialController.spread) MaterialController.spread.refresh();
-    }
+    if(subSpread) subSpread.refresh();
+    if(MaterialController.spread) MaterialController.spread.refresh();
     BillsElf.refreshWorkBook();
     //if($('#linkZMHS').hasClass('active')) zmhs_obj.refresh();
     if($('#rnc-zm').is(':visible')|| $('#rnc-fz').is(':visible')) zmhs_obj.refresh();

+ 4 - 3
web/building_saas/pm/js/pm_newMain.js

@@ -574,6 +574,9 @@ const projTreeObj = {
             }
         }
     },
+    cusButtonClick:async function(info){
+        projTreeObj.changeFileClick(null,info);
+    },
     onDragDropBlock : function (sender,args) {//拖动移动项目位置
         let selected = projTreeObj.tree.selected;
         let targetNode = projTreeObj.tree.items[args.toRow];
@@ -1047,8 +1050,7 @@ const projTreeObj = {
                     me.setCellValue({row: i, col: j}, nodes[i],sheet,setting);
                     let dataCode = headers[j].dataCode;
                     if(nodes[i].data.projType == "Tender" && (dataCode=="feeRateFile" || dataCode == "unitPriceFile")) {
-                        sheet.setCellType(i, j,sheetCommonObj.getSelectButton(headers[j].width),GC.Spread.Sheets.SheetArea.viewport);
-                        sheet.getCell(i, j,GC.Spread.Sheets.SheetArea.viewport).locked(false);
+                        sheet.setCellType(i, j,sheetCommonObj.getCusButtonCellType(me.cusButtonClick,false),GC.Spread.Sheets.SheetArea.viewport);
                     }
                     //sheet.setValue(i, j, nodes[i]['data'][dataCode]);
                 }
@@ -2524,7 +2526,6 @@ function AddTender() {
         }
         let unitPriceFileObj = getAddTenderFile(tenderName, $('#unit-price'), $("#unit-price").children());
         let feeFileObj = getAddTenderFile(tenderName, $('#tender-fee-rate'), $("#tender-fee-rate").children());
-
         let valuation = $("#valuation").val();
         /*if(!valuation || valuation === ''){
             setDangerInfo($('#valuation-info'), '请选择计价规则');

+ 1 - 0
web/common/html/header.html

@@ -1,3 +1,4 @@
+<img id="f_btn" src="/web/dest/css/img/feeRate_btn.jpg" alt="" style="display: none" />
 <nav class="navbar navbar-expand-lg p-0 d-flex">
     <% if(controller === 'boot' || controller === 'pm'){ %>
     <!--<a style="text-decoration: none" href="javascript:void(0);" class="header-logo">-->

+ 1 - 1
web/users/html/login.html

@@ -43,7 +43,7 @@
         <div class="modal-dialog modal-lg" role="document">
             <div class="modal-content">
                 <div class="modal-header">
-                    <h5 class="modal-title">选择费用定额</h5>
+                    <h5 class="modal-title">选择编制办法</h5>
                     <p class="m-0 text-warning"><i class="fa fa-exclamation-triangle"></i> <b>登录设置</b> 中可以修改您的登录习惯。</p>
                 </div>
                 <div class="modal-body">

+ 4 - 4
web/users/html/user-set.html

@@ -44,7 +44,7 @@
                         <legend class="my-3">登录设置</legend>
                         <form method="post" action="/user/save-preferences">
                             <div class="form-group">
-                                <label class="form-control-label">登录时选择费用定额</label>
+                                <label class="form-control-label">登录时选择编制办法</label>
                                 <div class="form-control">
                                     <div class="form-check form-check-inline">
                                       <input name="login_ask" type="radio" class="form-check-input" value="1"
@@ -54,14 +54,14 @@
                                     <div class="form-check form-check-inline">
                                       <input name="login_ask" type="radio" class="form-check-input" value="0"
                                         <% if(preferenceSetting.login_ask === 0) { %>checked="checked" <% } %>>
-                                      <span class="form-check-label">指定费用定额</span>
+                                      <span class="form-check-label">指定编制办法</span>
                                     </div>
                                 </div>
                             </div>
                             <div class="form-group">
-                                <label class="form-control-label">指定费用定额</label>
+                                <label class="form-control-label">指定编制办法</label>
                                 <select class="form-control" name="select_version">
-                                    <option value="">请选择费用定额</option>
+                                    <option value="">请选择编制办法</option>
                                     <% if (compilationList.length > 0) {%>
                                     <% compilationList.forEach(function(compilation) { %>
                                     <option value="<%= compilation._id %>" <% if(preferenceSetting.select_version === compilation._id.toString()) { %>selected="selected" <% } %>><%= compilation.name %></option>