zhangweicheng преди 6 години
родител
ревизия
9792461da2

+ 13 - 5
public/web/common_ajax.js

@@ -27,7 +27,7 @@ var CommonAjax = {
                 }
             },
             error: function(jqXHR, textStatus, errorThrown){
-                alert('url: ' + url +' error ' + textStatus + " " + errorThrown);
+                ajaxErrorInfo(jqXHR, textStatus, errorThrown);
                 if (errorCallback) {
                     errorCallback();
                 }
@@ -55,7 +55,7 @@ var CommonAjax = {
                 }
             },
             error: function(jqXHR, textStatus, errorThrown){
-                alert('error ' + textStatus + " " + errorThrown);
+                ajaxErrorInfo(jqXHR, textStatus, errorThrown);
                 if (errorCallback) {
                     errorCallback();
                 }
@@ -84,7 +84,7 @@ var CommonAjax = {
                 }
             },
             error: function(jqXHR, textStatus, errorThrown){
-                alert('url: ' + url +' error ' + textStatus + " " + errorThrown);
+                ajaxErrorInfo(jqXHR, textStatus, errorThrown);
                 if (exceptionCallback) {
                     exceptionCallback();
                 }
@@ -97,8 +97,8 @@ var CommonAjax = {
             type: 'post',
             data: data,
             dataType: 'json',
-            error: function() {
-                alert('数据传输有误!');
+            error: function(jqXHR, textStatus, errorThrown) {
+                ajaxErrorInfo(jqXHR, textStatus, errorThrown);
                 if (errorCallback) {
                     errorCallback();
                 }
@@ -143,4 +143,12 @@ function getTopWindow() {
         p = p.parent;
     }
     return p;
+}
+
+function ajaxErrorInfo(jqXHR, textStatus, errorThrown) {
+    if(textStatus == 'timeout'){
+        alert('网络连接超时,请刷新您的网页。');
+    }else {
+        alert('url: ' + url +' error ' + textStatus + " " + errorThrown);
+    }
 }

+ 6 - 6
web/building_saas/fee_rates/fee_rate.js

@@ -33,8 +33,8 @@ function loadProjectFeeRates(fileID) {
                 createSpreadView(true);
             }
         },
-        error: function (result) {
-            alert('内部程序错误!');
+        error: function (jqXHR, textStatus, errorThrown) {
+            ajaxErrorInfo(jqXHR, textStatus, errorThrown);
         }
     });
 }
@@ -55,8 +55,8 @@ function loadStdFeeRateLibNames(region) {
                 $("#inlineFormCustomSelect").get(0).selectedIndex = 0;
             }
         },
-        error: function (result) {
-            alert('内部程序错误!');
+        error: function (jqXHR, textStatus, errorThrown) {
+            ajaxErrorInfo(jqXHR, textStatus, errorThrown);
         }
     });
 }
@@ -72,8 +72,8 @@ function loadLibFeeRates(libID) {
                 createSpreadView(false);
             }
         },
-        error: function (result) {
-            alert('内部程序错误!');
+        error: function (jqXHR, textStatus, errorThrown) {
+            ajaxErrorInfo(jqXHR, textStatus, errorThrown);
         }
     });
 }

+ 6 - 4
web/building_saas/glj/js/composition_spread.js

