zhangweicheng 5 vuotta sitten
vanhempi
commit
c35bc6156d

+ 99 - 70
modules/all_models/bills.js

@@ -6,76 +6,105 @@ let subSchema = require("../all_schemas/bills_sub_schemas");
 let deleteSchema = require('../all_schemas/delete_schema');
 let Schema = mongoose.Schema;
 let billsSchema = new Schema({
-    ID: {type: String, index: true},
-    ParentID: String,
-    NextSiblingID: String,
-    projectID:{type: Number, index: true} ,
-    serialNo: Number,
-    chapterID: Number,
-    billsLibId: Number,
-    code: String,
-    fullCode: String,
-    type:{type: Number,default:4},//1 :大项费用 2:分部 3分项 4清单;5补项
-    isAdd:{type: Number,default:0},//1 true 0 false是否新增
-    name: String,
-    unit: String,
-    quantity: String, // Decimal
-    quantity2:String,//预算项目中的数量2
-    quantityEXP:String,//工程量表达式
-    feeRateID:Number,
-    feeRate:String,
-    isFromDetail:{type: Number,default:0},//1 true 0 false
-    programID: Number,
-    calcBase: String,
-    calcBaseValue: String,     // 计算基数表达式的值
-    tenderCalcBaseValue: String,     // 调价后计算基数表达式的值
-    baseProgressiveFee: String, // 累进计算中的基准值(报表需要这个中间值)
-    // 工程量计算规则
-    ruleText: String,
-    // 说明
-    comments: String,
-    // 调价
-    xs_Labour: String, // Decimal
-    xs_Material: String, // Decimal
-    xs_Machine: String, // Decimal
-    xs_FeeRate: String, // Decimal
-    xs_LabourPrice: String, // Decimal
-    xs_MaterialPrice: String, // Decimal
-    xs_MachinePrice: String, // Decimal
-    isTender_Labour: Boolean,
-    isTender_Material: Boolean,
-    isTender_Machine: Boolean,
-    targetUnitFee:String,//目标单价
-    targetTotalFee:String,//目标合价
-    //工作内容//zhong 2017-8-31
-    jobContentText: String, //清单工作内容列显示文本, 减少第一次拉数据时的循环次数
-    jobContent: [subSchema.jobContentSchema],
-    //项目特征
-    itemCharacterText: String,//清单项目特征列显示文本
-    itemCharacter: [subSchema.itemCharacterSchema],
-    // 费用字段
-    fees: [subSchema.feesSchema],
-    // 标记字段
-    flags: [subSchema.flagsSchema],
-    //消耗量调整系数字段
-    quantityCoe:subSchema.quantityCoeSchema,
-    //子目工程量调整系数
-    rationQuantityCoe:String,
-    // 不调价
-    is_adjust_price: {type: Number,default: 0},
-    installationKey:String,//用来记录安装增加费的关联字段
-    deleteInfo: deleteSchema,
-    isEstimate:{type: Number,default:0},       // 1 true 0 false 是否暂估
-    unitPriceAnalysis: { type: Number, default: 0 },       // 1 true 0 false 单价分析
-    lockUnitPrice:{type: Number,default:0},       // 1 true 0 false 锁定综合单价,true 为锁定
-    specialProvisional:String,
-    remark:String,
-    engineeringContent:String,//工程内容
-    serviceContent:String,//服务内容
-    claimVisa:String,//签证及索赔依据
-    calcFlag: {type: Number},    // 叶子清单的计算类型。末定义:按定额计算。1:用户输入金额。2:用户输入单价。3:用户输入设计单价。
-    bookmarkBackground:String,//书签背景色
-    bookmarkAnnotation:String//批注
+  ID: {
+    type: String,
+    index: true
+  },
+  ParentID: String,
+  NextSiblingID: String,
+  projectID: {
+    type: Number,
+    index: true
+  },
+  serialNo: Number,
+  chapterID: Number,
+  billsLibId: Number,
+  code: String,
+  fullCode: String,
+  type: {
+    type: Number,
+    default: 4
+  }, //1 :大项费用 2:分部 3分项 4清单;5补项
+  isAdd: {
+    type: Number,
+    default: 0
+  }, //1 true 0 false是否新增
+  name: String,
+  unit: String,
+  quantity: String, // Decimal
+  quantity2: String, //预算项目中的数量2
+  quantityEXP: String, //工程量表达式
+  feeRateID: Number,
+  feeRate: String,
+  isFromDetail: {
+    type: Number,
+    default: 0
+  }, //1 true 0 false
+  programID: Number,
+  calcBase: String,
+  calcBaseValue: String, // 计算基数表达式的值
+  tenderCalcBaseValue: String, // 调价后计算基数表达式的值
+  baseProgressiveFee: String, // 累进计算中的基准值(报表需要这个中间值)
+  // 工程量计算规则
+  ruleText: String,
+  // 说明
+  comments: String,
+  // 调价
+  xs_Labour: String, // Decimal
+  xs_Material: String, // Decimal
+  xs_Machine: String, // Decimal
+  xs_FeeRate: String, // Decimal
+  xs_LabourPrice: String, // Decimal
+  xs_MaterialPrice: String, // Decimal
+  xs_MachinePrice: String, // Decimal
+  isTender_Labour: Boolean,
+  isTender_Material: Boolean,
+  isTender_Machine: Boolean,
+  targetUnitFee: String, //目标单价
+  targetTotalFee: String, //目标合价
+  //工作内容//zhong 2017-8-31
+  jobContentText: String, //清单工作内容列显示文本, 减少第一次拉数据时的循环次数
+  jobContent: [subSchema.jobContentSchema],
+  //项目特征
+  itemCharacterText: String, //清单项目特征列显示文本
+  itemCharacter: [subSchema.itemCharacterSchema],
+  // 费用字段
+  fees: [subSchema.feesSchema],
+  // 标记字段
+  flags: [subSchema.flagsSchema],
+  //消耗量调整系数字段
+  quantityCoe: subSchema.quantityCoeSchema,
+  //子目工程量调整系数
+  rationQuantityCoe: String,
+  // 不调价
+  is_adjust_price: {
+    type: Number,
+    default: 0
+  },
+  installationKey: String, //用来记录安装增加费的关联字段
+  deleteInfo: deleteSchema,
+  isEstimate: {
+    type: Number,
+    default: 0
+  }, // 1 true 0 false 是否暂估
+  lockUnitPrice: {
+    type: Schema.Types.Mixed,
+    default: false
+  }, //  true  false 锁定综合单价,true 为锁定
+  unitPriceAnalysis: {
+    type: Number,
+    default: 0
+  }, // 1 true 0 false 单价分析
+  specialProvisional: String,
+  remark: String,
+  engineeringContent: String, //工程内容
+  serviceContent: String, //服务内容
+  claimVisa: String, //签证及索赔依据
+  calcFlag: {
+    type: Number
+  }, // 叶子清单的计算类型。末定义:按定额计算。1:用户输入金额。2:用户输入单价。3:用户输入设计单价。
+  bookmarkBackground: String, //书签背景色
+  bookmarkAnnotation: String //批注
 });
 
 mongoose.model("bills", billsSchema);

