瀏覽代碼

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

chenshilong 7 年之前
父節點
當前提交
0e208e7168

+ 1 - 0
config/gulpConfig.js

@@ -133,6 +133,7 @@ module.exports = {
         'web/building_saas/report/js/rpt_cfg_const.js',
         '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',

+ 75 - 0
modules/glj/controllers/glj_controller.js

@@ -660,6 +660,81 @@ class GLJController extends BaseController {
         }
         res.json(result);
     }
+    async batchUpdateGLJProperty(req, res){
+        let result={
+            error:0
+        };
+        try {
+            let data = req.body.data;
+            data = JSON.parse(data);
+            let tasks = [];
+            for(let key in data){
+                let doc = data[key];
+                let query = {id:parseInt(key)};
+                let task = {updateOne:{filter:query, update :doc}};
+                tasks.push(task);
+            }
+            if(tasks.length > 0){
+                let gljModel = new GLJListModel().model;
+                await gljModel.bulkWrite(tasks);
+            }
+            result.data=data;
+        }catch (err){
+            logger.err(err);
+            result.error=1;
+            result.message = err.message;
+        }
+        res.json(result);
+    }
+
+    async batchUpdateConsumption(req,res){
+        let result={
+            error:0
+        };
+        try {
+            let data = req.body.data;
+            data = JSON.parse(data);
+            let mixTasks = [],parent = null;
+            for(let d of data){
+                if(d.type == 'mix_ratio'){
+                    let task = {updateOne:{filter:d.query, update :d.doc}};
+                    mixTasks.push(task);
+                }else if(d.type =='parent'){
+                    parent = d;
+                }
+            }
+            if(mixTasks.length > 0){
+                let mixRatioModel = new MixRatioModel().model;
+                await mixRatioModel.bulkWrite(mixTasks);
+            }
+            if(parent){
+                let indexList = ['code','name','specs','unit','type'];
+                let keyList = parent.connect_key.split("|-|");
+                let condition = {unit_price_file_id: parent.unit_price_file_id};
+                for(let i = 1;i<keyList.length;i++){
+                    if(keyList[i]!='null'){
+                        condition[indexList[i]]=keyList[i];
+                    }
+                }
+                let unitPriceUpdate = {
+                    base_price: parent.base_price,
+                    market_price: parent.market_price
+                };
+                let unitPriceModel = new UnitPriceModel();
+                let unitPriceResult = await unitPriceModel.updatePrice(condition, unitPriceUpdate);
+                if (!unitPriceResult) {
+                    throw '更新单价数据失败';
+                }
+            }
+            result.data = "ok";
+        }catch (err){
+            logger.err(err);
+            result.error=1;
+            result.message = err.message;
+        }
+        res.json(result);
+    }
+
     async modifyKeyValue(req,res){//修改工料机关键的属性:名称、类型、规格、型号等
         let result={
             error:0

+ 2 - 0
modules/glj/routes/glj_router.js

@@ -25,6 +25,8 @@ router.post('/save-as', gljController.init, gljController.unitPriceSaveAs);
 router.post('/get-composition', gljController.init, gljController.getComposition);
 router.post('/updatePrice', gljController.init, gljController.updateUnitPrice);
 router.post('/batchUpdatePrices', gljController.init, gljController.batchUpdatePrices);
+router.post('/batchUpdateGLJProperty', gljController.init, gljController.batchUpdateGLJProperty);
+router.post('/batchUpdateConsumption', gljController.init, gljController.batchUpdateConsumption);
 router.post('/modifyKeyValue',gljController.init, gljController.modifyKeyValue);
 
 router.get('/test', gljController.init, gljController.test);

+ 37 - 1
public/stringUtil.js

@@ -227,5 +227,41 @@ module.exports = {
     },
     getPinYinCamelChars: function(value) {
         return pinyin.getCamelChars(value);
+    },
+    formatNumber: function(formatStr, val) {
+        let rst = val;
+        if (formatStr) {
+            if (!(isNaN(parseFloat(val)))) {
+                function comdify(numStr){
+                    let re = /\d{1,3}(?=(\d{3})+$)/g;
+                    return numStr.replace(/^(\d+)((\.\d+)?)$/,function(s,s1,s2){return s1.replace(re,"$&,")+s2;});
+                }
+                let dotIdx = formatStr.indexOf(".");
+                if (dotIdx >= 0) {
+                    let tmpStr = parseFloat(val).toFixed(formatStr.length - dotIdx - 1);
+                    let digStr = formatStr.substr(dotIdx + 1, formatStr.length - dotIdx);
+                    for (let sIdx = digStr.length - 1; sIdx >= 0; sIdx--) {
+                        if (digStr[sIdx] === '#') {
+                            if (tmpStr.length > 0 && tmpStr[tmpStr.length - 1] === '0') {
+                                tmpStr = tmpStr.substr(0, tmpStr.length - 1);
+                            } else {
+                                break;
+                            }
+                        } else {
+                            break;
+                        }
+                    }
+                    if (tmpStr[tmpStr.length - 1] === '.') tmpStr = tmpStr.substr(0, tmpStr.length - 1);
+                    rst = tmpStr;
+                } else {
+                    rst = parseFloat(val).toFixed(0);
+                }
+                let commaIdx = formatStr.indexOf(",");
+                if (commaIdx >= 0) {
+                    rst = comdify(val.toString());
+                }
+            }
+        }
+        return rst;
     }
-};
+}

+ 4 - 1
public/web/PerfectLoad.js

