zhangweicheng 7 năm trước cách đây
mục cha
commit
132ab3d6ac

+ 1 - 0
modules/all_models/bills.js

@@ -57,6 +57,7 @@ let billsSchema = new Schema({
     flags: [subSchema.flagsSchema],
     installationKey:String,//用来记录安装增加费的关联字段
     deleteInfo: deleteSchema,
+    remark:String
 });
 
 mongoose.model("bills", billsSchema);

+ 2 - 1
modules/all_models/projects.js

@@ -29,7 +29,8 @@ const ProjectSchema = new Schema({
         safetyFee: String,
         chargeFee: String
     },
-    "changeMark":String//更新标记  feeRate:费率文件发生了改变,unitFile 单件文件发生了改变
+    "changeMark":String,//更新标记  feeRate:费率文件发生了改变,unitFile 单件文件发生了改变
+    "remark":String //备注
 });
 
 mongoose.model(collectionName, ProjectSchema, collectionName);

+ 2 - 2
modules/all_models/ration.js

@@ -63,8 +63,8 @@ let rationSchema = new Schema({
     specs:String,//规格型号
     shortName:String,//缩写
     customQuantity:String,//自定义消耗
-    adjCoe:Number
-
+    adjCoe:Number,
+    remark:String
 });
 
 let ration = mongoose.model("ration", rationSchema, "ration");

+ 0 - 25
modules/glj/models/glj_list_model.js

@@ -109,31 +109,6 @@ class GLJListModel extends BaseModel {
                // projectGLJIDList: gljIdList 这里是取所有项目工料机,所以也是取所有定额工料机,不需要根据项目工料机ID再过滤
             };
             //为了提高性成计算消耗量功能改成了在前端计算
