Quellcode durchsuchen

Merge branch '1.0.0_online' of http://smartcost.f3322.net:3000/SmartCost/ConstructionCost into 1.0.0_online

# Conflicts:
#	web/building_saas/main/html/main.html
zhongzewei vor 6 Jahren
Ursprung
Commit
f889493301

+ 2 - 4
modules/all_models/compleRation_ration.js

@@ -56,11 +56,9 @@ const compleRationSchema = new Schema({
     rationAssList: [compleRationAssItemSchema],
     rationInstList: [rationInstSchema],
     rationTemplateList : [new Schema({
+        rationID:Number,
         type: String,
-        code: String,
-        name: String,
-        billsLocation: String,
-        unit:String
+        billsLocation: String
     }, { _id: false })],
     deleteInfo: deleteSchema
 }, {versionKey: false});

+ 2 - 4
modules/all_models/stdRation_ration.js

@@ -48,11 +48,9 @@ const rationItemSchema = new Schema({
     rationAssList: [rationAssItemSchema],
     rationInstList: [rationInstSchema],
     rationTemplateList : [new Schema({
+        rationID:Number,
         type: String,
-        code: String,
-        name: String,
-        billsLocation: String,
-        unit:String
+        billsLocation: String
     }, { _id: false })]
 
 });

+ 9 - 10
modules/main/controllers/ration_controller.js

@@ -54,20 +54,19 @@ let controller = {
     applyTemplate:async function(req){
         let data = req.body.data;
         data = JSON.parse(data);
-        let rationResult = [],billsResult = [],updateDatas =[];
-        //先生成新定额
-        if(data.rations.create.length > 0){
-            rationResult = await ration_facade.addMultiRation(data.rations.create,req.session.sessionCompilation);
-        }
-        //再生成清单
-        if(data.bills.create.length > 0){
-            billsResult =  await bill_facade.createNewBills(data.bills.create)
-        }
+        let updateDatas =[];
+        let applyTasks = [
+            ration_facade.addMultiRation(data.rations.create,req.session.sessionCompilation),//先生成新定额
+            bill_facade.createNewBills(data.bills.create),
+        ];
         //整理更新的数据,调用一个方法更新
         updateDatas.push(data.ration_template);
         if(data.rations.update.length > 0)  prepareUpdateNodes(data.rations.update,updateDatas,"ration");
         if(data.bills.update.length > 0)  prepareUpdateNodes(data.bills.update,updateDatas,"bills");
-        await project_facade.updateNodes(updateDatas);
+        applyTasks.push(project_facade.updateNodes(updateDatas));
+        let [rationResult,billsResult,updates] = await Promise.all(applyTasks);
+
+
         return {rationResult:rationResult,billsResult:billsResult,updateDatas:updateDatas};
     }
 };

+ 17 - 17
modules/main/facade/ration_facade.js

@@ -258,18 +258,21 @@ async function addRationTemplate(std,newRation) {
     let templateList = [];
     if(std.hasOwnProperty('rationTemplateList') && std.rationTemplateList.length > 0){
         for(let tem of std.rationTemplateList){
-            let template = {
-                billID:"",
-                fxID:"",
-                quantity:"0",
-                coe:"0"
-            };
-            template.code = tem.code;
-            template.name = tem.name;
-            template.type = tem.type;
-            template.unit = tem.unit;
-            template.billsLocation = tem.billsLocation;
-            templateList.push(template)
+            let re_ration = await rationItemModel.findOne({rationRepId:std.rationRepId,ID:tem.rationID});
+            if(re_ration){
+                let template = {
+                    billID:"",
+                    fxID:"",
+                    quantity:"0",
+                    coe:"0"
+                };
+                template.code = re_ration.code;
+                template.name = re_ration.name;
+                template.type = tem.type;
+                template.unit = re_ration.unit;
+                template.billsLocation = tem.billsLocation;
+                templateList.push(template)
+            }
         }
     }
     if(templateList.length > 0){
@@ -418,9 +421,6 @@ async function addRationGLJ(std,newRation,compilation) {
                     std_glj.basePrice =  std_glj.priceProperty[ext.priceField];
                 }
             }
-            console.log("================================get std glj=============================================");
-            console.log(std_glj);
-            let std_gljTime = +new Date();
             if(std_glj){
                 newGLJ.name = std_glj.name;
                 newGLJ.code = std_glj.code;
@@ -442,8 +442,8 @@ async function addRationGLJ(std,newRation,compilation) {
                 newRationGLJList.push(newGLJ);
                 rationGLJShowList.push(info);
             }
-            let InfoFromProjectGLJ = +new Date();
-            console.log("找到项目工料机时间-------------------------------"+(InfoFromProjectGLJ - std_gljTime));
+            //let InfoFromProjectGLJ = +new Date();
+            //console.log("找到项目工料机时间-------------------------------"+(InfoFromProjectGLJ - std_gljTime));
         }
     }
     let before = +new Date();

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