@@ -124,7 +124,8 @@ CompositionSpread.prototype.getRatioData = function(projectGLJid) {
         url: '/glj/get-ratio',
         type: 'post',
         data: {id: projectGLJid, project_id: scUrlUtil.GetQueryString('project')},
-        error: function() {
+        error: function(jqXHR, textStatus, errorThrown) {
+            ajaxErrorInfo(jqXHR, textStatus, errorThrown);
             self.sheetObj.setData(null);
         },
         beforeSend: function() {
@@ -213,8 +214,8 @@ CompositionSpread.prototype.updateConsumption = function(info, callback) {
         type: 'post',
         data: {id: id, field: 'mix_ratio.' + field, value: value, market_price: parentMarketPrice, base_price: parentBasePrice},
         dataType: 'json',
-        error: function() {
-            alert('数据传输有误!');
+        error: function(jqXHR, textStatus, errorThrown) {
+            ajaxErrorInfo(jqXHR, textStatus, errorThrown);
             self.isChanging = false;
             activeSheet.setValue(row, column, info.oldValue);
         },
@@ -308,7 +309,8 @@ CompositionSpread.prototype.deleteComposition = function (id, row, callback) {
         type: 'post',
         data: {id: id},
         dataType: 'json',
-        error: function() {
+        error: function(jqXHR, textStatus, errorThrown) {
+            ajaxErrorInfo(jqXHR, textStatus, errorThrown);
             isDeleting = false;
             alert('服务器繁忙');
         },

+ 2 - 2
web/building_saas/glj/js/project_glj_spread.js

@@ -244,8 +244,8 @@ ProjectGLJSpread.prototype.postUpdate=function (id,field,value,info,extend,callb
         type: 'post',
         data: {id: id, field: field, value: value, extend: extend},
         dataType: 'json',
-        error: function() {
-            alert('数据传输有误!');
+        error: function(jqXHR, textStatus, errorThrown) {
+            ajaxErrorInfo(jqXHR, textStatus, errorThrown);
             isChanging = false;
         },
         beforeSend: function() {

+ 1 - 4
web/building_saas/main/js/controllers/block_controller.js

@@ -607,10 +607,7 @@ let BlockController = {
         return selected.sourceType == projectObj.project.Bills.getSourceType() && selected.data.type == billType.FB;
     },
     isFXorBX:function (selected) {//是分项或者补项
-        if(selected.sourceType == projectObj.project.Bills.getSourceType()){
-            return   selected.data.type == billType.FX || selected.data.type == billType.BX;
-        }
-        return false;
+        return projectObj.project.Bills.isFXorBX(selected);
     },
     blockIsFXorBX: function (type) {
         return type == blockType.FX||type == blockType.BX;

+ 6 - 0
web/building_saas/main/js/models/bills.js

@@ -506,6 +506,12 @@ var Bills = {
                 return false;
             }
         };
+        bills.prototype.isFXorBX=function (node) {//是分项或者补项
+            if(node.sourceType == projectObj.project.Bills.getSourceType()){
+                return   node.data.type == billType.FX || node.data.type == billType.BX;
+            }
+            return false;
+        };
         bills.prototype.nodeFlagCheck = function (node,fixedFlag) {//判断节点类型
             let flagCheck = function (checkNode) {
                 if(isFlag(checkNode.data)&&checkNode.data.flagsIndex.fixed.flag==fixedFlag){

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

@@ -692,8 +692,8 @@ ProjectGLJ.prototype.refreshTreeNodePriceIfNeed = function (data) {
     if ((data.unit_price.type == gljType.MAIN_MATERIAL || data.unit_price.type == gljType.EQUIPMENT) && projectInfoObj.projectInfo.property.displaySetting.disPlayMainMaterial == true) {
         var nodes = _.filter(projectObj.project.mainTree.items, function (tem) {
             if (tem.sourceType == ModuleNames.ration_glj && tem.data.projectGLJID == data.id) {
-                tem.data.marketUnitFee = data.unit_price.market_price;
-                tem.data.marketPrice = data.unit_price.market_price;
+                tem.data.marketUnitFee = this.getMarketPrice(data);//data.unit_price.market_price;
+                tem.data.marketPrice = this.getMarketPrice(data);//data.unit_price.market_price;
                 return true;
             }
         })
@@ -751,8 +751,8 @@ ProjectGLJ.prototype.getImpactRationNodes = function (gljs) {
 ProjectGLJ.prototype.refreshRationGLJPrice = function (glj) {
     for (let ration_glj of gljOprObj.sheetData) {
         if (ration_glj.projectGLJID == glj.id) {
-            ration_glj.basePrice = glj.unit_price.base_price;
-            ration_glj.marketPrice = glj.unit_price.market_price;
+            ration_glj.basePrice = this.getBasePrice(glj);
+            ration_glj.marketPrice = this.getMarketPrice(glj);
             ration_glj.adjustPrice = this.getAdjustPrice(glj);
         }
     }

+ 31 - 46
web/building_saas/main/js/views/glj_view.js

@@ -100,17 +100,9 @@ var gljOprObj = {
         sheetCommonObj.initSheet(me.sheet, me.setting, 30);
         sheet.name('ration_glj');
         me.bindSheetEvent(sheet);
-        sheet.bind(GC.Spread.Sheets.Events.CellClick, me.onCellClick);
         sheet.bind(GC.Spread.Sheets.Events.CellDoubleClick, me.onCellDoubleClick);
         sheet.bind(GC.Spread.Sheets.Events.ClipboardChanged, me.onClipboardChanged);
         subSpread.bind(GC.Spread.Sheets.Events.ButtonClicked, me.onButtonClick);
-        sheet.bind(GC.Spread.Sheets.Events.EditStarting, function (sender, args) {
-            if (args.row>=me.sheetData.length){
-                args.cancel = true;
-            }else if (me.sheetData[args.row].isMixRatio) {
-                args.cancel = true;
-            }
-        });
         if(!projectReadOnly){
             gljContextMenu.loadGLJSpreadContextMenu();
         }
@@ -125,15 +117,6 @@ var gljOprObj = {
         // me.detailSheet.selectionUnit(0);//0 cell,1 row,2 col;
         sheet.name('quantity_detail');
         me.bindSheetEvent(sheet);
-        sheet.bind(GC.Spread.Sheets.Events.EditStarting, function (sender, args) {
-            if(me.detailSheetReadonly()){
-                args.cancel = true;
-            }else {
-                if(args.sheet.getValue(args.row,args.col)==null){//这里是为了解决当单元格里的值是null的时候,在单元格里输入数据,按键盘箭头移动光标的时候,会直接结束编辑,跳到另外的单元格。
-                    args.sheet.setValue(args.row,args.col,"");
-                }
-            }
-        });
     },
     detailSheetReadonly:function () {
         let selected = projectObj.project.mainTree.selected;
@@ -186,6 +169,19 @@ var gljOprObj = {
         if(selected){
             if(me.isInstallationNode(selected)==true){
                 args.cancel = true;
+            }else {
+                if(args.sheetName == 'quantity_detail'){//工程量明细表
+                    if(me.detailSheetReadonly()){
+                        args.cancel = true;
+                    }else {
+                        if(args.sheet.getValue(args.row,args.col)==null){//这里是为了解决当单元格里的值是null的时候,在单元格里输入数据,按键盘箭头移动光标的时候,会直接结束编辑,跳到另外的单元格。
+                            args.sheet.setValue(args.row,args.col,"");
+                        }
+                    }
+                }
+                if(args.sheetName == 'ration_glj'){//定额工料机表
+                    if(!me.rationGLJEditCheck(args)) args.cancel = true;
+                }
             }
         }else {
             args.cancel = true;
@@ -284,14 +280,6 @@ var gljOprObj = {
             installationFeeObj.onRationInstallValueChange(sender,args);
         }
     },
-    onCellClick: function (sender, args) {
-        console.log('cellClick');
-        var me = gljOprObj;
-        if (args.row >= me.sheetData.length) {
-            return;
-        }
-        me.editChecking(args);
-    },
     onCellDoubleClick:function (sender, args) {
         var me = gljOprObj;
         var header = me.setting.header;
@@ -317,39 +305,32 @@ var gljOprObj = {
         sheetCommonObj.copyTextToClipboard(cDatas);
         return;
     },
-    editChecking: function (args) {
+    rationGLJEditCheck:function (args) {//true 可以编辑,false 不能编辑
         var me = gljOprObj;
         var header = me.setting.header;
-        var disable = null;
-        if (me.sheetData[args.row] != undefined) {
-            if (me.sheetData[args.row].isMixRatio) {
-                disable = true;
+        if (_.includes(me.setting.view.lockColumns, args.col))  return false;//如果是锁定的列,不能编辑
+        if(me.sheetData[args.row] != undefined){
+            if(me.sheetData[args.row].isMixRatio){//对于组成物列
+               return header[args.col].dataCode == 'marketPrice'//允许修改组成物市单价,其它的不可以
             }else {
                 if (header[args.col] && header[args.col].dataCode == 'marketPrice') {
-                    if(me.marketPriceReadOnly({data:me.sheetData[args.row]})){
-                        disable = true;
-                    }else {
-                        disable = false;
-                    }
+                    return !me.marketPriceReadOnly({data:me.sheetData[args.row]});
                 }
                 if (header[args.col] && header[args.col].dataCode == 'basePrice') {
                     var isAdd = me.sheetData[args.row].isAdd;
                     if(isAdd==1){//是新增但没有组成物时允许修改定额价
-                        if(me.marketPriceReadOnly({data:me.sheetData[args.row]})){//如果有组成物,不可修改
-                            disable = true;
-                        }else {
-                            disable = false;
-                        }
+                        return !me.marketPriceReadOnly({data:me.sheetData[args.row]});//如果有组成物,不可修改
                     } else {
-                        disable = true;
+                        return false;
                     }
                 }
+                return true;
             }
+        }else {
+            return false
         }
-        if (disable != null) {
-            me.sheet.getCell(args.row, args.col, GC.Spread.Sheets.SheetArea.viewport).locked(disable);
-        }
-    },
+    }
+    ,
     hasComposition:function (ration_glj,isRationType) {//判断是否有组成物,有则返回true   现在主材类型的工料机也有可能有组成物。
         let type = isRationType==true? ration_glj.subType:ration_glj.type;
         if(notEditType.indexOf(type)!=-1||type==gljType.MAIN_MATERIAL){
@@ -516,7 +497,7 @@ var gljOprObj = {
             this.sheet.setSelection(selected[0].row,selected[0].col,selected[0].rowCount,selected[0].colCount);
         }
     },
-    getUnitPriceCodeMap : function (sheetData) {//取单价文件中,编码前缀一样的映射表
+    getUnitPriceCodeMap : function () {//取单价文件中,编码前缀一样的映射表
         let codeMap = {};
         let priceMap = projectObj.project.projectGLJ.datas.unitPriceMap;
         if(priceMap){
@@ -749,6 +730,10 @@ var gljOprObj = {
         var updateField = me.setting.header[args.col].dataCode;
         var recode = me.sheetData[args.row];
         var newval;
+        if(!me.rationGLJEditCheck(args)){
+            recode? me.sheet.getCell(args.row, args.col).value(recode[updateField]): me.sheet.getCell(args.row, args.col).value(null);
+            return;
+        }
         if (updateField == 'marketPrice' || updateField == 'customQuantity' || updateField == 'basePrice') {
             if (args.editingText == null) {
                 updateField == 'marketPrice' ? newval = 0 : newval = "";

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

@@ -551,16 +551,16 @@ var projectObj = {
 
     },
     showBillOrRationLib(node){
+        let BILLS = projectObj.project.Bills;
         if(node.sourceType == ModuleNames.bills){//当清单是“分部分项工程”、“措施项目工程”时,要展开清单规则节点
-
+            if(BILLS.isFXorBX(node)||(node.data.type == billType.BILL && BILLS.isMeasure(node))){//是分项或补项,是清单并且属于措施项目节点
+                if(!$("#qd").is(":visible"))  $('#stdBillsTab').click();
+            }
+        }
+        if(node.sourceType == ModuleNames.ration){ //在定额编码中双击,如果右侧定额库没有展开,则自动展开。
+            if(!$("#de").is(":visible"))  $('#stdRationTab').click();
         }
 
-
-
-/*
-        if(node){
-            if(!$("#qd").is(":visible"))  $('#stdBillsTab').click();
-        }*/
     },
     onColumnWidthChanged: function (sender, info) {         // CSL,2018.07.25
         if (info.colList.includes(4) || info.colList.includes(5)){