zhangweicheng 6 лет назад
Родитель
Сommit
977a0ab22d

+ 87 - 43
public/web/tree_sheet/tree_sheet_helper.js

@@ -150,10 +150,22 @@ var TREE_SHEET_HELPER = {
                     }
                     return data;
                 };
-                if(colSetting.data.field=="quantity"){
-                    let tag = node.data.quantityEXP?node.data.quantityEXP:'';
-                    sheet.setTag(iRow, iCol,tag);
+                if(sheet.name()=="mainSheet"){
+                    if(colSetting.data.field=="quantity"){
+                        let tag = node.data.quantityEXP?node.data.quantityEXP:'';
+                        sheet.setTag(iRow, iCol,tag);
+                    }
+                    if(colSetting.data.field=="code"){
+                        let tag = node.data.adjustState?node.data.adjustState:'';
+                        sheet.setTag(iRow, iCol,tag);
+                    }
+                    if(colSetting.data.field=="name"){
+                        let tag = node.data.itemCharacterText?node.data.itemCharacterText:'';
+                        sheet.setTag(iRow, iCol,tag);
+                    }
+
                 }
+
                 if (colSetting.data.getText && Object.prototype.toString.apply(colSetting.data.getText) === "[object Function]") {
                     cell.value(colSetting.data.getText(node));
                 } else {
@@ -352,6 +364,22 @@ var TREE_SHEET_HELPER = {
                 hitinfo.sheet.repaint();
             }
         };
+        TreeNodeCellType.prototype.processMouseEnter = function(hitinfo){
+            let text = hitinfo.sheet.getText(hitinfo.row, hitinfo.col);
+            let tag = hitinfo.sheet.getTag(hitinfo.row, hitinfo.col);
+            if(tag){
+                TREE_SHEET_HELPER.showTipsDiv(tag,setting,hitinfo);
+            }
+        };
+        TreeNodeCellType.prototype.processMouseLeave = function (hitinfo) {
+            let me = this;
+            TREE_SHEET_HELPER.tipDiv = 'hide';
+            if (me._toolTipElement) {
+                $(me._toolTipElement).hide();
+                me._toolTipElement = null;
+            };
+            TREE_SHEET_HELPER.tipDivCheck();//延时检查:当tips正在show的时候,就调用了hide方法,会导致tips一直存在,所以设置一个超时处理
+        };
 
         let TipCellType = function () {};
         TipCellType.prototype = new GC.Spread.Sheets.CellTypes.Text();
@@ -380,52 +408,27 @@ var TREE_SHEET_HELPER = {
             if(hitinfo.sheet.getCell(hitinfo.row,hitinfo.col).wordWrap()==true){
                 return;
             }
-            if(dataField === 'name' || dataField === 'itemCharacterText' || dataField === 'jobContentText' || dataField === 'adjustState'){
+            if(dataField === 'itemCharacterText' || dataField === 'jobContentText' || dataField === 'adjustState'){
                 if((hitinfo.sheet.getParent() === projectObj.mainSpread||hitinfo.sheet.getParent() === tender_obj.tenderSpread) && textLength <= cellWidth)
                  return;
             }
-            if(dataField=="quantity"){
-                text = tag;
-            }else if(tag !== undefined && tag) {
-                text = tag;
-            }
-            if (setting.pos && text && text !== '') {
-                if (!this._toolTipElement) {
-                    let div = $('#autoTip')[0];
-                    if (!div) {
-                        div = document.createElement("div");
-                        $(div).css("position", "absolute")
-                            .css("border", "1px #C0C0C0 solid")
-                            .css("box-shadow", "1px 2px 5px rgba(0,0,0,0.4)")
-                            .css("font", "9pt Arial")
-                            .css("background", "white")
-                            .css("padding", 5)
-                            .attr("id", 'autoTip');
-                        $(div).hide();
-                        document.body.insertBefore(div, null);
-                    }
-                    this._toolTipElement = div;
-                    //实时读取位置信息
-                    if(sheet && sheet.getParent().qo){
-                        setting.pos = SheetDataHelper.getObjPos(sheet.getParent().qo);
-                    }
-                    $(this._toolTipElement).text(text);
-                    //清单指引、清单库做特殊处理
-                    if($(sheet.getParent().qo).attr('id') === 'stdBillsSpread' || $(sheet.getParent().qo).attr('id') === 'billsGuidance_bills'){
-                        $(this._toolTipElement).css('top', '').css('left', '').css('width', '');
-                        let marginLeftMouse;
-                        if($(this._toolTipElement).width() < hitinfo.x){
-                            marginLeftMouse = hitinfo.x - $(this._toolTipElement).width();
-                        }
-                       $(this._toolTipElement).css("top", setting.pos.y + hitinfo.y + 15).css("left", marginLeftMouse ? setting.pos.x + marginLeftMouse : setting.pos.x);
-                    }
-                    else {
-                        $(this._toolTipElement).css("top", setting.pos.y + hitinfo.y + 15).css("left", setting.pos.x + hitinfo.x + 15);
+
+            if(hitinfo.sheet.name()=="mainSheet"){
+                if(dataField=="quantity"){//显示工程量明细
+                    text = tag;
+                }if(dataField=="name"){//项目特征及内容隐藏时,显示特征及内容
+                    if(projectObj.ifItemCharHiden(setting)&&tag!=''){
+                        text = tag;
+                    }else if(textLength <= cellWidth){
+                        return;
                     }
-                    $(this._toolTipElement).show("fast");
-                    TREE_SHEET_HELPER.tipDiv = 'show';//做个标记
+                }
+                else if(tag !== undefined && tag) {
+                    text = tag;
                 }
             }
+
+            TREE_SHEET_HELPER.showTipsDiv(text,setting,hitinfo);
         };
         TipCellType.prototype.processMouseLeave = function (hitinfo) {
             let me = this;
@@ -460,6 +463,47 @@ var TREE_SHEET_HELPER = {
             TREE_SHEET_HELPER.refreshNodesVisible(tree.roots, sheet, true);
         });
     },
+    showTipsDiv:function (text,setting,hitinfo) {
+        if (setting.pos && text && text !== '') {
+            if (!this._toolTipElement) {
+                let div = $('#autoTip')[0];
+                if (!div) {
+                    div = document.createElement("div");
+                    $(div).css("position", "absolute")
+                        .css("border", "1px #C0C0C0 solid")
+                        .css("box-shadow", "1px 2px 5px rgba(0,0,0,0.4)")
+                        .css("font", "9pt Arial")
+                        .css("background", "white")
+                        .css("padding", 5)
+                        .attr("id", 'autoTip');
+                    $(div).hide();
+                    document.body.insertBefore(div, null);
+                }
+                this._toolTipElement = div;
+                //实时读取位置信息
+                if(hitinfo.sheet && hitinfo.sheet.getParent().qo){
+                    setting.pos = SheetDataHelper.getObjPos(hitinfo.sheet.getParent().qo);
+                }
+                $(this._toolTipElement).text(text);
+                //清单指引、清单库做特殊处理
+                if($(hitinfo.sheet.getParent().qo).attr('id') === 'stdBillsSpread' || $(hitinfo.sheet.getParent().qo).attr('id') === 'billsGuidance_bills'){
+                    $(this._toolTipElement).css('top', '').css('left', '').css('width', '');
+                    let marginLeftMouse;
+                    if($(this._toolTipElement).width() < hitinfo.x){
+                        marginLeftMouse = hitinfo.x - $(this._toolTipElement).width();
+                    }
+                    $(this._toolTipElement).css("top", setting.pos.y + hitinfo.y + 15).css("left", marginLeftMouse ? setting.pos.x + marginLeftMouse : setting.pos.x);
+                }
+                else {
+                    $(this._toolTipElement).css("top", setting.pos.y + hitinfo.y + 15).css("left", setting.pos.x + hitinfo.x + 15);
+                }
+                $(this._toolTipElement).show("fast");
+                TREE_SHEET_HELPER.tipDiv = 'show';//做个标记
+            }
+        }
+    },
+
+
     tipDivCheck(){
         setTimeout(function () {
             let tips = $('#autoTip');

+ 15 - 5
web/building_saas/main/js/models/project_glj.js

@@ -177,12 +177,12 @@ ProjectGLJ.prototype.loadCacheData = function (resort) {
     }
 };
 
-ProjectGLJ.prototype.updatePriceFromRG = function (recode, updateField, newval) {
+ProjectGLJ.prototype.updatePriceFromRG = function (recode, updateField, newval,callback) {
     if (updateField == 'marketPrice') {
-        this.updatePrice(recode, "market_price", newval,"rg");
+        this.updatePrice(recode, "market_price", newval,"rg",callback);
     }
     if (updateField == 'basePrice') {
-        this.updatePrice(recode, "base_price", newval,"rg");
+        this.updatePrice(recode, "base_price", newval,"rg",callback);
     }
 };
 
@@ -257,6 +257,15 @@ ProjectGLJ.prototype.updateGLJProperty = function (node, updateField, newval) {
 
 }
 
+ProjectGLJ.prototype.getPriceDecimal = function (glj) {//价格的小数位数,有无组成物,取值不同
+    if(notEditType.indexOf(glj.unit_price.type)!=-1&&glj.ratio_data.length>0){
+         return getDecimal("glj.unitPriceHasMix");
+    }else {
+        return getDecimal('glj.unitPrice');
+    }
+
+};
+
 ProjectGLJ.prototype.updatePrice = function (recode, updateField, newval,from,cb) {
     let me = this;
     let projectGljs = this.datas.gljList;
@@ -266,6 +275,7 @@ ProjectGLJ.prototype.updatePrice = function (recode, updateField, newval,from,cb
         if(glj.unit_price[updateField] == newval){
             return;
         }
+        newval = scMathUtil.roundForObj(newval,this.getPriceDecimal(glj));
         let data = {id: glj.unit_price.id, field: updateField, newval: newval,project_id:glj.project_id,unit_price_file_id:glj.unit_price.unit_price_file_id};
         let callback = function (data) {
             if (updateField == 'base_price') {
@@ -348,7 +358,6 @@ ProjectGLJ.prototype.batchUpdateGLJProperty = function (updateMap,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=[];
@@ -362,9 +371,10 @@ ProjectGLJ.prototype.batchUpdatePrice = function (changeInfo,sheetName,callback)
         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);
             let glj = _.find(projectGljs, {'id': recode.id});
+            let newValue = ci.value;
             if(glj&&glj.unit_price[editField]!=newValue){
+                newValue= scMathUtil.roundForObj(ci.value,this.getPriceDecimal(glj));
                 updateData.push({unit_price: glj.unit_price, field: editField, newval: newValue,project_id:glj.project_id});
                 newValueMap[glj.id]={field:editField,value:newValue};
                 gljs.push(glj);

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

@@ -541,7 +541,7 @@ var Ration = {
                 })
             }
         };
-        ration.prototype.addNewRation = function (itemQuery,rationType,callback=null) {
+        ration.prototype.addNewRation = function (itemQuery,rationType,callback=null,isEmpty=false) {
             let me = this;
             let project = projectObj.project, sheetController = projectObj.mainController;
             let engineering = projectInfoObj.projectInfo.property.engineering;
@@ -572,7 +572,7 @@ var Ration = {
             };
             if(billItemID){
                 let newData =  me.getTempRationData(me.getNewRationID(), billItemID, serialNo, rationType);
-                let calQuantity = optionsOprObj.getOption(optionsOprObj.optionsTypes.GENERALOPTS, 'rationQuanACToBillsQuan');
+                let calQuantity =  isEmpty===true?false:optionsOprObj.getOption(optionsOprObj.optionsTypes.GENERALOPTS, 'rationQuanACToBillsQuan');
                 let brUpdate = [];
                 //更新兄弟节点的序列号
                 if (pre) {

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

@@ -737,7 +737,7 @@ var gljOprObj = {
             if (args.editingText == null) {
                 updateField == 'marketPrice' ? newval = 0 : newval = "";
             } else {
-                var decimal = updateField == 'customQuantity' ? getDecimal("glj.quantity") : getDecimal("glj.unitPrice");
+                var decimal = updateField == 'customQuantity' ? getDecimal("glj.quantity") : 6;//对于市场价和定额价,这里只是中间的小数位数,后面更新前会根据有没有组成物再取值
                 newval = number_util.checkNumberValue(args.editingText, decimal);
                 if (newval == null) {
                     me.sheet.getCell(args.row, args.col).value(recode[updateField]);

+ 1 - 2
web/building_saas/main/js/views/project_glj_view.js

@@ -893,8 +893,7 @@ projectGljObject={
             }
             gljOprObj.refreshView();
         };
-        if(dataCode=='basePrice'||dataCode=='marketPrice'){
-            value= scMathUtil.roundForObj(value,getDecimal('glj.unitPrice'));//修改市场价和修改定额价时需要重新记算很多受影响的树节点,现在改成与定字额工料机那里调相同的方法。
+        if(dataCode=='basePrice'||dataCode=='marketPrice'){//修改市场价和修改定额价时需要重新记算很多受影响的树节点,现在改成与定字额工料机那里调相同的方法。
             let editField = dataCode === 'basePrice'?"base_price":"market_price";
             projectObj.project.projectGLJ.updatePrice(recode,editField,value,'pg',callback);
         }else {

+ 19 - 10
web/building_saas/main/js/views/project_view.js

@@ -842,7 +842,7 @@ var projectObj = {
                             newCol = codeCol;
                         }
                         sheet.setActiveCell(newRow, newCol);
-                    });
+                    },true);
                 }
             }
             //在定额/量价/人材机的编码单元格回车,焦点应跳动至本行的工程量单元格
@@ -1029,7 +1029,7 @@ var projectObj = {
                         return !project.Ration.canAdd(project.mainTree.selected);
                     },
                     callback: function (key, opt) {
-                        project.Ration.addNewRation(null,rationType.ration);
+                        project.Ration.addNewRation(null,rationType.ration,null,true);
                        // ProjectController.addRation(project, controller, rationType.ration);
                     }/*,
                     visible: function(key, opt){
@@ -1046,7 +1046,7 @@ var projectObj = {
                         return !project.Ration.canAdd(project.mainTree.selected);
                     },
                     callback: function (key, opt) {
-                        project.Ration.addNewRation(null,rationType.volumePrice);
+                        project.Ration.addNewRation(null,rationType.volumePrice,null,true);
                        // ProjectController.addRation(project, controller, rationType.volumePrice);
                     }/*,
                     visible: function(key, opt){
@@ -1163,10 +1163,11 @@ var projectObj = {
                     name: '编辑工程内容',
                     icon: 'fa-edit',
                     visible: function(key, opt){
-                         return project.Bills.isEngineerEst(project.mainTree.selected);//当焦点行是“专业工程暂估价”时,右键可见并有效。
+                         let  selected = project.mainTree.selected;
+                         return selected.sourceType==ModuleNames.bills&&project.Bills.isEngineerEst(selected);//当焦点行是“专业工程暂估价”时,右键可见并有效。
                     },
                     callback: function () {
-                        let node = project.Bills.getNodeByFlag(project.mainTree.selected,fixedFlag.ENGINEERING_ESITIMATE);
+                        let node = project.mainTree.selected;//project.Bills.getNodeByFlag(project.mainTree.selected,fixedFlag.ENGINEERING_ESITIMATE);
                         if(node){
                             projectObj.editContent(node,'engineeringContent');
                         }
@@ -1176,10 +1177,11 @@ var projectObj = {
                     name: '编辑服务内容',
                     icon: 'fa-edit',
                     visible: function(key, opt){
-                        return project.Bills.isTotalService(project.mainTree.selected);//当焦点行是“总承包服务费”时,右键可见并有效。
+                        let  selected = project.mainTree.selected;
+                        return selected.sourceType==ModuleNames.bills&&project.Bills.isTotalService(selected);//当焦点行是“总承包服务费”时,右键可见并有效。
                     },
                     callback: function () {
-                        let node = project.Bills.getNodeByFlag(project.mainTree.selected,fixedFlag.TURN_KEY_CONTRACT);
+                        let node = project.mainTree.selected;//project.Bills.getNodeByFlag(project.mainTree.selected,fixedFlag.TURN_KEY_CONTRACT);
                         if(node){
                             projectObj.editContent(node,'serviceContent');
                         }
@@ -1189,10 +1191,11 @@ var projectObj = {
                     name: '编辑签证及索赔依据',
                     icon: 'fa-edit',
                     visible: function(key, opt){
-                        return project.Bills.isClaimVisa(project.mainTree.selected);//当焦点行是“签证及索赔计价”时,右键可见并有效。
+                        let  selected = project.mainTree.selected;
+                        return selected.sourceType==ModuleNames.bills&&project.Bills.isClaimVisa(selected);//当焦点行是“签证及索赔计价”时,右键可见并有效。
                     },
                     callback: function () {
-                        let node = project.Bills.getNodeByFlag(project.mainTree.selected,fixedFlag.CLAIM_VISA);
+                        let node = project.mainTree.selected;//project.Bills.getNodeByFlag(project.mainTree.selected,fixedFlag.CLAIM_VISA);
                         if(node){
                             projectObj.editContent(node,'claimVisa');
                         }
@@ -1604,7 +1607,13 @@ var projectObj = {
             let newValue = hintBox.value;
             projectObj.updateNodeField(node,newValue,fieldID);
         });
-    }
+    },
+    ifItemCharHiden:function (setting) {//项目特征及内容列是否隐藏
+        let col = _.find(setting.cols,function (item) {
+            return  item.data.field == "itemCharacterText";
+        })
+        return !col.data.visible;
+    },
 
 };
 

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

@@ -188,11 +188,13 @@ let quantityEditObj = {
     },
     checkingAndUpdate(quantityEXP,node){
         let me = this;
-        quantityEXP = quantityEXP?quantityEXP.toUpperCase():'';//非空判断
         if(quantityEXP === node.data.quantityEXP){ //没有变化,不做任何操作
             projectObj.mainController.refreshTreeNode([node]);
             return true;
         }
+        quantityEXP = quantityEXP?quantityEXP.toUpperCase():'';//非空判断
+        quantityEXP =replaceAll('(','(',quantityEXP);//转换中文左右符号
+        quantityEXP =replaceAll(')',')',quantityEXP);
         let value = me.evalQuantityExp(quantityEXP,node);
         if(value!=='evalError'){
             if(node.data.hasOwnProperty('isFromDetail')&&node.data.isFromDetail==1){