Browse Source

bug fixed

zhangweicheng 7 years ago
parent
commit
603a1415d0

+ 10 - 9
web/building_saas/main/js/models/project_glj.js

@@ -646,9 +646,10 @@ ProjectGLJ.prototype.getBasePrice = function(glj){
 };
 
 
-ProjectGLJ.prototype.getMarketPrice = function (glj) {
+ProjectGLJ.prototype.getMarketPrice = function (glj,needRound) {
     let price_decimal = getDecimal("glj.unitPrice");
     let quantity_decimal = getDecimal("glj.quantity");
+    let process_decimal = needRound==true?price_decimal:getDecimal("process");
     if (notEditType.indexOf(glj.unit_price.type)!=-1&&glj.ratio_data.length>0) {//对于混凝土、配合比、砂浆、机械台班等有组成物的材料,价格需根据组成物计算得出。
         let p =0;
         for(let ratio of glj.ratio_data){
@@ -661,8 +662,8 @@ ProjectGLJ.prototype.getMarketPrice = function (glj) {
             });
             if(tem){
                 let priceData={};
-                gljOprObj.setGLJPrice(priceData,tem);
-                p+=scMathUtil.roundForObj(priceData.marketPrice*scMathUtil.roundForObj(ratio.consumption,quantity_decimal),price_decimal);
+                gljOprObj.setGLJPrice(priceData,tem,true);
+                p+=scMathUtil.roundForObj(priceData.marketPrice*scMathUtil.roundForObj(ratio.consumption,quantity_decimal),process_decimal);
             }
         }
         return scMathUtil.roundForObj(p,price_decimal);
@@ -698,12 +699,12 @@ ProjectGLJ.prototype.calcQuantity  = function (){
         pglj.subdivisionQuantity = 0;
         pglj.techQuantity = 0;
         pglj.quantity = 0;
-        if(rationGljGroup[pglj.id]){
-            let result = this.getQuantityPerGLJ(rationGljGroup[pglj.id],rations,rationMap,pglj,quantityMap);
-            pglj.subdivisionQuantity = result.subdivisionQuantity;
-            pglj.techQuantity = result.techQuantity;
-            pglj.quantity = result.quantity;
-        }
+        let gljGroup = rationGljGroup[pglj.id]?rationGljGroup[pglj.id]:[];//定额工料机没有,有可能是定额类型的工料机
+        let result = this.getQuantityPerGLJ(gljGroup,rations,rationMap,pglj,quantityMap);
+        pglj.subdivisionQuantity = result.subdivisionQuantity;
+        pglj.techQuantity = result.techQuantity;
+        pglj.quantity = result.quantity;
+
         quantityMap[pg_index] = pglj;
     }
     //计算做为组成物的消耗量

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

@@ -962,16 +962,16 @@ var gljOprObj = {
         }
         return ration_gljs;
     },
-    setGLJPrice:function (data,glj) {
+    setGLJPrice:function (data,glj,isRadio = false) {//isRadio 标记是否算组成物的价格
         let proGLJ =  projectObj.project.projectGLJ;
         glj = glj?glj:_.find(proGLJ.datas.gljList, {'id': data.projectGLJID});
-        data.marketPrice = proGLJ.getMarketPrice(glj);
+        data.marketPrice = proGLJ.getMarketPrice(glj,needRound);
         if(this.calcPriceDiff(glj)==true) {//计取价差
-            data.basePrice = proGLJ.getBasePrice(glj);
-            data.adjustPrice = proGLJ.getAdjustPrice(glj);
+            data.basePrice = proGLJ.getBasePrice(glj,needRound);
+            data.adjustPrice = proGLJ.getAdjustPrice(glj,needRound);
         }else {//不计价差
-            data.basePrice = proGLJ.getMarketPrice(glj);
-            data.adjustPrice = proGLJ.getMarketPrice(glj);
+            data.basePrice = proGLJ.getMarketPrice(glj,needRound);
+            data.adjustPrice = proGLJ.getMarketPrice(glj,needRound);
         }
         return data;
 

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

@@ -503,6 +503,7 @@ $(function () {
             me.initProjectGljSpread();
         }
         me.unitPriceFileInit();
+        //projectObj.project.projectGLJ.calcQuantity(); 在工程量有更新的地方调用
         me.showProjectGljData();
         loadSize("project-glj-main", function () {
             me.projectGljSpread.refresh();

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

@@ -487,7 +487,7 @@ var projectObj = {
     mainSpreadEditStarting: function (sender, info) {
         let project = projectObj.project;
         let node = project.mainTree.items[info.row];
-        if(isDef(node) && node.sourceType === project.Ration.getSourceType() && isDef(node.data.code) && isDef(node.data.from) && node.data.from === 'cpt'){
+        if(isDef(node) && node.sourceType === project.Ration.getSourceType() && isDef(node.data.code) && isDef(node.data.from) && node.data.from === 'cpt'&&info.col ==0){
             let orgV = info.sheet.getValue(info.row, info.col);
             let newV = orgV.replace(new RegExp('补'), '');
             info.sheet.setValue(info.row, info.col, newV);
@@ -570,6 +570,7 @@ var projectObj = {
         this.project = PROJECT.createNew(scUrlUtil.GetQueryString('project'), userID);
         let startTime = +new Date();
         console.log("开始加载-----"+startTime);
+        $.bootstrapLoading.start();
         this.project.loadDatas(function (err) {
             let mTime = +new Date();
             console.log(`get data时间——${mTime - startTime}`);
@@ -647,6 +648,7 @@ var projectObj = {
                 that.mainSpread.bind(GC.Spread.Sheets.Events.ClipboardChanged, that.msClipboardChanged);
                 that.mainSpread.bind(GC.Spread.Sheets.Events.ButtonClicked, that.onButtonClick);
                 that.mainSpread.bind(GC.Spread.Sheets.Events.CellDoubleClick, that.onCellDoubleClick);
+                that.mainSpread.commandManager().setShortcutKey(undefined, GC.Spread.Commands.Key.z, true, false, false, false);
                 //let loadOtherStartTime = +new Date();
                 that.loadMainSpreadContextMenu();
                 that.loadFocusLocation();
@@ -660,6 +662,7 @@ var projectObj = {
                 //初始需要触发一次点击表格事件,sheet.getAutoFitWidth值(获取单元格文本长度)才正确
                 autoFlashHeight();
                 projectObj.refreshMainSpread();
+                $.bootstrapLoading.end();
             }
             else {