@@ -3,8 +3,11 @@
  */
 
 jQuery.bootstrapLoading = {
+    isLoading: function () {
+        return $('#loadingPage').is(':visible');
+    },
     start: function (options) {
-        if($('#loadingPage').is(':visible')){
+        if(this.isLoading()){
             return;
         }
         var defaults = {

+ 2 - 1
public/web/sheet/sheet_data_helper.js

@@ -55,8 +55,9 @@ var SheetDataHelper = {
         spread.options.allowContextMenu = false;
         spread.options.allowUserDragDrop = false;
         spread.options.allowUndo = false;//that.mainSpread.commandManager().setShortcutKey(undefined, GC.Spread.Commands.Key.z, true, false, false, false); 屏蔽undo
-        spread.options. allowUserEditFormula = false;
+        spread.options.allowUserEditFormula = false;
         spread.options.showDragFillSmartTag = false;
+        spread.options.defaultDragFillType =GC.Spread.Sheets.Fill.AutoFillType.fillWithoutFormatting;
         spread.getActiveSheet().setRowCount(3);
         return spread;
     },

+ 3 - 1
test/unit/reports/test_rpt_test_template.js

@@ -26,7 +26,9 @@ cfgCacheUtil.setupDftCache();
 let fsUtil = require("../../../public/fsUtil");
 
 let demoPrjId = - 1;
-let demoRptId = 279, pagesize = "A4";
+// let demoRptId = 279;
+let demoRptId = 275; //测试模板-流水式
+let pagesize = "A4";
 //288: 11-2表(新)
 //279: 04
 

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

@@ -1218,12 +1218,12 @@
         </div>
     </div>
 
-    <!--弹出 粘位置选择-->
+    <!--弹出 粘位置选择-->
     <div class="modal fade" id="pastePosition" data-backdrop="static">
         <div class="modal-dialog" role="document">
             <div class="modal-content">
                 <div class="modal-header">
-                    <h5 class="modal-title">粘位置选择</h5>
+                    <h5 class="modal-title">粘位置选择</h5>
                     <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                         <span aria-hidden="true">&times;</span>
                     </button>
@@ -1247,9 +1247,9 @@
                         </div>
                     </div>
                 </div>
-                <div class="modal-footer">
+                <div class="modal-footer" style="justify-content: center">
                     <button class="btn btn-primary" id="paste_confirm">确定</button>
-                    <button type="button" class="btn btn-secondary" data-dismiss="modal">关闭</button>
+                    <button type="button" class="btn btn-secondary" data-dismiss="modal">取消</button>
                 </div>
             </div>
         </div>

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

@@ -71,7 +71,7 @@ ProjectController = {
             if (std) {
                 let fixedNode = getRootFixedNode(target);
                 if(!isFlag(fixedNode.data) || (fixedNode.data.flagsIndex.fixed.flag !== fixedFlag.SUB_ENGINERRING && fixedNode.data.flagsIndex.fixed.flag !== fixedFlag.MEASURE)){
-                    return;
+                    return false;
                 }
                 //焦点行属于分部分项
                 if(fixedNode.data.flagsIndex.fixed.flag === fixedFlag.SUB_ENGINERRING){
@@ -79,7 +79,7 @@ ProjectController = {
                     //焦点行是分部分项
                     let subType = getSubType(target);
                     if(target.sourceType === project.Bills.getSourceType() && target.data.type === billType.DXFY && subType === billType.FB){
-                        return;
+                        return false;
                     }
                     //焦点行是分部
                     else if(target.sourceType === project.Bills.getSourceType() && target.data.type === billType.FB){
@@ -90,7 +90,7 @@ ProjectController = {
                             nodeNextSiblingID = project.mainTree.rootID();
                         }
                         else{
-                            return;
+                            return false;
                         }
                     }
                 }

+ 32 - 4
web/building_saas/main/js/models/bills.js

@@ -506,14 +506,42 @@ var Bills = {
                 return false;
             }
         };
-        bills.prototype.isEngineerEst = function (node) {//判断是否是“专业工程暂估价”节点
-            return node && isFlag(node.data)&&node.data.flagsIndex.fixed.flag==fixedFlag.ENGINEERING_ESITIMATE;
+        bills.prototype.nodeFlagCheck = function (node,fixedFlag) {//判断节点类型
+            let flagCheck = function (checkNode) {
+                if(isFlag(checkNode.data)&&checkNode.data.flagsIndex.fixed.flag==fixedFlag){
+                    return true;
+                }else {
+                    if(checkNode.parent){
+                        return flagCheck(checkNode.parent);
+                    }else {
+                        return false;
+                    }
+                }
+            };
+            return flagCheck(node);
+        };
+
+        bills.prototype.getNodeByFlag = function(node,flag){//取节点类型,返回本身或父项节点
+            if(node){
+                if(isFlag(node.data)&&node.data.flagsIndex.fixed.flag==flag){
+                    return node;
+                }else {
+                    return this.getNodeByFlag(node.parent,flag);
+                }
+            }else {
+                return null;
+            }
+        };
+
+        bills.prototype.isEngineerEst = function (node) {//判断是否是“专业工程暂估价”节点或者子项
+           return this.nodeFlagCheck(node,fixedFlag.ENGINEERING_ESITIMATE);
+            //return node && isFlag(node.data)&&node.data.flagsIndex.fixed.flag==fixedFlag.ENGINEERING_ESITIMATE;
         };
         bills.prototype.isTotalService = function (node) {//判断是否是“总承包服务费”节点
-            return node && isFlag(node.data)&&node.data.flagsIndex.fixed.flag==fixedFlag.TURN_KEY_CONTRACT;
+            return this.nodeFlagCheck(node,fixedFlag.TURN_KEY_CONTRACT);
         };
         bills.prototype.isClaimVisa = function (node) {//判断是否是“签证及索赔计价”节点
-            return node && isFlag(node.data)&&node.data.flagsIndex.fixed.flag==fixedFlag.CLAIM_VISA;
+            return this.nodeFlagCheck(node,fixedFlag.CLAIM_VISA);
         };
         bills.prototype.isMeasure = function (node) {//判读是否属于措施项目部分
             let rootNode = this.getRootNode(node);

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

@@ -355,6 +355,22 @@ var PROJECT = {
             }
             return false;
         };
+        //清单是否属于锁定范围(分部分项、措施项目)
+        project.prototype.withinBillsLocked = function (node) {
+            const lockedFixFlag = [fixedFlag.SUB_ENGINERRING, fixedFlag.MEASURE];
+            while(node){
+                if(!node.parent){
+                    if(node.data.flagsIndex && node.data.flagsIndex.fixed && lockedFixFlag.includes(node.data.flagsIndex.fixed.flag)){
+                        return true;
+                    }
+                    else {
+                        return false;
+                    }
+                }
+                node = node.parent;
+            }
+            return true;
+        };
         project.prototype.updateNodes = function (datas,callback) {
           /*  let datas = [
                 {

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

@@ -298,16 +298,36 @@ ProjectGLJ.prototype.updatePrice = function (recode, updateField, newval,from,cb
     }
 };
 
-ProjectGLJ.prototype.batchUpdatePrice = function (changeInfo,callback) {
+ProjectGLJ.prototype.batchUpdateGLJProperty = function (updateMap,callback) {
+    //更新是否暂估和供货方式时,要做特殊处理
+    $.bootstrapLoading.start();
+    CommonAjax.post("/glj/batchUpdateGLJProperty", updateMap,function (result) {
+        $.bootstrapLoading.end();
+
+        if(callback){
+            callback();
+        }
+
+    })
+
+
+};
+
+ProjectGLJ.prototype.batchUpdatePrice = function (changeInfo,sheetName,callback) {
     let me = this;
     let projectGljs = me.datas.gljList;
     let decimal = getDecimal('glj.unitPrice');
     let updateData = [];
     let newValueMap = {};
     let gljs=[];
+    let setting = sheetName =="materialTreeSheet"?projectGljObject.materialSetting:projectGljObject.projectGljSetting;
+    if(changeInfo.length<=0){
+        callback?callback():'';
+        return
+    }
     for(let ci of changeInfo){
-        let dataCode = projectGljObject.projectGljSetting.header[ci.col].dataCode;
-        let recode = projectGljObject.projectGljSheetData[ci.row];
+        let dataCode = setting.header[ci.col].dataCode;
+        let recode = sheetName =="materialTreeSheet"?projectGljObject.materialTree.items[ci.row].data:projectGljObject.projectGljSheetData[ci.row];
         if(dataCode=='basePrice'||dataCode=='marketPrice'){
             let editField = dataCode === 'basePrice'?"base_price":"market_price";
             let newValue= scMathUtil.roundForObj(ci.value,decimal);
@@ -352,10 +372,43 @@ ProjectGLJ.prototype.batchUpdatePrice = function (changeInfo,callback) {
             $.bootstrapLoading.end();
         });
     }
+};
 
+ProjectGLJ.prototype.batchUpdateConsumption = function (updateData,updateMap,callback) {
+    let me = this;
+    $.bootstrapLoading.start();
+    CommonAjax.post("/glj/batchUpdateConsumption", updateData, function (result) {
+        let parent = updateData[updateData.length - 1];
+        let parentGlj = me.getByConKey(parent.connect_key);
+        for(let u of updateData){
+            if(u.type == 'mix_ratio'){
+                let tem = updateMap[u.query.id];
+                tem.record.consumption = u.doc.consumption;//更新组成物表格的缓存
+                let subData = _.find(parentGlj.ratio_data,{"id":u.query.id});
+                if(subData){
+                    subData.consumption = u.doc.consumption;
+                }
+                let m_list = me.datas.mixRatioMap[parent.connect_key];
+                let m_ratioData = _.find(m_list,{"id":u.query.id});
+                if(m_ratioData){
+                    m_ratioData.consumption = u.doc.consumption;
+                }
+            }
+        }
+        parentGlj.unit_price.market_price =  parent.market_price;
+        parentGlj.unit_price.base_price =  parent.base_price;
+        me.calcQuantity();
+
+        if(callback){
+            callback();
+        }
+        $.bootstrapLoading.end();
+    },function () {
+        $.bootstrapLoading.end();
+    })
 
-};
 
+};
 
 ProjectGLJ.prototype.pGljUpdate= function (data,callback) {
     let me = this;

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

@@ -677,6 +677,7 @@ var quantity_detail = {
                     project.projectGLJ.loadData();
                 });*/
                 project.calcProgram.calcNodesAndSave(needUpdateChildren, function () {
+                    project.projectGLJ.calcQuantity();
                     if(project.Bills.isFBFX(node)) { //判断是否属于分部分项工程 ,是的话才需要做计取安装费计算
                         project.installation_fee.calcInstallationFee(function (isChange,rations) {
                             if(isChange){
@@ -685,8 +686,6 @@ var quantity_detail = {
                                 });
                             }
                         });
-                    }else {
-                        project.projectGLJ.calcQuantity();
                     }
                 });
 

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

@@ -488,7 +488,7 @@ var Ration = {
                 $.bootstrapLoading.start();
                 //保证由于异步的关系loading界面被隐藏,比如清单指引插入清单定额时,endUpdate中提前隐藏了loading
                 let interval =setInterval(function () {
-                    if(!$('#loadingPage').is(':visible') && showLoding){
+                    if(!$.bootstrapLoading.isLoading()&& showLoding){
                         $.bootstrapLoading.start();
                         clearInterval(interval);
                     }

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

@@ -166,6 +166,10 @@ let calcBaseView = {
         let showDatas;
         me.curType = type;
         if (type === me.type.bills) {
+            //锁定的清单不显示
+            if(projectObj.project.isBillsLocked() && projectObj.project.withinBillsLocked(projectObj.project.mainTree.selected)){
+                return;
+            }
             //显示清单基数分类
             $('#cbClassList').show();
             $('#qd-jsjs .modal-content').css('width', '670px');

+ 12 - 11
web/building_saas/main/js/views/character_content_view.js

@@ -165,7 +165,7 @@ let contentOprObj = {
         pageCCOprObj.setCharacterBySetting(selectedNode, setting, callback, contentOprObj);
     },
     onEditStart(sender, args){
-        if(projectInfoObj.projectInfo.property.lockBills){
+        if(projectInfoObj.projectInfo.property.lockBills && projectObj.project.withinBillsLocked(projectObj.project.mainTree.selected)){
             args.cancel = true;
             return;
         }
@@ -188,7 +188,7 @@ let contentOprObj = {
         if(args.sheet.isEditing()){
             args.sheet.endEdit(true);
         }
-        if(projectInfoObj.projectInfo.property.lockBills){
+        if(projectInfoObj.projectInfo.property.lockBills && projectObj.project.withinBillsLocked(projectObj.project.mainTree.selected)){
             args.sheet.setValue(args.row, args.col, 0);
             return;
         }
@@ -223,7 +223,7 @@ let contentOprObj = {
     },
     //复制粘贴
     onClipboardPasting: function (sender, args) {
-        if(projectInfoObj.projectInfo.property.lockBills){
+        if(projectInfoObj.projectInfo.property.lockBills && projectObj.project.withinBillsLocked(projectObj.project.mainTree.selected)){
             args.cancel = true;
             return;
         }
@@ -252,7 +252,7 @@ let contentOprObj = {
         let me = contentOprObj;
         let disObj = {jobAdd: false, jobInsert: true, jobDel: true, jobUp: true, jobDown: true};
         disObj.jobAdd = !pageCCOprObj.canAddType();
-        if(projectInfoObj.projectInfo.property.lockBills){
+        if(projectInfoObj.projectInfo.property.lockBills && projectObj.project.withinBillsLocked(projectObj.project.mainTree.selected)){
             disObj.jobAdd = true;
             disObj.jobInsert = true;
             disObj.jobDel = true;
@@ -309,7 +309,7 @@ let contentOprObj = {
                 let addDis = pageCCOprObj.canAddType() ? false : true,  insertDis = false, delDis = false, upDis = false, downDis = false;
                 if(target.hitTestType === 3){//在表格内&& typeof target.row !== 'undefined' && typeof target.col !== 'undefined'
                     //清单锁定,不可用
-                    if(projectInfoObj.projectInfo.property.lockBills){
+                    if(projectInfoObj.projectInfo.property.lockBills && projectObj.project.withinBillsLocked(projectObj.project.mainTree.selected)){
                         addDis = true;
                         insertDis = true;
                         delDis = true;
@@ -648,7 +648,7 @@ let characterOprObj = {
     },
     onEditStart: function (sender, args) {
         let me = characterOprObj;
-        if(projectInfoObj.projectInfo.property.lockBills){
+        if(projectInfoObj.projectInfo.property.lockBills && projectObj.project.withinBillsLocked(projectObj.project.mainTree.selected)){
             args.cancel = true;
             return;
         }
@@ -675,7 +675,7 @@ let characterOprObj = {
         }
     },
     onClipboardPasting: function (sender, args) {
-        if(projectInfoObj.projectInfo.property.lockBills){
+        if(projectInfoObj.projectInfo.property.lockBills && projectObj.project.withinBillsLocked(projectObj.project.mainTree.selected)){
             args.cancel = true;
         }
         if(args.cellRange.col + args.colCount - 1 > 1){
@@ -731,7 +731,7 @@ let characterOprObj = {
         if(args.sheet.isEditing()){
             args.sheet.endEdit(true);
         }
-        if(projectInfoObj.projectInfo.property.lockBills){
+        if(projectInfoObj.projectInfo.property.lockBills && projectObj.project.withinBillsLocked(projectObj.project.mainTree.selected)){
             args.sheet.setValue(args.row, args.col, 0);
             return;
         }
@@ -756,7 +756,7 @@ let characterOprObj = {
         let disObj = {itemAdd: false, itemInsert: true, itemDel: true, itemUp: true, itemDown: true};
         disObj.itemAdd = !pageCCOprObj.canAddType();
         //清单锁定,不可用
-        if(projectInfoObj.projectInfo.property.lockBills){
+        if(projectInfoObj.projectInfo.property.lockBills && projectObj.project.withinBillsLocked(projectObj.project.mainTree.selected)){
             disObj.itemAdd = true;
             disObj.itemInsert = true;
             disObj.itemDel = true;
@@ -801,7 +801,7 @@ let characterOprObj = {
                 let addDis = pageCCOprObj.canAddType() ? false : true, insertDis = false, delDis = false, upDis = false, downDis = false;
                 if(target.hitTestType === 3){//在表格内 && typeof target.row !== 'undefined' && typeof target.col !== 'undefined'
                     //清单锁定,则不可用
-                    if(projectInfoObj.projectInfo.property.lockBills){
+                    if(projectInfoObj.projectInfo.property.lockBills && projectObj.project.withinBillsLocked(projectObj.project.mainTree.selected)){
                         addDis = true;
                         insertDis = true;
                         delDis = true;
@@ -917,6 +917,7 @@ let pageCCOprObj = {
     },
     //设置特征及内容currentCache
     setCacheAndShow: function (node) {
+        this.refreshRuleTools(projectObj.project.isBillsLocked());
         if(node && node.sourceType === projectObj.project.Bills.getSourceType()){
             let theCont = contentOprObj, theCha = characterOprObj;
             node.data.jobContent = node && typeof node.data.jobContent !== 'undefined' ? node.data.jobContent : [];
@@ -991,7 +992,7 @@ let pageCCOprObj = {
     refreshRuleTools: function (lockBills) {
         $('#use-to-current').removeClass('disabled');
         $('#use-to-all').removeClass('disabled');
-        if(lockBills){
+        if(lockBills && projectObj.project.withinBillsLocked(projectObj.project.mainTree.selected)){
             $('#use-to-current').addClass('disabled');
             $('#use-to-all').addClass('disabled');
         }

+ 5 - 0
web/building_saas/main/js/views/fee_rate_view.js

@@ -332,6 +332,11 @@ var feeRateObject={
         return new FeeRateEditCellType();
     },
     showSelectModal:function (hitinfo) {
+        //锁定的清单不显示
+        let project = projectObj.project;
+        if(project.isBillsLocked() && project.withinBillsLocked(project.mainTree.selected)){
+            return;
+        }
         $("#fee_rate_tree").modal({show:true});
         $('#edit_from').val(hitinfo.sheet.name());
     },

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

@@ -279,7 +279,7 @@ var gljOprObj = {
         let selected = projectObj.project.mainTree.selected;
         if(selected) {
             //清单锁定时只读
-            if(selected.sourceType == ModuleNames.bills && projectObj.project.isBillsLocked()){
+            if(selected.sourceType == ModuleNames.bills && projectObj.project.isBillsLocked() && projectObj.project.withinBillsLocked(selected)){
                 return true;
             }
             //是主材或者是设备时只读
@@ -560,19 +560,28 @@ var gljOprObj = {
             }
             if (node.sourceType == "ration") {
                 if(node.data.type==rationType.gljRation){
-                    this.showMixRatio(node);
+                    if($('#linkGLJ').hasClass('active')){
+                        this.showMixRatio(node);
+                    }
                 }else {
-                    this.showRationGLJData(node);
-                    installationFeeObj.showRationInstallationData(node);
+                    if($('#linkGLJ').hasClass('active')){
+                        this.showRationGLJData(node);
+                    }
+                    if($('#linkAZZJF').hasClass('active')){
+                        installationFeeObj.showRationInstallationData(node);
+                    }
                 }
                 isShow = true;
             }
             if(node.sourceType == ModuleNames.ration_glj){
-                this.showMixRatio(node);
+                if($('#linkGLJ').hasClass('active')) {
+                    this.showMixRatio(node);
+                }
                 isShow = true;
             }
-
-            this.showQuantityDetailData(node);
+            if($('#linkGCLMX').hasClass('active')){
+                this.showQuantityDetailData(node);
+            }
         } else {
             this.selectedNodeId = null;
         }
@@ -845,9 +854,13 @@ var gljOprObj = {
         }
     },
     clearSheetData: function () {
-        sheetCommonObj.showData(this.sheet, this.setting, []);
-        installationFeeObj.rationInstallSheet.setRowCount(0);//清除combobox cell
-        sheetCommonObj.showData(installationFeeObj.rationInstallSheet, installationFeeObj.rationInstallSetting, []);
+        if($('#linkGLJ').hasClass('active')){
+            sheetCommonObj.showData(this.sheet, this.setting, []);
+        }
+        if($('#linkAZZJF').hasClass('active')){
+            installationFeeObj.rationInstallSheet.setRowCount(0);//清除combobox cell
+            sheetCommonObj.showData(installationFeeObj.rationInstallSheet, installationFeeObj.rationInstallSetting, []);
+        }
         //  sheetCommonObj.showData(this.detailSheet,this.detailSetting,[]);
         this.sheetData = [];
         installationFeeObj.rationInstallData = [];

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

@@ -275,7 +275,7 @@ let MainTreeCol = {
         }
     },
     editChecking:function(node){
-        if(node.sourceType==projectObj.project.Bills.getSourceType()&&projectObj.project.isBillsLocked()){
+        if(node.sourceType==projectObj.project.Bills.getSourceType()&&projectObj.project.isBillsLocked()&&projectObj.project.withinBillsLocked(node)){
             return true;
         }
         if(gljOprObj.isInstallationNode(node)){//如果是通过安装增加费自动生成的,都是只读类型

+ 159 - 17
web/building_saas/main/js/views/project_glj_view.js

@@ -111,6 +111,7 @@ projectGljObject={
         this.mixRatioSheet = this.mixRatioSpread .getSheet(0);
         this.initSheet(this.mixRatioSheet,this.mixRatioSetting);
         this.mixRatioSheet.name('mixRatioSheet');
+        this.mixRatioSheet.bind(GC.Spread.Sheets.Events.RangeChanged, this.onMixRatioRangeChange);
     },
     initMaterialTreeSheet:function () {
         this.materialTreeSheet = this.projectGljSpread.getSheet(1);
@@ -225,7 +226,8 @@ projectGljObject={
             type:glj.type,
             short_name:projectObj.project.projectGLJ.getShortNameByID(glj.type),
             consumption:glj.ratio_data.consumption,
-            unit_price:glj.unit_price
+            unit_price:glj.unit_price,
+            connect_key:glj.ratio_data.connect_key
         };
         gljOprObj.setGLJPrice(data,glj);
         return data;
@@ -238,7 +240,7 @@ projectGljObject={
             args.cancel = true;
         }
     },
-    projectGljEditChecking:function (row,col) {//return false表示不能编辑
+    projectGljEditChecking:function (row,col,isPaste=false) {//return false表示不能编辑
         let me = projectGljObject;
         let data = null, setting=null;
         let sheet = me.projectGljSpread.getActiveSheet();
@@ -248,6 +250,10 @@ projectGljObject={
         }else if(sheet.name() ==  'materialTreeSheet'){
             data = me.materialTree.selected.data;
             setting = me.materialSetting;
+            let notEditId= ['GC','GJ','MC','SN','SZ'];
+            if(notEditId.indexOf(data.id)!= -1){
+                return false;
+            }
         }
         let dataCode = setting.header[col].dataCode;
         let lockColumns = setting.view.lockColumns;
@@ -256,7 +262,7 @@ projectGljObject={
             return false;
         }
 
-        if(dataCode=='is_adjust_price'||dataCode=='is_evaluate'||dataCode=='is_main_material'){
+        if(isPaste == false &&(dataCode=='is_adjust_price'||dataCode=='is_evaluate'||dataCode=='is_main_material')){//除了粘贴,拖动填充等操作,其它的都不能编辑
             return false;
         }
         if(dataCode=='basePrice'||dataCode=='marketPrice'||dataCode=='supply'){//有组成物时,市场单价、定额价、供货方式不能修改
@@ -282,7 +288,7 @@ projectGljObject={
     },
     onSelectionChange:function (){
         let me = projectGljObject;
-        me.projectGljRowChang();
+        me.showMixRatioData();
         me.materialTreeSheet.repaint();
     },
     onProjectGljSelectionChange:function (sender, args) {
@@ -296,7 +302,11 @@ projectGljObject={
     },
     projectGljRowChang:function(row){
         let me = projectGljObject;
-        me.mixRatioSheet.getSelections()[0].row = -1;
+        let sel = me.mixRatioSheet.getSelections()[0];
+        sel.row = -1;
+        sel.col = 0;
+        sel.rowCount = 1;
+        sel.colCount = 1;
         me.showMixRatioData();
     },
     rightClickCallback:function (row) {
@@ -312,18 +322,20 @@ projectGljObject={
         let me = projectGljObject;
         let changeInfo=[];
         let canChange = true;
-        if(me.projectGljEditChecking(info.row,info.col) == false){
-            canChange = false;
-        }else if (info.action == GC.Spread.Sheets.RangeChangedAction.clear) {
-            info.newValue = null;
-            me.onProjectGLJValueChange(sender,info);
-            return ;
+        if(info.action == GC.Spread.Sheets.RangeChangedAction.clear){
+            if(me.projectGljEditChecking(info.row,info.col) == false){
+                canChange = false;
+            }else {
+                info.newValue = null;
+                me.onProjectGLJValueChange(sender,info);
+                return ;
+            }
         }
 
         for(let c of info.changedCells){
             let value=  info.sheet.getCell(c.row, c.col).text();
             changeInfo.push({row:c.row,col:c.col,value:value});
-            if(me.projectGljEditChecking(c.row,c.col)==false){//如果不能编辑
+            if(me.projectGljEditChecking(c.row,c.col,true)==false){//如果不能编辑
                 canChange = false;
             }
             if (canChange==true&&!me.checkData(c.col,me.projectGljSetting,value)) {
@@ -334,18 +346,148 @@ projectGljObject={
         if(canChange == false){//恢复原来的值
             info.sheetName =="materialTreeSheet"?me.showMaterialTreeData():me.showProjectGljData();
         }else if(info.sheetName =="projectGljSheet"){
-            me.batchUpdatePrice(changeInfo);
+            me.batchUpdateProjectGLJ(changeInfo,info.sheetName);
         }
     },
-    batchUpdatePrice(changeInfo){
+    onMixRatioRangeChange:function (sender,info){
+        let me = projectGljObject;
+        let canChange = true;
+        let changeInfo=[];
+        if (info.action == GC.Spread.Sheets.RangeChangedAction.clear) {
+            info.newValue = 0;
+            me.onMixRatioValueChange(sender,info);
+            info.sheet.getCell(info.row, info.col).text(0);
+            return ;
+        }
+
+        for(let c of info.changedCells){
+            let value = info.sheet.getCell(c.row, c.col).text();
+            if (!me.checkData(c.col,me.mixRatioSetting,value)) {
+                alert('输入的数据类型不对,请重新输入!');
+                canChange = false;
+                break;
+            }else {
+                changeInfo.push({row:c.row,col:c.col,value:value});
+            }
+        }
+
+        if(canChange == false){//数据类型不对
+            me.showMixRatioData();
+        }
+        if(changeInfo.length > 0){
+            me.batchUpdateConsumption(changeInfo);
+        }
+
+
+    },
+    batchUpdateProjectGLJ:function(changeInfo,sheetName){
         let projectGLJ = projectObj.project.projectGLJ;
         let me = projectGljObject;
-        projectGLJ.batchUpdatePrice(changeInfo,function (impactList) {
-            let selected = me.projectGljSheet.getSelections()[0];
+        let propertyCells=[],priceCells=[];
+        let setting = sheetName =="materialTreeSheet"?me.materialSetting:me.projectGljSetting;
+        for(let c of changeInfo){
+            c.dataCode = setting.header[c.col].dataCode;
+            if(c.dataCode == 'basePrice'||c.dataCode=='marketPrice'){
+                priceCells.push(c);
+            }else {
+                propertyCells.push(c);
+            }
+        }
+        me.batchUpdateGLJProperty(propertyCells,sheetName,function () {
+            //价格属于单价文件表,如果与项目工料机的其它属性一起的话计算起来会比较复杂,同时出现价格与其它属性一起更新的情况也会比较少;
+            projectGLJ.batchUpdatePrice(priceCells,sheetName,function (impactList) {
+                me.refreshBySheetName(sheetName);
+            });
+        });
+    },
+    refreshBySheetName:function (sheetName) {
+        let me = projectGljObject;
+        if(sheetName =="projectGljSheet"){
             me.showProjectGljData();
-            me.projectGljSheet.setSelection(selected.row,selected.col,selected.rowCount,selected.colCount);
+        }else if(sheetName =="materialTreeSheet"){
+            me.showMaterialTreeData();
+        }
+    },
+
+    batchUpdateGLJProperty:function (changeInfo,sheetName,callback) {
+        let me = projectGljObject,updateMap = {};
+        let projectGLJ = projectObj.project.projectGLJ;
+        for(let c of changeInfo){
+            let recode = sheetName =="materialTreeSheet"?me.materialTree.items[c.row].data:me.projectGljSheetData[c.row];
+            if(recode[c.dataCode] == c.value){
+                continue;
+            }
+            me.getUpdateData(recode.id,c.value,c.dataCode,c.quantity,updateMap);
+        }
+        if(_.isEmpty(updateMap)){
+            callback?callback():'';
+            return;
+        }
+        projectGLJ.batchUpdateGLJProperty(updateMap,callback);
+        console.log(updateMap)
+    },
+    getUpdateData :function (id,value,dataCode,quantity,updateMap) {
+        let me = projectGljObject;
+        let data = updateMap[id]?updateMap[id]:{};
+        // 如果是供货方式则需要处理数据
+        if (data === 'supply') {
+            data.supply_quantity = me.getSupplyQuantity(value,quantity);
+        }
+        if(dataCode === 'supply_quantity'){//修改数量需做4舍5入
+            value =  scMathUtil.roundForObj(value,getDecimal('glj.quantity'));
+        }
+        if(dataCode === 'is_evaluate'||dataCode === 'is_adjust_price'||dataCode === 'is_main_material'){
+            if(value){
+                value = 1;
+            }else {
+                value = 0;
+            }
+        }
+        if(dataCode === 'materialType' && (value == null || value=="")){//删除三材类别时,清空三材系数
+            value = null;
+            data.materialCoe = null;
+        }
+        if(dataCode == 'materialCoe'){
+            value = scMathUtil.roundForObj(value,getDecimal("material"));
+        }
+
+        data[dataCode] = value ;
+        updateMap[id] = data;
+    },
+    batchUpdateConsumption:function(changeInfo){
+        let projectGLJ = projectObj.project.projectGLJ;
+        let me = projectGljObject;
+        let updateMap = {},updateData = [],parentBasePrice = 0,parentMarketPrice = 0;
+        let parentKey = '',unit_price_file_id=null;
+        for(let c of changeInfo){
+            let record = me.mixRatioData[c.row];
+            let value = scMathUtil.roundForObj(c.value,getDecimal("glj.quantity"));
+            updateMap[record.mix_ratio_id] = {consumption: value,record:record };
+            updateData.push({type:'mix_ratio',query:{id:record.mix_ratio_id},doc:{consumption:value}});
+            parentKey = record.connect_key;
+            unit_price_file_id = record.unit_price.unit_price_file_id;
+        }
+        for(let sub of me.mixRatioData){
+            let marketPrice = scMathUtil.roundForObj(sub.unit_price.market_price,getDecimal("process"));
+            let basePrice = scMathUtil.roundForObj(sub.unit_price.base_price,getDecimal("process"));
+            let consumption =  updateMap[sub.mix_ratio_id]?updateMap[sub.mix_ratio_id].consumption:scMathUtil.roundForObj(sub.consumption,getDecimal("glj.quantity"));
+            parentMarketPrice = scMathUtil.roundForObj(marketPrice*consumption + parentMarketPrice,getDecimal("process"));
+            parentBasePrice = scMathUtil.roundForObj(basePrice*consumption + parentBasePrice,getDecimal("process"));
+        }
+        parentBasePrice = scMathUtil.roundForObj(parentBasePrice,getDecimal("glj.unitPrice"));
+        parentMarketPrice = scMathUtil.roundForObj(parentMarketPrice,getDecimal("glj.unitPrice"));
+        updateData.push({type:'parent',connect_key:parentKey,base_price:parentBasePrice,market_price:parentMarketPrice,unit_price_file_id:unit_price_file_id});
+        projectGLJ.batchUpdateConsumption(updateData,updateMap,function () {
+            //更新人材机汇总表
+            let parentSheet =  me.projectGljSpread.getActiveSheet();//三材汇总表和工料机汇总表
+            let prow = parentSheet.getActiveRowIndex();//取父机械或组成物的下标
+            let prowData = parentSheet.name() == 'projectGljSheet'?me.projectGljSheetData[prow]:me.materialTree.items[prow].data;
+            me.refreshParentData(prow,prowData.id);
+            me.onUnitFileChange(updateData);
         });
+
     },
+
     showProjectGljData:function () {
         this.projectGljSpread.setActiveSheetIndex(0);
         let sel = this.projectGljSheet.getSelections()[0];

+ 0 - 1
web/building_saas/main/js/views/project_info.js

@@ -31,7 +31,6 @@ var projectInfoObj = {
         CommonAjax.post('/pm/api/getProject', {"user_id": userID, "proj_id": scUrlUtil.GetQueryString('project')}, function (data) {
             if (data) {
                 that.projectInfo = data;
-                console.log(that.projectInfo);
                 //init decimal
                 setDecimal(decimalObj, data.property.decimal);
                 billsQuanDecimal.datas = data.property.billsQuantityDecimal || [billsDecimalView.angleDecimal];

+ 35 - 16
web/building_saas/main/js/views/project_view.js

@@ -7,7 +7,7 @@ var projectObj = {
     mainSpread: null,
     mainController: null,
     gljSpreed:null,
-    beforeMainTreeSelectedChange: function (node) {
+    beforeMainTreeSelectedChange: function (pre,) {
         /*if (node) {
             subViewObj.saveComments(node);
         }*/
@@ -32,14 +32,16 @@ var projectObj = {
         }
         project.mainTree.preSelected = node;
         projectObj.setNodesStyle(projectObj.mainController.sheet, refreshNodes);
-
-        subViewObj.loadComments(node);
+        if($('#linkComments').hasClass('active')){
+            subViewObj.loadComments(node);
+        }
         gljOprObj.showDataIfRationSelect(node);
         if (activeSubSheetIs(subSheetIndex.ssiCalcProgram)) {
             calcProgramObj.showData(node);
         }
         //zhong 2017-9-1 特征及内容
         if(pageCCOprObj.active){
+            console.log('enterCC');
             pageCCOprObj.mainActiveCell = projectObj.mainSpread.getActiveSheet().getSelections()[0];//mainSpread焦点单元格
             pageCCOprObj.setCacheAndShow(node);
         }
@@ -66,7 +68,7 @@ var projectObj = {
             if(!node){
                 return false;
             }
-            if(projectObj.project.isBillsLocked()== true){
+            if(projectObj.project.isBillsLocked()== true && projectObj.project.withinBillsLocked(node)){
                 return false;
             }
             if(node.depth()<=1){//焦点行是树结构的第一/二层节点,灰显。
@@ -98,7 +100,7 @@ var projectObj = {
             if(!node){
                 return false;
             }
-            if(projectObj.project.isBillsLocked()== true){
+            if(projectObj.project.isBillsLocked()== true && projectObj.project.withinBillsLocked(node)){
                 return false;
             }
             if(node.depth()==0){//焦点行是树结构的第一层节点,灰显。
@@ -129,7 +131,7 @@ var projectObj = {
         let canUpMove = function (node) {
             if(node&&node.preSibling){//有前兄弟
                 if(node.sourceType==that.project.Bills.getSourceType()){
-                    if(projectObj.project.isBillsLocked()== true){
+                    if(projectObj.project.isBillsLocked()== true && projectObj.project.withinBillsLocked(node)){
                         return false;
                     }
                     if(node.data.type == billType.DXFY&&node.data.isAdd!==1){
@@ -143,7 +145,7 @@ var projectObj = {
         let canDownMove = function (node) {
             if(node&&node.nextSibling){
                 if(node.sourceType==that.project.Bills.getSourceType()){
-                    if(projectObj.project.isBillsLocked()== true){
+                    if(projectObj.project.isBillsLocked()== true && projectObj.project.withinBillsLocked(node)){
                         return false;
                     }
                     if(node.data.type == billType.DXFY&&node.data.isAdd!==1){
@@ -300,7 +302,14 @@ var projectObj = {
                 });
             }
         }
-        if(node.data.type==billType.FX||node.data.type==billType.BX||(node.data.type==billType.BILL&&node.source.children.length==0)){//是分项、补项或者叶子清单的情况下才需要查找替换
+        //分部分项、措施项目才匹配
+        let withinValidFixed = false;
+        let matchFixedFlags = [fixedFlag.SUB_ENGINERRING, fixedFlag.MEASURE];
+        let rootNode = getRootFixedNode(node);
+        if(rootNode && rootNode.data.flagsIndex && rootNode.data.flagsIndex.fixed && matchFixedFlags.includes(rootNode.data.flagsIndex.fixed.flag)){
+            withinValidFixed = true;
+        }
+        if(withinValidFixed && (node.data.type==billType.FX||node.data.type==billType.BX||(node.data.type==billType.BILL&&node.source.children.length==0))){//是分项、补项或者叶子清单的情况下才需要查找替换
             if (value&&value.length === 9 && /^[\d]+$/.test(value)) {
                 stdMatchCode = value;
                 formatCode = project.Bills.newFormatCode(stdMatchCode);
@@ -524,6 +533,8 @@ var projectObj = {
     mainSpreadEditEnded: function (sender, info) {
         let project = projectObj.project;
         let node = project.mainTree.items[info.row];
+        console.log( project.withinBillsLocked(node));
+        project.withinBillsLocked(node);
         let colSetting = projectObj.mainController.setting.cols[info.col];
         let fieldName = projectObj.mainController.setting.cols[info.col].data.field;
         // 检查输入类型等
@@ -706,7 +717,7 @@ var projectObj = {
                     name: "插入大项费用",
                     icon: 'fa-sign-in',
                     disabled: function () {
-                        return projectObj.project.isBillsLocked();
+                        return projectObj.project.isBillsLocked() && project.withinBillsLocked(project.mainTree.selected);
                         //return project.mainTree.selected ? project.mainTree.selected.sourceType !== project.Bills.getSourceType() : false;
                     },
                     callback: function (key, opt) {
@@ -788,7 +799,7 @@ var projectObj = {
                     icon: 'fa-sign-in',
                     disabled: function () {
                         let selected = project.mainTree.selected;
-                        if(projectObj.project.isBillsLocked()== false && selected && selected.sourceType === project.Bills.getSourceType()){
+                        if(!(projectObj.project.isBillsLocked()== true && project.withinBillsLocked(selected)) && selected && selected.sourceType === project.Bills.getSourceType()){
                             return false
                         }
                         return true;
@@ -950,8 +961,10 @@ var projectObj = {
                          return project.Bills.isEngineerEst(project.mainTree.selected);//当焦点行是“专业工程暂估价”时,右键可见并有效。
                     },
                     callback: function () {
-                        projectObj.editContent(project.mainTree.selected,'engineeringContent');
-                        //BlockController.pasteBlock(project.mainTree.selected);
+                        let node = project.Bills.getNodeByFlag(project.mainTree.selected,fixedFlag.ENGINEERING_ESITIMATE);
+                        if(node){
+                            projectObj.editContent(node,'engineeringContent');
+                        }
                     }
                 },
                 "editService": {
@@ -961,7 +974,10 @@ var projectObj = {
                         return project.Bills.isTotalService(project.mainTree.selected);//当焦点行是“总承包服务费”时,右键可见并有效。
                     },
                     callback: function () {
-                        projectObj.editContent(project.mainTree.selected,'serviceContent');
+                        let node = project.Bills.getNodeByFlag(project.mainTree.selected,fixedFlag.TURN_KEY_CONTRACT);
+                        if(node){
+                            projectObj.editContent(node,'serviceContent');
+                        }
                     }
                 },
                 "editAccording": {
@@ -971,7 +987,10 @@ var projectObj = {
                         return project.Bills.isClaimVisa(project.mainTree.selected);//当焦点行是“签证及索赔计价”时,右键可见并有效。
                     },
                     callback: function () {
-                        projectObj.editContent(project.mainTree.selected,'claimVisa');
+                        let node = project.Bills.getNodeByFlag(project.mainTree.selected,fixedFlag.CLAIM_VISA);
+                        if(node){
+                            projectObj.editContent(node,'claimVisa');
+                        }
                     }
                 }
             }
@@ -1470,7 +1489,7 @@ $('#downMove').click(function () {
         };
     }
 });
-$("a[name='lockBills']").click(function () {
+$("a[name='lockBills']").click(function () {//
     let lockBills = projectInfoObj.projectInfo.property.lockBills;
     lockBills = !lockBills;
     projectObj.project.updateLockBills(lockBills,function () {
@@ -1874,7 +1893,7 @@ function ifCanDelete() {
                 if(node.data.type == billType.DXFY&&node.data.isAdd!=1){
                     return false;
                 }
-                if(projectObj.project.isBillsLocked()== true){
+                if(projectObj.project.isBillsLocked()== true && projectObj.project.withinBillsLocked(node)){
                     return false;
                 }
                 if(projectObj.project.Bills.hasFlags(node)){

+ 14 - 4
web/building_saas/main/js/views/std_bills_lib.js

@@ -122,7 +122,7 @@ var billsLibObj = {
         return features;
     },
     insertBills: function (stdBillsJobData, stdBillsFeatureData, node) {
-        if(projectInfoObj.projectInfo.property.lockBills == true){
+        if(projectInfoObj.projectInfo.property.lockBills == true && projectObj.project.withinBillsLocked(node)){
             return false;
         }
         $.bootstrapLoading.start();
@@ -137,14 +137,24 @@ var billsLibObj = {
             if (existB) {
                 let std = JSON.parse(JSON.stringify(node.data));
                 std.unit = existB.unit;
-                ProjectController.addBills(projectObj.project, projectObj.mainController, std);
+                let canAdd = ProjectController.addBills(projectObj.project, projectObj.mainController, std);
+                if(canAdd === false && $.bootstrapLoading.isLoading()){
+                    $.bootstrapLoading.end();
+                }
             } else {
                 ConfirmModal.stdBillsUnit.check(node.data, function (std) {
-                    ProjectController.addBills(projectObj.project, projectObj.mainController, std);
+                    let canAdd = ProjectController.addBills(projectObj.project, projectObj.mainController, std);
+                    if(canAdd === false && $.bootstrapLoading.isLoading()){
+                        $.bootstrapLoading.end();
+                    }
                 });
             }
         } else {
-            ProjectController.addBills(projectObj.project, projectObj.mainController, node.data);
+            let canAdd = ProjectController.addBills(projectObj.project, projectObj.mainController, node.data);
+            if(canAdd === false && $.bootstrapLoading.isLoading()){
+                console.log('enter');
+                $.bootstrapLoading.end();
+            }
         }
         return true;
     },

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

@@ -88,7 +88,6 @@ $("#linkZMHS").click(function(){        // 子目换算
     pageCCOprObj.active = false;
     refreshSubSpread();
 
-
     gljOprObj.activeTab='#linkZMHS';
 });
 
@@ -361,4 +360,28 @@ let subViewObj = {
     }
 }
 
-$("#linkComments").click(subViewObj.linkTabClick);
+$("#linkComments").click(subViewObj.linkTabClick);
+
+$('#linkGLJ').on('shown.bs.tab', function () {
+    gljOprObj.showDataIfRationSelect(projectObj.project.mainTree.selected, '111111');
+});
+
+$('#linkZMHS').on('shown.bs.tab', function (e) {
+    if(zmhs_obj.coeSpread == null || zmhs_obj.assSpread == null){
+        zmhs_obj.initSpread();
+    }
+    zmhs_obj.refresh();
+    zmhs_obj.showZMHSData();
+});
+
+$('#linkComments').on('shown.bs.tab', function () {
+    subViewObj.loadComments(projectObj.project.mainTree.selected);
+});
+
+$('#linkGCLMX').on('shown.bs.tab', function () {
+    gljOprObj.showDataIfRationSelect(projectObj.project.mainTree.selected, '111111');
+});
+
+$('#linkAZZJF').on('shown.bs.tab', function () {
+    gljOprObj.showDataIfRationSelect(projectObj.project.mainTree.selected, '111111');
+});

+ 5 - 12
web/building_saas/main/js/views/zmhs_view.js

@@ -70,12 +70,16 @@ let zmhs_obj = {
 
     },
     showAssData:function (node) {
+        this.assSheet.suspendPaint();
+        this.assSheet.suspendEvent();
         let selected = node?node:projectObj.project.mainTree.selected;
         let assList = selected&&selected.data.rationAssList ? selected.data.rationAssList : [];
         this.assSheet.setRowCount(0);
         sheetCommonObj.showData(this.assSheet, this.assSetting, assList);
         this.assSheetData = assList;
         this.assSheet.getRange(assList.length,-1,this.assSheet.getRowCount()-assList.length, -1, GC.Spread.Sheets.SheetArea.viewport).locked(true);
+        this.assSheet.resumePaint();
+        this.assSheet.resumeEvent();
 
     },
     refresh:function () {
@@ -83,7 +87,7 @@ let zmhs_obj = {
         this.assSpread?this.assSpread.refresh():'';
     },
     showZMHSData:function (node) {
-        if(this.coeSpread&& this.assSpread){
+        if(this.coeSpread&& this.assSpread && $('#linkZMHS').hasClass('active')){
             this.showCoeData(node);
             this.showAssData(node);
             //hide floatingObject
@@ -381,14 +385,3 @@ let zmhs_obj = {
     }
 
 };
-
-
-$(function () {
-    $('#linkZMHS').on('shown.bs.tab', function (e) {
-        if(zmhs_obj.coeSpread == null || zmhs_obj.assSpread == null){
-            zmhs_obj.initSpread();
-        }
-        zmhs_obj.refresh();
-        zmhs_obj.showZMHSData();
-    })
-});

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

@@ -1186,7 +1186,10 @@ $(document).ready(function() {
 
     // 新增单位工程
     $("#add-tender-confirm").click(function() {
-        AddTender();
+        let suc = AddTender();
+        if(suc === false){
+            $('#add-tender-confirm').removeClass('disabled');
+        }
     });
 
     // 新增文件夹按钮点击