@@ -156,13 +156,13 @@
                           <li class="nav-item" id = "li_stdRationTab">
                               <a class="nav-link px-1 right-nav-link" href="javascript:void(0)" id="stdRationTab" relaPanel="#de">定额库</a>
                           </li>
-                          <li class="nav-item dropdown">
-                              <a class="nav-link dropdown-toggle more" data-toggle="dropdown" href="#" role="button" aria-haspopup="true" aria-expanded="false">更多</a>
-                              <div class="dropdown-menu">
-                                  <a class="dropdown-item  right-nav-link"  href="javascript:void(0)" id = 'locateTab' relaPanel="#locate">查找定位</a>
-                                 <!-- <a class="dropdown-item" data-toggle="tab" href="#sqpz" role="tab">书签批注</a>-->
-                              </div>
-                          </li>
+                     /*<li class="nav-item dropdown show">
+                <a class="nav-link dropdown-toggle more" data-toggle="dropdown" href="#" role="button" aria-haspopup="true" aria-expanded="true">更多</a>
+                <div class="dropdown-menu show" x-placement="bottom-start" style="position: absolute; transform: translate3d(-107px, 32px, 0px); top: 0px; left: 0px; will-change: transform;">
+                <a class="dropdown-item right-nav-link" href="javascript:void(0)" id="locateTab" relapanel="#locate">查找定位</a><a class="dropdown-item right-nav-link" href="javascript:void(0)" id="blockLibTab" relapanel="#kmbk">块模板库</a>
+                <!-- <a class="dropdown-item" data-toggle="tab" href="#sqpz" role="tab">书签批注</a>-->
+                </div>
+                </li>*/
                           <script>
                               //2018-11-23  zhang 模板库移动到更多下拉框
                               if (G_SHOW_BLOCK_LIB){
@@ -213,9 +213,9 @@
                                   <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">

+ 30 - 0
web/building_saas/main/js/controllers/project_controller.js

@@ -233,6 +233,36 @@ ProjectController = {
         } else {
             alert('当前焦点行不是定额,无法替换。');
         }
+    },
+    addNewNodes:function (updateData){
+        let controller = projectObj.mainController;
+        let Bill = projectObj.project.Bills;
+        let newAddNode = [];
+        let newRationNodes = [];
+        for(let nb of updateData.bills.add){
+            let newSource = Bill.tree.insertByData(nb, nb.ParentID, -1, true);//按顺序插入的情况下,nextID为-1,树节点
+            let newNode = projectObj.project.mainTree.insert(nb.ParentID, -1, newSource.data.ID);
+            newNode.source = newSource;
+            newNode.sourceType = Bill.getSourceType();
+            newNode.data = newSource.data;
+            controller.sheet.addRows(newNode.serialNo(), 1);
+           // controller.sheet.showRow(newNode.serialNo(), GC.Spread.Sheets.VerticalPosition.center);
+            newAddNode.push(newNode);
+            Bill.datas.push(nb);
+        }
+        for(let nr of updateData.ration.add){
+            let newNode = projectObj.project.mainTree.insert(nr.billsItemID, -1, nr.ID);
+            newNode.source = nr;
+            newNode.sourceType = projectObj.project.Ration.getSourceType();
+            newNode.data = nr;
+            controller.sheet.addRows(newNode.serialNo(), 1);
+           // controller.sheet.showRow(newNode.serialNo(), GC.Spread.Sheets.VerticalPosition.center);
+            newAddNode.push(newNode);
+            newRationNodes.push(newNode);
+            projectObj.project.Ration.datas.push(nr);
+        }
+        TREE_SHEET_HELPER.refreshTreeNodeData(controller.setting, controller.sheet, newAddNode, false);
+        return newRationNodes;
     }
 /*    addVolumePrice: function (project, sheetController) {
         if (!project || !sheetController) { return null; }

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

@@ -738,6 +738,9 @@ var Bills = {
                 updateNodes.push(m_node);
                 controller.tree.getAllSubNode(m_node,updateNodes);
             }
+            console.log(mainNodes);
+            let refNodes = mbzm_obj.deleteReferenceRation(mainNodes,updateNodes);//删除子目关联定额节点
+            console.log(mainNodes);
             for(let u_node of updateNodes){
                 if(u_node.sourceType == project.Bills.getSourceType()){
                     billsUpdate[u_node.data.ID] = true;
@@ -777,7 +780,10 @@ var Bills = {
                         project.Ration.deleteSubListOfRation({ID:r_key});
                     }
                 }
-                controller.m_delete(mainNodes);//删除树节点
+                for(let r of refNodes){
+                    controller.m_delete([r],r.serialNo())//这里删除关联子目生成的定额因为是离散的树节点,所以要这样分开处理
+                }
+                controller.m_delete(mainNodes,mainNodes[0].serialNo());//删除树节点
                 me.tree.m_delete(idTreeNodes);
                 $.bootstrapLoading.end();
                 //重新计算

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

@@ -422,16 +422,15 @@ var PROJECT = {
                     temObj = _.find(this[d.type].datas,{"ID":d.data.ID});
                 }
                 if(temObj){
-                    console.log(temObj);
                     for(let key in d.data){
                         if(key == 'ID' || key == 'id'){
                             continue;
                         }
                         this.setValue(temObj,key,d.data[key])
                     }
-                    console.log(temObj);
                 }
             }
+            return refreshNode;
         };
         project.prototype.setValue=function (obj,key,value) {
             let keyArray = key.split('.');

+ 36 - 37
web/building_saas/main/js/views/block_lib.js

@@ -42,7 +42,7 @@ var blockLibObj = {
             {headerName: "项目编码", headerWidth: 90, dataCode: "code", dataType: "String", hAlign: "center"},
             {headerName: "项目名称", headerWidth: 100, dataCode: "name", dataType: "String"},
             {headerName: "单位", headerWidth: 40, dataCode: "unit", dataType: "String", hAlign: "center"},
-            {headerName: "综合单价", headerWidth: 70, dataCode: "", dataType: "Number"},
+            {headerName: "综合单价", headerWidth: 70, dataCode: "unitFee", dataType: "Number"},
             {headerName: "项目特征", headerWidth: 160, dataCode: "itemCharacterText", dataType: "String"}
         ],
         view: {
@@ -57,8 +57,8 @@ var blockLibObj = {
             {headerName: "名称", headerWidth: 100, dataCode: "name", dataType: "String"},
             {headerName: "单位", headerWidth: 40, dataCode: "unit", dataType: "String", hAlign: "center"},
             {headerName: "含量", headerWidth: 40, dataCode: "contain", dataType: "Number"},
-            {headerName: "取费专业", headerWidth: 70, dataCode: "", dataType: "String", hAlign: "center"},
-            {headerName: "综合单价", headerWidth: 70, dataCode: "", dataType: "Number"},
+            {headerName: "取费专业", headerWidth: 70, dataCode: "programName", dataType: "String", hAlign: "center"},
+            {headerName: "综合单价", headerWidth: 70, dataCode: "unitFee", dataType: "Number"},
             {headerName: "子目换算状态", headerWidth: 90, dataCode: "adjustState", dataType: "String"}
         ],
         view: {
@@ -132,14 +132,12 @@ var blockLibObj = {
     loadDetailDatas: function (node){
         let me = this;
         if (node.data.type == 2){
-            let bill = node.data.datas[0];
+            let bill = node.data;
             let rations = bill.children;
             sheetCommonObj.showData(me.billSheet, me.billSetting, [bill]);
-            me.changeBillText(bill);
             let rCount = (rations.length > 0) ? rations.length : 1;
             me.rationSheet.setRowCount(rCount, GC.Spread.Sheets.SheetArea.viewport);
             sheetCommonObj.showData(me.rationSheet, me.rationSetting, rations);
-            me.changeRationText(rations);
         }
         else{
             sheetCommonObj.cleanSheet(me.billSheet, me.billSetting, 1);
@@ -367,13 +365,30 @@ var blockLibObj = {
 
         let newNode = tree.insert(pID, nID);
         newNode.data.type = nodeType;
-        newNode.data.name = nodeName;
+        newNode.data.fileName = nodeName;
         if (nodeType == 2){
+            let bill = source.datas[0];
             newNode.data.compilationID = source.compilationID;
             newNode.data.copyTime = source.copyTime;
             newNode.data.firstNodeType = source.firstNodeType;
             newNode.data.isFBFX = source.isFBFX;
-            newNode.data.datas = source.datas;
+
+            newNode.data.code = bill.code;
+            newNode.data.name = bill.name;
+            newNode.data.unit = bill.unit;
+            newNode.data.itemCharacterText = bill.itemCharacterText;
+            newNode.data.unitFee = (bill.feesIndex && bill.feesIndex.common) ? bill.feesIndex.common.unitFee : 0;
+            newNode.data.children = bill.children;
+
+            for (let r of bill.children){
+                r.unitFee =  (r.feesIndex && r.feesIndex.common) ? r.feesIndex.common.unitFee : 0;
+                if (r.programID)
+                    r.programName = projectObj.project.calcProgram.compiledTemplateMaps[r.programID];
+                // delete r.ID;         // 这个不能删!
+                delete r.billsItemID;
+                delete r.fees;
+                delete r.feesIndex;
+            };
         }
 
         tree.selected = newNode;
@@ -385,14 +400,15 @@ var blockLibObj = {
         let idx = tree.items.indexOf(newNode);
         sheet.addRows(idx, 1);
         sheet.getRange(idx, 0, 1, 1).locked(true);
-        sheet.setValue(idx, 0, newNode.data.name);
+        sheet.setValue(idx, 0, newNode.data.fileName);
         sheet.setSelection(idx, 0, 1, 1);
 
         sheet.resumeEvent();
         sheet.resumePaint();
     },
     reName: function (node, newName){
-        node.data.name = newName;
+        if (newName == '') return;
+        node.data.fileName = newName;
         let idx = blockLibObj.mainTree.items.indexOf(node);
         blockLibObj.mainSheet.setValue(idx, 0, newName);
     },
@@ -419,28 +435,6 @@ var blockLibObj = {
         if (this.rationSpread)
             this.rationSpread.refresh();
     },
-    changeRationText: function (rationDatas) {
-        let sheet = this.rationSheet;
-        sheet.suspendPaint();
-        sheet.suspendEvent();
-        for (let i = 0; i < rationDatas.length; i++) {
-            let pID = rationDatas[i].programID;
-            if (pID) sheet.setValue(i, 4, projectObj.project.calcProgram.compiledTemplateMaps[pID]);
-            if (rationDatas[i].feesIndex && rationDatas[i].feesIndex.common)
-                sheet.setValue(i, 5, rationDatas[i].feesIndex.common.unitFee);
-        }
-        sheet.resumeEvent();
-        sheet.resumePaint();
-    },
-    changeBillText: function (billData){
-        let sheet = this.billSheet;
-        sheet.suspendPaint();
-        sheet.suspendEvent();
-        if (billData.feesIndex && billData.feesIndex.common)
-            sheet.setValue(0, 3, billData.feesIndex.common.unitFee);
-        sheet.resumeEvent();
-        sheet.resumePaint();
-    },
     loadTreeContextMenu: function (){
         let me = this;
         $.contextMenu({
@@ -530,16 +524,21 @@ var blockLibObj = {
         let projectNode = projectObj.project.mainTree.selected;
         if (!calcTools.isLeafBill(projectNode)) return;
 
+        // 这里再次封装成伟城的块文件格式,可直接使用伟城的“粘贴块”接口。
+        // 这里结构作出调整:忽略叶子清单层,直接从定额开始(跟粘贴块有区别),始终强制在叶子清单下插入定额。
+        // 该操作前提:当前块文件的全部数据已从后台取到前台。
         let block = me.mainTree.selected.data;
-        // 这里再次封装成伟城的块文件格式,可直接使用伟城的“粘贴块”接口。前提:当前块文件的全部数据已从后台取到前台。
         let vBlock_WC = {
             compilationID: block.compilationID,
             copyTime: block.copyTime,
-            firstNodeType: 1,   // 强制改成1。这里跟粘贴块有区别,忽略叶子清单层,直接从定额开始,即始终强制在叶子清单下插入定额
+            firstNodeType: 1,           // 强制改成1 (因为是从清单下的定额开始。清单自身的还是保留,暂不使用使用)
             isFBFX: block.isFBFX,
-            datas: block.datas[0].children    // rations
+            datas: block.children       // rations
         };
         BlockController.confirmPaste(vBlock_WC, projectNode, 'sub');
+    },
+    oneToMoreCloneXX: function () {
+        //
     }
 };
 
@@ -562,12 +561,12 @@ $(document).ready(function(){
 
     $('#btn_block_reName').on('click', function (){
         let select = blockLibObj.mainTree.selected;
-        $('#input_block_reName').val(select.data.name);
+        $('#input_block_reName').val(select.data.fileName);
     });
 
     $('#btn_block_reName_OK').on('click', function (){
         let select = blockLibObj.mainTree.selected;
-        let oldName = select.data.name;
+        let oldName = select.data.fileName;
         let newName = $('#input_block_reName').val();
         if (oldName != newName) blockLibObj.reName(select, newName);
     });

+ 64 - 30
web/building_saas/main/js/views/mbzm_view.js

@@ -117,7 +117,7 @@ let mbzm_obj={
     },
     updatePosition:function (recode) {
         let selection = this.sheet.getSelections()[0];
-        let selectedItem  =(this.datas[selection.row]);
+        let selectedItem =this.datas[selection.row];
         let updateField = $("#createLocation").val()==this.locateMap.INMEASURE?"billID":"fxID";
         if(selectedItem[updateField] == recode.ID) return;
         selectedItem[updateField] = recode.ID;
@@ -132,7 +132,7 @@ let mbzm_obj={
         if(this.datas.length <= 0) return;
         for(let d of this.datas){
             if(gljUtil.isDef(d.quantity)&& parseFloat(d.quantity)>0){
-                if(this.positionChecking(createLocation,d) == false){
+                if(this.positionChecking(createLocation,d) == false){//清单位置检查
                     alert(`请选择${d.code}生成的清单位置`);
                     return;
                 }
@@ -149,15 +149,37 @@ let mbzm_obj={
         console.log(data);
         $.bootstrapLoading.start();
         CommonAjax.post('/ration/applyTemplate',data,function (result) {
-            $.bootstrapLoading.end();
             let refreshNodes = projectObj.project.updateNodesCache(result.updateDatas);//更新要update的前端缓存,并返回要刷新的树节点
+            let nodeDatas = {ration:{add:[]}, bills:{add:[]}};
+            if(result.rationResult){
+                for(let rr of result.rationResult){
+                    nodeDatas.ration.add.push(rr.ration);//定额datas数据的push在addNodes里面做
+                    projectObj.project.Ration.addSubListOfRation(rr);//添加定额子项缓存
+                }
+            }
             //对于新插入的清单:
             if(result.billsResult.length > 0){
-
+                nodeDatas.bills.add = result.billsResult;
             }
-            //对于新插入的定额
-
+            let calRations = ProjectController.addNewNodes(nodeDatas);
+            if(refreshNodes.length > 0){
+                for(let r of refreshNodes){
+                    if(r.sourceType == ModuleNames.ration){
+                        calRations.push(r);
+                        if(r.data.quantityEXP =="MBGCL" ) projectObj.project.quantity_detail.cleanQuantityDetail(r,true);
+                    }
+                }
+                projectObj.mainController.refreshTreeNode(refreshNodes, false);
+            }
+            projectObj.project.projectGLJ.loadData(function () {
+                $.bootstrapLoading.end();
+                cbTools.refreshFormulaNodes();
+                //更新计算程序模板,并进行重新计算
+                projectObj.project.calcProgram.calcNodesAndSave(calRations,function () {
+                    installationFeeObj.calcInstallationFee();
+                });
 
+            });
             console.log(result);
         })
 
@@ -171,7 +193,7 @@ let mbzm_obj={
             }else if(_.isEmpty(data.billsLocation)){
                 validate = false
             }
-        }else {
+        }else if(type == mbzm_obj.locateMap.INFBFX){
             if(_.isEmpty(data.fxID)) {
                 validate = false;
             }else {
@@ -189,6 +211,7 @@ let mbzm_obj={
         let ration = this.getExistRation(data,referenceRationID,type);
         if(ration) {//如果存在,则比较清耗量、工程量表达式是否一致
             let tem =  this.getRationData(ration,data,quantity);//取更新信息
+
             if(tem){//如果不一致,则需要更新
                 rations.update.push(tem);
             }
@@ -204,30 +227,14 @@ let mbzm_obj={
         }else {
             this.createNewRationInFBFX(data,mainRation,quantity,rations,bills);
         }
-
-        /*[
-            {
-                type:'ration',
-                data:{
-                    projectID:1605,
-                    ID:"7b962fb0-1131-11e8-b3da-af725dadd7ae",
-                    name:'testRation'
-                }
-            },
-            {
-                type:'bills',
-                data:{
-                    projectID:1605,
-                    ID:"af9f0081-1127-11e8-99a8-2fc02230b6e7",
-                    name:'安全文明施工专项费用123'
-                }
-            }
-        ]*/
     },
     getRationData:function (ration,data,quantity) {
         let tem = {};
         if (ration.quantity + "" != quantity) tem.quantity = quantity;
-        if (gljUtil.isDef(data.coe) && data.coe != "0") tem.quantityEXP = "MBGCL";
+        if (gljUtil.isDef(data.coe) && data.coe != "0"&&ration.quantityEXP != "MBGCL") {
+            tem.isFromDetail = 0;
+            tem.quantityEXP = "MBGCL";
+        }
         if(!_.isEmpty(tem)) {
             tem.projectID = ration.projectID;
             tem.ID = ration.ID;
@@ -243,7 +250,7 @@ let mbzm_obj={
         if(rations.create.length > 0){
             serialNo = rations.create[rations.create.length -1].newData.serialNo + 1
         }
-        let n_ration = this.createNewRationData(data,newID,mainRation.data.referenceRationID,mainRation.data.billsItemID,serialNo,quantity,mainRation.data.libID);
+        let n_ration = this.createNewRationData(data,newID,mainRation.data.ID,mainRation.data.billsItemID,serialNo,quantity,mainRation.data.libID);
         rations.create.push(n_ration);
         //处理其它兄弟节点的序号
         let br = projectObj.project.Ration.getBillsSortRation();
@@ -287,6 +294,7 @@ let mbzm_obj={
                     ParentID:parentNode.data.ID,
                     NextSiblingID:-1,
                     code:projectObj.project.Bills.newFormatCode(data.billsLocation),
+                    type:billType.BILL,
                     billsLibId:projectInfoObj.projectInfo.engineeringInfo.bill_lib[0].id,//projectInfoObj.projectInfo.engineeringInfo.billsGuidance_lib
                     billsLocation : data.billsLocation//这个是用来在后端查找清单信息
                 };
@@ -385,7 +393,6 @@ let mbzm_obj={
         }
         return data.quantity
     },
-
     getExistRation:function (data,referenceRationID,type) {
         let temRation = null;
         //先检查要更新的定额是否已经存在
@@ -421,8 +428,35 @@ let mbzm_obj={
                 }
             }
         }
-
         return temRation;
+    },
+    hasReferenceRation:function (node) {
+        if(node.sourceType == ModuleNames.ration){
+            let  template = projectObj.project.ration_template.getTemplateByRationID(node.data.ID);
+            if(template){
+                let ration = _.find(projectObj.project.Ration.datas,{'referenceRationID':node.data.ID});
+                if(ration) return true;
+            }
+
+        }
+        return false;
+    },
+    deleteReferenceRation:function (mainNodes,updateNodes) {
+        let refNode = [];
+        for(let m of mainNodes){
+            if(this.hasReferenceRation(m)){
+                let  rations = _.filter(projectObj.project.Ration.datas,{'referenceRationID':m.data.ID});
+                for(let r of rations){
+                    let temNode =  projectObj.project.mainTree.getNodeByID(r.ID);
+                    if(temNode && updateNodes.indexOf(temNode) == -1){//能找到该节点,并且节点不在已经删除的列表中
+                        refNode.push(temNode);
+                        updateNodes.push(temNode);
+                        projectObj.mainController.tree.getAllSubNode(temNode,updateNodes)//添加显示到造价书页面的主材、设备节点
+                    }
+                }
+            }
+        }
+        return refNode;
     }
 };
 

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

