소스 검색

bug fixed

zhangweicheng 7 년 전
부모
커밋
d6b9bcfea8

+ 43 - 32
web/building_saas/glj/js/composition.js

@@ -12,47 +12,58 @@ $(document).ready(function() {
 
     // 切换tab触发refresh
     $('a[data-toggle="tab"]').on('shown.bs.tab', function (e) {
-        if($(e.target).data('name')==undefined){
-            return;
+        let tagName = $(e.target).data('name');
+        if(tagName=='tab_gongliaoji'&&(currentTag!=undefined||currentTag!='')){
+            refreshSheetView();
+        }else if(tagName){
+            currentTag = $(e.target).data('name');
+            refreshSheetView();
         }
-        currentTag = $(e.target).data('name');
-        // 获取工料机当前选中的行号
-        let projectGLJId = 0;
-        if (currentTag === "mix-ratio") {
-            if (mixRatioSpread === null) {
-                mixRatioSpread = new CompositionSpread();
-                mixRatioSpread.init(currentTag);
-                mixRatioSpread.initRightClick(currentTag);
-                mixRatioSpread.successCallback = compositionSuccess;
-            }
 
-            // 筛选数据显示(显示混凝土、砂浆、配合比)
-            projectGLJSheet.filterData('unit_price.type', [GLJTypeConst.CONCRETE, GLJTypeConst.MORTAR, GLJTypeConst.MIX_RATIO,GLJTypeConst.MAIN_MATERIAL]);
+        function refreshSheetView() {
+            // 获取工料机当前选中的行号
+            let projectGLJId = 0;
+            if (currentTag === "mix-ratio") {
+                if (mixRatioSpread === null) {
+                    mixRatioSpread = new CompositionSpread();
+                    mixRatioSpread.init(currentTag);
+                    mixRatioSpread.initRightClick(currentTag);
+                    mixRatioSpread.successCallback = compositionSuccess;
+                }
 
-            projectGLJSheet.selectRow(projectGLJSpread.firstMixRatioRow);
-            projectGLJId = projectGLJSheet.getActiveDataByField('id');
+                // 筛选数据显示(显示混凝土、砂浆、配合比)
+                projectGLJSheet.filterData('unit_price.type', [GLJTypeConst.CONCRETE, GLJTypeConst.MORTAR, GLJTypeConst.MIX_RATIO,GLJTypeConst.MAIN_MATERIAL]);
 
-            // 获取数据
-            mixRatioSpread.getRatioData(projectGLJId);
-        }
+                projectGLJSheet.selectRow(projectGLJSpread.firstMixRatioRow);
+                projectGLJId = projectGLJSheet.getActiveDataByField('id');
 
-        if (currentTag === "machine") {
-            if (machineSpread === null) {
-                machineSpread = new CompositionSpread();
-                machineSpread.init(currentTag);
-                machineSpread.initRightClick(currentTag);
-                machineSpread.successCallback = compositionSuccess;
+                // 获取数据
+                mixRatioSpread.getRatioData(projectGLJId);
             }
 
-            // 筛选数据显示(显示普通机械)
-            projectGLJSheet.filterData('unit_price.type', [GLJTypeConst.GENERAL_MACHINE]);
-            projectGLJSheet.selectRow(projectGLJSpread.firstMachineRow);
-            projectGLJId = projectGLJSheet.getActiveDataByField('id');
+            if (currentTag === "machine") {
+                if (machineSpread === null) {
+                    machineSpread = new CompositionSpread();
+                    machineSpread.init(currentTag);
+                    machineSpread.initRightClick(currentTag);
+                    machineSpread.successCallback = compositionSuccess;
+                }
 
-            // 获取数据
-            machineSpread.getRatioData(projectGLJId);
+                // 筛选数据显示(显示普通机械)
+                projectGLJSheet.filterData('unit_price.type', [GLJTypeConst.GENERAL_MACHINE]);
+                projectGLJSheet.selectRow(projectGLJSpread.firstMachineRow);
+                projectGLJId = projectGLJSheet.getActiveDataByField('id');
+
+                // 获取数据
+                machineSpread.getRatioData(projectGLJId);
+            }
+            if (currentTag === 'ration') {
+                projectGLJSheet.filterData('unit_price.type', []);
+            }
         }
 
+
+
     });
 
 });
@@ -94,7 +105,7 @@ function compositionSuccess(info) {
     //更新表格
     projectGLJSheet.setCellByField('unit_price.market_price', info.parentMarketPrice, false);
     projectGLJSheet.setCellByField('base_price', info.parentBasePrice, false);
-    projectGLJSheet.setCellByField('adjust_price', info.parentMarketPrice, false);
+    projectGLJSheet.setCellByField('adjust_price', projectObj.project.projectGLJ.getAdjustPrice(parentData), false);
     // 更新组成物缓存
     projectObj.project.composition.loadData();
     //选查找使用了父项目工料机的定额工料机

+ 14 - 2
web/building_saas/glj/js/project_glj.js

@@ -290,7 +290,19 @@ function spreadInit() {
         lastRow = currentRow;
     });
 
-    // 切换tab触发refresh
+    if(currentTag){
+        if (currentTag === 'ration') {
+            projectGLJSheet.filterData('unit_price.type', []);
+        }
+        if(currentTag === "mix-ratio"){
+            projectGLJSheet.filterData('unit_price.type', [GLJTypeConst.CONCRETE, GLJTypeConst.MORTAR, GLJTypeConst.MIX_RATIO,GLJTypeConst.MAIN_MATERIAL]);
+        }
+        if(currentTag === "machine"){
+            projectGLJSheet.filterData('unit_price.type', [GLJTypeConst.GENERAL_MACHINE]);
+        }
+    }
+
+  /*  // 切换tab触发refresh
     $('a[data-toggle="tab"]').on('shown.bs.tab', function (e) {
         if($(e.target).data('name')==undefined){
             return;
@@ -299,7 +311,7 @@ function spreadInit() {
         if (currentTag === 'ration') {
             projectGLJSheet.filterData('unit_price.type', []);
         }
-    });
+    });*/
 
     loadSize("glj-main", function () {
         projectGLJSpread.sheetObj.spread.refresh();

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

@@ -42,7 +42,7 @@
         <div class="main-nav">
             <ul class="nav nav-tabs flex-column" role="tablist">
                 <li class="nav-item"><a class="active" data-toggle="tab" href="#zaojiashu" id="tab_zaojiashu" role="tab">造价书</a></li>
-                <li class="nav-item"><a data-toggle="tab" href="#gongliaoji" id="tab_gongliaoji" role="tab">工料机</a></li>
+                <li class="nav-item"><a data-toggle="tab" href="#gongliaoji" id="tab_gongliaoji" data-name="tab_gongliaoji" role="tab">工料机</a></li>
                 <li class="nav-item"><a data-toggle="tab" href="#fee_rates" id="tab_fee_rate" role="tab" >费率</a></li>
                 <li class="nav-item"><a data-toggle="tab" href="#calc_program_manage" id="tab_calc_program_manage" role="tab">计算程序</a></li>
                 <li class="nav-item"><a data-toggle="tab" href="#reports" role="tab" id="tab_report" onclick="rptTplObj.iniPage();">报表</a></li>

+ 1 - 0
web/building_saas/main/js/models/fee_rate.js

@@ -380,6 +380,7 @@ var FeeRate = {
                 var data={'projectID': projectObj.project.ID(),'templatesID': editInfo.template.ID,'calcItem': editInfo.calcItem};
                 calcProgramManage.saveCalcItem(data,function (result) {
                     project.calcProgram.compileAllTemps();
+                    project.calcProgram.calcAllNodesAndSave();
                     calcProgramManage.refreshDetailSheet();
                     $.bootstrapLoading.end();
                 })