Bladeren bron

Merge branch 'dev' of http://192.168.1.41:3000/maixinrong/Calculation into dev

MaiXinRong 3 jaren geleden
bovenliggende
commit
9d6382ddc3

+ 11 - 12
app/controller/datacollect_controller.js

@@ -110,22 +110,21 @@ module.exports = app => {
                 for (const t of tenderList) {
                     const tenderInfo = await ctx.service.tenderInfo.getTenderInfo(t.id);
                     t.contract_price = tenderInfo.deal_param.contractPrice;
-
-                    if (t.ledger_status === auditConst.ledger.status.checkNo || t.ledger_status === auditConst.ledger.status.uncheck) {
-                        const sum = await ctx.service.ledger.addUp({ tender_id: t.id/* , is_leaf: true*/ });
-                        t.total_price = sum.total_price;
-                        t.deal_tp = sum.deal_tp;
-                    }
+                    let bCalcTp = t.ledger_status === auditConst.ledger.status.checkNo || t.ledger_status === auditConst.ledger.status.uncheck;
                     t.advance_tp = await ctx.service.advance.getSumAdvance(t.id);
 
                     if (t.ledger_status === auditConst.ledger.status.checked) {
-                        t.lastStage = await ctx.service.stage.getLastestStage(t.id, true);
-                        if (t.lastStage && t.lastStage.status === auditConst.stage.status.uncheck &&
-                            t.lastStage.user_id !== ctx.session.sessionUser.accountId) {
-                            t.lastStage = await ctx.service.stage.getLastestStage(t.id);
-                        }
-                        if (t.lastStage) await ctx.service.stage.checkStageGatherData(t.lastStage);
+                        t.lastStage = await ctx.service.stage.getLastestStage(t.id);
+                        if (t.lastStage) await ctx.service.stage.checkStageGatherData(t.lastStage, true);
                         t.completeStage = await ctx.service.stage.getLastestCompleteStage(t.id);
+                        if ((!bCalcTp) && t.measure_type === measureType.gcl.value) {
+                            bCalcTp = t.lastStage && t.lastStage.status !== auditConst.stage.status.checked && !t.lastStage.readOnly;
+                        }
+                    }
+                    if (bCalcTp) {
+                        const sum = await this.ctx.service.ledger.addUp({ tender_id: t.id/* , is_leaf: true*/ });
+                        t.total_price = sum.total_price;
+                        t.deal_tp = sum.deal_tp;
                     }
                     t.material_tp = await ctx.service.material.getSumMaterial(t.id);
                     // 获取本标段 本月计量期审批通过数目,变更令审批通过数目,台账修订通过数目,材料调差通过数目

+ 2 - 2
app/public/js/material.js

@@ -75,8 +75,8 @@ function resetTpTable() {
     $('#tp_set').find('td').eq(1).text(ZhCalc.round(m_tp, 2));
     $('#tp_set').find('td').eq(2).text(ZhCalc.round(ZhCalc.add(pre_tp, m_tp), 2));
     if (materialTax) {
-        $('#rate_set').find('td').eq(1).text(ZhCalc.round(m_tax_tp, 2));
-        $('#rate_set').find('td').eq(2).text(ZhCalc.round(ZhCalc.add(m_tax_pre_tp, m_tax_tp), 2));
+        $('#tax_rate_set').find('td').eq(1).text(ZhCalc.round(m_tax_tp, 2));
+        $('#tax_rate_set').find('td').eq(2).text(ZhCalc.round(ZhCalc.add(m_tax_pre_tp, m_tax_tp), 2));
     } else {
         const rate = $('#changeRate').val();
         const bqhs = ZhCalc.round(ZhCalc.mul(m_tp, 1+rate/100), 2);

+ 4 - 4
app/service/stage.js

@@ -68,7 +68,7 @@ module.exports = app => {
             return result;
         }
 
-        async doCheckStage(stage) {
+        async doCheckStage(stage, formDataCollect = false) {
             const status = auditConst.status;
             stage.auditors = await this.ctx.service.stageAudit.getAuditors(stage.id, stage.times);
             stage.curAuditor = await this.ctx.service.stageAudit.getCurAuditor(stage.id, stage.times);
@@ -91,7 +91,7 @@ module.exports = app => {
                 } else {
                     stage.curOrder = stage.curAuditor.aid === accountId ? stage.curAuditor.order : stage.curAuditor.order - 1;
                 }
-            } else if (this.ctx.tender && this.ctx.tender.isTourist) { // 游客
+            } else if ((this.ctx.tender && this.ctx.tender.isTourist) || formDataCollect) { // 游客
                 stage.readOnly = true;
                 stage.curTimes = stage.times;
                 if (stage.status === status.uncheck || stage.status === status.checkNo) {
@@ -218,10 +218,10 @@ module.exports = app => {
             return await this.db.query(sql, sqlParam);
         }
 
-        async checkStageGatherData(stage) {
+        async checkStageGatherData(stage, formDataCollect = false) {
             // 最新一期计量(未审批完成),当前操作人的期详细数据,应实时计算
             if (stage.status !== auditConst.status.checked) {
-                await this.doCheckStage(stage);
+                await this.doCheckStage(stage, formDataCollect);
                 if (!stage.readOnly && stage.check_calc) {
                     const tpData = await this.ctx.service.stageBills.getSumTotalPrice(stage);
                     stage.contract_tp = tpData.contract_tp;

+ 19 - 6
app/view/datacollect/index.ejs

@@ -594,7 +594,9 @@
     option1 = {
         tooltip : {
             trigger: 'item',
-            formatter: "{a} <br/>{b} : {c} ({d}%)"
+            formatter: "{a} <br/>{b} : {c} ({d}%)",
+            // 当前鼠标位置
+            position: 'right',
         },
         title: {
             text: '金额统计图',
@@ -655,7 +657,7 @@
             trigger: 'axis',
             axisPointer: {            // 坐标轴指示器,坐标轴触发有效
                 type: 'shadow'        // 默认为直线,可选为:'line' | 'shadow'
-            }
+            },
         },
 
         dataZoom: [
@@ -1014,7 +1016,7 @@
         },
         series: [
             {
-                name: '访问来源',
+                name: '数据来源',
                 type: 'pie',
                 top:'15%',
                 bottom:'10%',
@@ -1036,7 +1038,7 @@
                 ]
             },
             {
-                name: '访问来源',
+                name: '数据来源',
                 type: 'pie',
                 top:'15%',
                 bottom:'10%',
@@ -1058,7 +1060,7 @@
                 ]
             },
             {
-                name: '访问来源',
+                name: '数据来源',
                 type: 'pie',
                 top:'15%',
                 bottom:'10%',
@@ -1103,7 +1105,16 @@
             exitFullscreen();
         })
     })
-    $(window).resize(echartsReset);
+    let resizeTimer = null;
+    $(window).bind('resize', function () {
+        if (resizeTimer) clearTimeout(resizeTimer);
+        resizeTimer = setTimeout(function () {
+            echartsReset();
+            $(".tableid_").find('th').each(function(i) {
+                $(this).css('width', $('#tableId').find('th:eq(' + i + ')').innerWidth());
+            });
+        }, 500);
+    })
 
     // 数据全屏
     function launchIntoFullscreen(element) {
@@ -1506,6 +1517,8 @@
             myChart4_1.setOption(option4);
             myChart4_2.setOption(option4);
 
+            $('#tableId').css({'margin-top': 0});
+
             // 地图设置
             // const polyLineList = [];
             // const centerPoint = { lng: mapJson.lng, lat: mapJson.lat };

+ 4 - 4
app/view/material/exponent.ejs

@@ -89,14 +89,14 @@
                                         <td class="text-center"><%= material.ex_tp !== null || material.ex_pre_tp !== null ? ctx.helper.round(ctx.helper.add(material.ex_pre_tp, material.ex_tp), 2) : null %></td>
                                     </tr>
                                     <tr><td>材料价差费用(含材料税)</td>
-                                        <td class="text-center"><%= material.m_tax_tp !== null ? material.m_tax_tp : null %></td>
-                                        <td class="text-center"><%= material.m_tax_tp !== null || material.tax_pre_tp !== null ? ctx.helper.round(ctx.helper.add(material.tax_pre_tp, material.m_tax_tp), 2) : null %></td>
+                                        <td class="text-center"><%= material.material_tax ? (material.m_tax_tp !== null ? material.m_tax_tp : null) : '-' %></td>
+                                        <td class="text-center"><%= material.material_tax ? (material.m_tax_tp !== null || material.m_tax_pre_tp !== null ? ctx.helper.round(ctx.helper.add(material.m_tax_pre_tp, material.m_tax_tp), 2) : null) : material.m_tax_pre_tp %></td>
                                         <td class="text-center">-</td>
                                         <td class="text-center">-</td>
                                     </tr>
                                     <tr id="rate_set"><td>材料价差费用(含建筑税)</td>
-                                        <td class="text-center">-</td>
-                                        <td class="text-center"><%= pre_tp_hs !== null ? pre_tp_hs : '-' %></td>
+                                        <td class="text-center"><%= !material.material_tax ? (material.m_tp !== null ? ctx.helper.round(ctx.helper.mul(material.m_tp, 1+material.rate/100), 2) : null) : '-' %></td>
+                                        <td class="text-center"><%= !material.material_tax ? (material.m_tp !== null || pre_tp_hs !== null ? ctx.helper.round(ctx.helper.add(pre_tp_hs, ctx.helper.round(ctx.helper.mul(material.m_tp, 1+material.rate/100), 2)), 2) : null) : pre_tp_hs !== null ? pre_tp_hs : '-' %></td>
                                         <td class="text-center"><%= material.ex_tp !== null ? ctx.helper.round(ctx.helper.mul(material.ex_tp, 1+material.rate/100), 2) : null %></td>
                                         <td class="text-center"><%= material.ex_tp !== null || ex_pre_tp_hs !== null ? ctx.helper.round(ctx.helper.add(ex_pre_tp_hs, ctx.helper.round(ctx.helper.mul(material.ex_tp, 1+material.rate/100), 2)), 2) : null %></td>
                                     </tr>

+ 2 - 2
app/view/material/info.ejs

@@ -93,13 +93,13 @@
                                     <td class="text-center"><%= material.ex_tp !== null ? ctx.helper.round(material.ex_tp, 2) : null %></td>
                                     <td class="text-center"><%= material.ex_tp !== null || material.ex_pre_tp !== null ? ctx.helper.round(ctx.helper.add(material.ex_pre_tp, material.ex_tp), 2) : null %></td>
                                 </tr>
-                                <tr id="rate_set"><td>材料价差费用(含材料税)</td>
+                                <tr id="tax_rate_set"><td>材料价差费用(含材料税)</td>
                                     <td class="text-center"><%= material.material_tax ? (material.m_tax_tp !== null ? material.m_tax_tp : null) : '-' %></td>
                                     <td class="text-center"><%= material.material_tax ? (material.m_tax_tp !== null || material.m_tax_pre_tp !== null ? ctx.helper.round(ctx.helper.add(material.m_tax_pre_tp, material.m_tax_tp), 2) : null) : material.m_tax_pre_tp %></td>
                                     <td class="text-center">-</td>
                                     <td class="text-center">-</td>
                                 </tr>
-                                <tr><td>材料价差费用(含建筑税)</td>
+                                <tr id="rate_set"><td>材料价差费用(含建筑税)</td>
                                     <td class="text-center"><%= !material.material_tax ? (material.m_tp !== null ? ctx.helper.round(ctx.helper.mul(material.m_tp, 1+material.rate/100), 2) : null) : '-' %></td>
                                     <td class="text-center"><%= !material.material_tax ? (material.m_tp !== null || pre_tp_hs !== null ? ctx.helper.round(ctx.helper.add(pre_tp_hs, ctx.helper.round(ctx.helper.mul(material.m_tp, 1+material.rate/100), 2)), 2) : null) : pre_tp_hs !== null ? pre_tp_hs : '-' %></td>
                                     <td class="text-center"><%= material.ex_tp !== null ? ctx.helper.round(ctx.helper.mul(material.ex_tp, 1+material.rate/100), 2) : null %></td>