+ 1 - 1
modules/all_models/stdRation_ration.js

@@ -40,7 +40,7 @@ const rationItemSchema = new Schema({
     sectionId: {type: Number,index: true},
     rationRepId: Number,
     caption: String,
-    feeType: Number,
+    feeType: String,
     jobContent: String,
     annotation: String,
     rationGljList: [rationGljItemSchema],

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

@@ -336,7 +336,7 @@ var sheetCommonObj = {
                 break;
         }
         return result;
-    },
+  },
     analyzePasteData: function (setting, pastedInfo) {
         var rst = [], propId = pastedInfo.cellRange.col, preStrIdx = 0, itemObj = {};//propId = 0 to proId = pastedInfo.cellRange.col, update by zhong
         for (var i = 0; i < pastedInfo.pasteData.text.length; i++) {
@@ -399,6 +399,11 @@ var sheetCommonObj = {
         sheet.getCell(row, col).hAlign(GC.Spread.Sheets.HorizontalAlign.center);
 
     },
+    getCheckBox(threeState = false) {
+      var c = new GC.Spread.Sheets.CellTypes.CheckBox();
+      c.isThreeState(threeState);
+      return c
+    },
     setComboBox(row, col, sheet, options, editorValueType, editable, maxDropDownItems) {
         //let combo = new GC.Spread.Sheets.CellTypes.ComboBox();
         let dynamicCombo = sheetCommonObj.getDynamicCombo(true);

+ 67 - 0
web/building_saas/main/js/models/project.js

@@ -453,6 +453,73 @@ var PROJECT = {
                 }
             })
         };
