Преглед изворни кода

造价书-添加新的字段

zhangweicheng пре 7 година
родитељ
комит
11a3094d85

+ 1 - 0
modules/all_models/bills.js

@@ -64,6 +64,7 @@ let billsSchema = new Schema({
     installationKey:String,//用来记录安装增加费的关联字段
     deleteInfo: deleteSchema,
     isEstimate:{type: Number,default:0},       // 1 true 0 false 是否暂估
+    specialProvisional:String,
     remark:String,
     engineeringContent:String,//工程内容
     serviceContent:String,//服务内容

+ 11 - 9
modules/main/facade/labour_coe_facade.js

@@ -62,15 +62,17 @@ function getData(projectID, callback) {
             if (!datas) {
                 logger.info(`Create a LabourCoe file for old project : ${projectID}`);
                 getStdLabourCoe(1).then(function (stdLC) {
-                    let doc = {
-                        ID: uuidV1(),
-                        projectID: projectID,
-                        name: '[旧项目补人工系数文件]',
-                        libID: stdLC.ID,
-                        libName: stdLC.libName,
-                        coes: stdLC.coes
-                    };
-                    projectLabourCoesModel.create(doc);
+                    if(stdLC){
+                        let doc = {
+                            ID: uuidV1(),
+                            projectID: projectID,
+                            name: '[旧项目补人工系数文件]',
+                            libID: stdLC.ID,
+                            libName: stdLC.libName,
+                            coes: stdLC.coes
+                        };
+                        projectLabourCoesModel.create(doc);
+                    }
                     callback(0, projectConsts.LABOUR_COE, stdLC);
                 });
             } else {

+ 21 - 3
public/counter/counter.js

@@ -33,14 +33,21 @@ var counterDAO = function(){};
  *     result.value.sequence_value Ϊ�޸ĺ��id
  * }
  */
-counterDAO.prototype.getIDAfterCount = function(moduleName, stepCount, callback) {
+counterDAO.prototype.getIDAfterCount =async function(moduleName, stepCount, callback) {
     var sc = stepCount;
     if (isNaN(stepCount) || (stepCount < 0)) {
         sc = 1;
     } else if (!(/^-?\d+$/.test(stepCount))) {
         sc = Math.round(stepCount + 0.5);
     }
-    counterModel.findOneAndUpdate({_id: moduleName}, { $inc: { sequence_value: sc } }, {'new':true}, callback);//findOneAndUpdate
+    if (callback === null) {
+        let result = await counterModel.findOneAndUpdate({_id: moduleName}, { $inc: { sequence_value: sc } }, {'new':true});
+        return await checkIDResult(result,moduleName,null)
+    } else {
+        counterModel.findOneAndUpdate({_id: moduleName}, { $inc: { sequence_value: sc } }, {'new':true}, function (err,result) {
+            checkIDResult(result,moduleName,callback,err)
+        });
+    }
 }
 
 counterDAO.prototype.getIDAfterCountSync = async function (moduleName, stepCount) {
@@ -50,9 +57,20 @@ counterDAO.prototype.getIDAfterCountSync = async function (moduleName, stepCount
     } else if (!(/^-?\d+$/.test(stepCount))) {
         sc = Math.round(stepCount + 0.5);
     }
-    return await counterModel.findOneAndUpdate({_id: moduleName}, { $inc: { sequence_value: sc } }, {'new':true});//findOneAndUpdate
+    let result = await counterModel.findOneAndUpdate({_id: moduleName}, { $inc: { sequence_value: sc } }, {'new':true});
+    return await checkIDResult(result,moduleName,null)
 };
 
+async function checkIDResult(result,moduleName,callback,err){
+    if(result){
+        return callback?callback(err,result):result;
+    }else {
+        return callback?counterModel.create({_id: moduleName,sequence_value:1},callback): await counterModel.create({_id: moduleName,sequence_value:1});
+    }
+
+}
+
+
 counterDAO.prototype.getCurrentID = function(moduleName, callback) {
     if (callback) {
         counterModel.findOne({_id: moduleName}).exec()

+ 2 - 1
web/building_saas/main/js/models/calc_program.js

@@ -701,7 +701,8 @@ let calcTools = {
             rationQuantityCoe: treeNode.data.rationQuantityCoe,
             quantityCoe: treeNode.data.quantityCoe == null ? {} : treeNode.data.quantityCoe,
             targetUnitFee: treeNode.data.targetUnitFee,
-            targetTotalFee: treeNode.data.targetTotalFee
+            targetTotalFee: treeNode.data.targetTotalFee,
+            specialProvisional:treeNode.data.specialProvisional
         };
 
         // 定额大类

+ 11 - 0
web/building_saas/main/js/views/main_tree_col.js

@@ -171,6 +171,9 @@ let MainTreeCol = {
         glj: function (node) {
             return node.sourceType == projectObj.project.ration_glj.getSourceType();
         },
+        specialProvisional:function (node) {
+            return !(node.sourceType == ModuleNames.bills && node.source.children.length == 0)
+        },
         volumePrice: function (node) {
             return (node.data.type == rationType.volumePrice || node.data.type == rationType.gljRation);
         },
@@ -352,6 +355,14 @@ let MainTreeCol = {
         },
         commonTotalFee: function () {
             return projectObj.getCommonTotalFeeCellType();
+        },
+        specialProvisional: function (node) {
+            if(!MainTreeCol.readOnly.specialProvisional(node)){
+                let dynamicCombo = sheetCommonObj.getDynamicCombo();
+                dynamicCombo.items(["材料","工程设备","专业工程",""]);
+                return dynamicCombo;
+            }
+
         }
     },
     editChecking:function(node){

+ 11 - 17
web/building_saas/main/js/views/project_view.js

@@ -452,24 +452,18 @@ var projectObj = {
         let project = projectObj.project, fieldName = colSetting.data.field;
         if(node.sourceType==project.ration_glj.getSourceType()){
             project.ration_glj.updateFromMainSpread(value,node,fieldName);
-        }
-        else if(fieldName === 'remark'){
+        } else if(fieldName === 'remark'){
             projectObj.updateNodeField(node,value,'remark');
-        }
-        else if(calcTools.isGljRation(node)){
+        } else if(calcTools.isGljRation(node)){
             gljOprObj.updateRationTypeGLJ(value,node,fieldName,editingText);
-        }
-        else if (value !== calcFees.getFee(node.data, fieldName)||fieldName == 'quantity') {//工程量需要进行转换,所以做特殊处理
+        } else if (value !== calcFees.getFee(node.data, fieldName)||fieldName == 'quantity') {//工程量需要进行转换,所以做特殊处理
             if (fieldName === 'code' && value != '' && !calcTools.isVolumePrice(node)) {
                 projectObj.updateCode(node, value);
-            }
-            else if(fieldName ==='feeRate'){
+            } else if(fieldName ==='feeRate'){
                 project.FeeRate.updateFeeRateFromBills(value,node,fieldName);
-            }
-            else if(fieldName ==='contain'){//编辑含量
+            } else if(fieldName ==='contain'){//编辑含量
                 project.Ration.updateContain(value,node);
-            }
-            else if (fieldName === 'quantity' || fieldName === 'marketUnitFee' || fieldName === 'feesIndex.common.unitFee'||fieldName === 'feesIndex.common.totalFee' || fieldName === 'programID' ||
+            } else if (fieldName === 'quantity' || fieldName === 'marketUnitFee' || fieldName === 'feesIndex.common.unitFee'||fieldName === 'feesIndex.common.totalFee' || fieldName === 'programID' ||
                 fieldName === 'subType' || fieldName === 'calcBase' || fieldName === 'isSubcontract'){
                 if (fieldName === 'quantity') {
                     quantityEditObj.checkingAndUpdate(editingText,node);
@@ -526,12 +520,12 @@ var projectObj = {
 
                 project.calcProgram.calcAndSave(node);
                 gljOprObj.showRationGLJSheetData();
-            } else if (node.sourceType === project.Bills.getSourceType()&&fieldName === 'unit'){//修改清单单位的时候清单工程量要重新4舍5入
+            } else if (node.sourceType === project.Bills.getSourceType()&&(fieldName === 'unit'||fieldName === 'specialProvisional')){
+
+                //node.sourceType === project.Bills.getSourceType()&&fieldName === 'unit'
                 node.data[fieldName] = value;
                 node.changed = true;
-                if(node.data.quantity){
-                    node.data.quantity =scMathUtil.roundForObj(node.data.quantity,getDecimal("quantity",node));
-                }
+                if(fieldName === 'unit' && node.data.quantity)  node.data.quantity =scMathUtil.roundForObj(node.data.quantity,getDecimal("quantity",node));//修改清单单位的时候清单工程量要重新4舍5入
                 project.calcProgram.calcAndSave(node);
             } else {
                 if (node.sourceType === project.Bills.getSourceType()) {
@@ -1924,7 +1918,7 @@ var projectObj = {
                 return  item.data.field == "itemCharacterText";
             })
         }
-        return !this.itemCol.visible;
+        return this.itemCol?!this.itemCol.visible:true;
     },
     //综合合价cellType
     getCommonTotalFeeCellType:function () {