@@ -2491,6 +2491,8 @@ $('#delete_row').on('show.bs.modal', function (e) {//这里用show,在shown之
             showN = true;
             cancelText = "取消";
         }
+    }else if(isSingleSelect()&&mbzm_obj.hasReferenceRation(selected)){//“有模板关联的定额”右键点击删除,弹窗提示“删除主子目时将删除对应的关联子目,是否继续?  是 否” (只有单选中一条定额并且是有模板关联的定额)
+        showinfo = "<label>删除主子目时将删除对应的关联子目,是否继续?</label>";
     }
     $('#delete_showinfo').html(showinfo);
     showN==true? $('#deleteN').show():$('#deleteN').hide();
@@ -2915,9 +2917,7 @@ $(function () {
         function createBlocks(aNode, categoryID){
             function createBlock(node) {
                 if (node.data.name == undefined || node.data.name == '') return;  // 清单名称为空,不生成块模板文件
-                let name = node.data.code + ' ' + node.data.name + ' ' + node.data.unit;
-                name = name.replace(/^\s+|\s+$/g, "");    // 只去两头空格
-
+                if (node.children.length == 0) return;
                 // 封装成伟城的块文件格式,直接调用伟城接口(定额这里的业务太多太庞杂,不要再重做一遍,尽量共用,维护代价小)
                 // 块文件要构建自己的树结构,所以也有自己的一部分数据。两种结构揉合在一起,显得有点杂乱,但利大于弊。
                 let block_WC = {
@@ -2929,7 +2929,10 @@ $(function () {
                 };
                 let ration_glj_Map = _.groupBy(projectObj.project.ration_glj.datas, 'rationID');
                 block_WC.datas.push(BlockController.getNodeDatas(node, ration_glj_Map));
-                blockLibObj.newNode(2, name, categoryID, block_WC);
+
+                let fileName = node.data.code + ' ' + node.data.name + ' ' + node.data.unit;
+                fileName = fileName.replace(/^\s+|\s+$/g, "");    // 只去两头空格
+                blockLibObj.newNode(2, fileName, categoryID, block_WC);
             };
 
             function createRecursion(node){

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

@@ -184,6 +184,9 @@ let quantityEditObj = {
             $("#quantityEditSpread").hide();
         }
         $("#quantityEXPValue").val(selected.data.quantityEXP);
+        selected.data.quantityEXP == "GCLMXHJ" || selected.data.quantityEXP =="MBGCL"?$("#quantityEXPValue").attr("disabled","disabled"):$("#quantityEXPValue").removeAttr("disabled");
+
+
     },
     checkingAndUpdate(quantityEXP,node){
         let me = this;