+        project.prototype.updateCasCadeBills = function(node,newval,fieldName,needSetParent = true){
+          let datas = [];
+          let data =  {
+              type:node.sourceType,
+              data:{ID:node.data.ID}
+          };
+          setData(data.data,newval,fieldName);
+          datas.push(data);
+          setChildren(node,newval,datas);//同步设置所有子项
+          if(needSetParent) setParent(node,newval,datas);//设置父节点
+          $.bootstrapLoading.start();
+          this.updateNodes(datas,function () {
+              let nodes = [];
+              for(let d of datas){
+                  let node = projectObj.project.mainTree.findNode(d.data.ID);
+                  if(node){
+                      for(let key in d.data){
+                          if(key == 'ID') continue;
+                          node.data[key] = d.data[key];
+                      }
+                      nodes.push(node)
+                  }
+              }
+            projectObj.mainController.refreshTreeNode(nodes);
+            //取消锁定,则自动重新计算。
+            if(fieldName == "lockUnitPrice" && newval == false) projectObj.project.calcProgram.calcAllNodesAndSave();
+              $.bootstrapLoading.end();
+          });
+
+          function setChildren(pnode,newValue,datas) {//同步设置所有子项
+              if(pnode.children.length > 0 && pnode.children[0].sourceType == ModuleNames.bills){//设置子项不包括定额
+                  for(let c of pnode.children){
+                      let data =  {
+                          type:c.sourceType,
+                          data:{ID:c.data.ID}
+                      };
+                      setData(data.data,newval,fieldName);
+                      datas.push(data);
+                      setChildren(c,newValue,datas)
+                  }
+              }
+          }
+          function setParent(cnode,newValue,datas) {
+              let diferrent = false;
+              if(cnode.parent && !projectObj.project.Bills.isMeasureNode(cnode.parent)){//排除措施项目节点
+                  for(b of cnode.parent.children){
+                      if(b == cnode) continue
+                      if(b.data[fieldName]!== newValue){//有兄弟节点的值和本节点不一样,则父节点设置为null
+                          diferrent = true;
+                          break;
+                      }
+                  }
+                  let pvalue = diferrent === true?null:newValue;
+                  let data =  {
+                      type:cnode.parent.sourceType,
+                      data:{ID:cnode.parent.data.ID}
+                  };
+                  setData(data.data,pvalue,fieldName);
+                  datas.push(data);
+                  setParent(cnode.parent,pvalue,datas);
+              }
+          }
+          function setData(data,avalue,fieldName) {
+              data[fieldName] = avalue;
+              if(fieldName == "outPutMaxPrice") data.maxPrice = null;
+          }
+      };
         project.prototype.syncUpdateNodesAndRefresh =async function (datas) {
           let me = this;
           return new Promise(function (resolve, reject) {

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

@@ -358,7 +358,11 @@ let MainTreeCol = {
         },
         unitPriceAnalysis:function (node) {
             if(node.sourceType == ModuleNames.bills) return new GC.Spread.Sheets.CellTypes.CheckBox();
-        },
+      },
+      lockUnitPrice: function (node) {
+        //仅未使用基数计算的清单有效
+        if(!(node.data.calcBase&&node.data.calcBase!="")) return sheetCommonObj.getCheckBox();
+    },
         evaluationProject:function (node) {
             if(node.sourceType == ModuleNames.ration) return new GC.Spread.Sheets.CellTypes.CheckBox();
         },

+ 14 - 2
web/building_saas/main/js/views/project_view.js

@@ -1870,7 +1870,9 @@ var projectObj = {
             projectObj.onEvaluationProjectClic(node,info);
         }else if(fieldName == "unitPriceAnalysis"){
             projectObj.onUnitPriceAnalysisClick(node,info);
-        }
+        }else if(fieldName == "lockUnitPrice"){
+          projectObj.onCasCadeButtonClick(node,info,fieldName);
+      }
     },
     onEvaluationProjectClic:function (node,info) {
         let checkboxValue = info.sheet.getCell(info.row, info.col).value();
@@ -1941,7 +1943,17 @@ var projectObj = {
              };
              return data;
          }
-    },
+  },
+  onCasCadeButtonClick:function (node,info,fieldName) {
+    let checkboxValue = info.sheet.getCell(info.row, info.col).value();
+    let cell = info.sheet.getCell(info.row, info.col), newval = true;
+    if (checkboxValue == true) {
+        newval = false;
+    } else {
+        newval = true;
+    }
+    projectObj.project.updateCasCadeBills(node,newval,fieldName,fieldName != "lockUnitPrice");
+  },
     onSubcontractClick:function (node) {//点击分包费checkbox
         if (node.updateData.isSubcontract) node.updateData.isSubcontract = false;
         else node.updateData.isSubcontract = true;