-           /* let quantityData = [];//await RationGLJFacade.getQuantityByProjectGLJ(condition); 为了提高性成计算消耗量功能改成了在前端计算
-            let rationTypeQuantity = [];//await RationGLJFacade.getRationTypeGLJQuantity(projectId);
-            let quantityList = {};
-            // 整理数据 得到总定额消耗量
-            for (let tmp of quantityData) {
-                let tmpNum = parseFloat(tmp.rationQuantity);
-                tmpNum = isNaN(tmpNum) ||tmpNum==0? 0 : tmpNum;
-                let tmp_con_key = keyMap[tmp.projectGLJID];
-
-                if (quantityList[tmp_con_key] === undefined) {
-                    quantityList[tmp_con_key] = scMathUtil.roundTo(tmp.quantity * tmpNum,-quantity_decimal);
-                } else {
-                    quantityList[tmp_con_key] = scMathUtil.roundTo(quantityList[tmp_con_key]+tmp.quantity * tmpNum,-quantity_decimal);
-                }
-            }
-            //计算定额类型工料机的消耗量
-            for(let rq of rationTypeQuantity){
-                let rq_key = keyMap[rq.projectGLJID];
-                let rq_quantity= scMathUtil.roundForObj(rq.quantity,quantity_decimal);
-                if(quantityList[rq_key] === undefined){
-                    quantityList[rq_key] =  scMathUtil.roundTo(rq_quantity,-quantity_decimal);
-                }else {
-                    quantityList[rq_key] = scMathUtil.roundTo(quantityList[rq_key]+rq_quantity,-quantity_decimal);
-                }
-            }*/
             // 整理获取有组成物的项目工料机的数据
             let connect_keys = [];
             for(let tmp of gljData) {

+ 5 - 8
modules/main/facade/project_facade.js

@@ -123,6 +123,7 @@ async function updateNodes(datas){
     let nodeGroups = _.groupBy(datas,'type');
     let rationTasks = [];
     let billTasks = [];
+    let asyncTasks = [];
     for(let type in nodeGroups){
         for(let node of nodeGroups[type]){
             if(type == projectConsts.BILLS){
@@ -132,19 +133,15 @@ async function updateNodes(datas){
             }
         }
     }
-
-    if(rationTasks.length>0){
-         await ration_model.model.bulkWrite(rationTasks);
-    }
-    if(billTasks.length>0){
-         await  bill_model.model.bulkWrite(billTasks);
-    }
+    rationTasks.length>0?asyncTasks.push(ration_model.model.bulkWrite(rationTasks)):'';
+    billTasks.length>0?asyncTasks.push(bill_model.model.bulkWrite(billTasks)):"";
+    return  asyncTasks.length>0?await Promise.all(asyncTasks):"";
 
     function getTask(node) {
         let task={
             updateOne:{
                 filter:{
-                    projectID: node.data.projectID,
+                    //projectID: node.data.projectID, 现在复制项目也重新生成一个新的ID了,所以ID是唯一的
                     ID: node.data.ID,
                     deleteInfo: null
                 },

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

@@ -147,7 +147,7 @@ ProjectController = {
             this.addSpecialBill(project, sheetController,selected, null,true,billType.FX);
         }
         if(selected.parent){
-            if(selected.data.type==billType.FX){
+            if(selected.data.type==billType.FX||selected.data.type==billType.BX){
                 this.addSpecialBill(project, sheetController,selected.parent, selected.nextSibling,true,billType.FX);
             }
         }

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

@@ -589,7 +589,7 @@ var Ration = {
                 if(selected.sourceType === project.Ration.getSourceType()){ // 焦点行是定额/量价/工料机,有效显示。
                     return false;
                 }else if(selected.sourceType === project.Bills.getSourceType()){
-                    if(selected.data.type == billType.FX){//焦点行是分项,有效显示。
+                    if(selected.data.type == billType.FX||selected.data.type == billType.BX){//焦点行是分项,有效显示。
                         return false
                     }
                     if(selected.data.type == billType.BILL && selected.source.children.length === 0){//焦点行是清单,且没有子项,有效显示。

+ 22 - 6
web/building_saas/main/js/views/project_view.js

@@ -36,7 +36,7 @@ var projectObj = {
         gljOprObj.showDataIfRationSelect(node);
         if (activeSubSheetIs(subSheetIndex.ssiCalcProgram)) {
             calcProgramObj.showData(node);
-        };
+        }
         //zhong 2017-9-1 特征及内容
         if(pageCCOprObj.active){
             pageCCOprObj.mainActiveCell = projectObj.mainSpread.getActiveSheet().getSelections()[0];//mainSpread焦点单元格
@@ -373,15 +373,31 @@ var projectObj = {
             };*/
         }
     },
+    updateRemark : function (node,value) {
+        console.log(value);
+        if(node.data.remark == value){
+            return;
+        }
+        let data =  {
+            type:node.sourceType,
+            data:{
+                ID:node.data.ID,
+                remark:value
+            }
+        };
+        projectObj.project.updateNodes([data],function () {
+            node.data.remark = value;
+        })
+    },
     updateCellValue: function (node, value, colSetting,editingText) {
         let project = projectObj.project, fieldName = colSetting.data.field;
         if(node.sourceType==project.ration_glj.getSourceType()){
             project.ration_glj.updateFromMainSpread(value,node,fieldName);
-        }
-        else if(calcTools.isGljRation(node)){
+        }else if(fieldName === 'remark'){
+            projectObj.updateRemark(node,value);
+        }  else if(calcTools.isGljRation(node)){
             gljOprObj.updateRationTypeGLJ(value,node,fieldName);
-        }
-        else if (value !== calcFees.getFee(node.data, fieldName)||fieldName == 'quantity') {//工程量需要进行转换,所以做特殊处理
+        } else if (value !== calcFees.getFee(node.data, fieldName)||fieldName == 'quantity') {//工程量需要进行转换,所以做特殊处理
             if (fieldName === 'code' && !calcTools.isVolumePrice(node)) {
                 projectObj.updateCode(node, value);
             }
@@ -707,7 +723,7 @@ var projectObj = {
                     disabled: function () {
                         let selected = project.mainTree.selected;
                         if(projectObj.project.isBillsLocked()== false&& selected&&selected.sourceType==project.Bills.getSourceType()){
-                            if(selected.data.type==billType.FX){//焦点行是分项,有效显示
+                            if(selected.data.type==billType.FX||selected.data.type==billType.BX){//焦点行是分项,有效显示
                                 return false
                             }
                             if(selected.data.type==billType.FB){//点行是分部,

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

@@ -16,7 +16,7 @@ let zlfb_object={
                 if(tem_node.data.type == billType.FB){
                     FB_nodes.push(tem_node);
                 }
-                if(tem_node.data.type == billType.FX){
+                if(tem_node.data.type == billType.FX||tem_node.data.type == billType.BX){
                     FX_nodes.push(tem_node);
                     let l_code = zlfb_object.getLibCode(tem_node.data.code);
                     if(tem_node.data.billsLibId&&l_code!=false){