Przeglądaj źródła

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

MaiXinRong 7 godzin temu
rodzic
commit
e7fd28f5f5
1 zmienionych plików z 13 dodań i 5 usunięć
  1. 13 5
      app/public/js/contract_detail.js

+ 13 - 5
app/public/js/contract_detail.js

@@ -2644,6 +2644,7 @@ $(document).ready(function() {
         // 列显示控制
         const colShowMap = {};
         colSet.forEach(function (col) { colShowMap[col.field] = col.show; });
+        const showSettlePrice = colShowMap.settle_price;
         const showYfPrice = colShowMap.yf_price;
         const showStackedBar = colShowMap.stackedBar;
         const showSfPrice = colShowMap.sf_price;
@@ -2662,6 +2663,7 @@ $(document).ready(function() {
         let theadHtml = '<tr>';
         theadHtml += '<th style="width: 30%">节点名称</th>';
         theadHtml += '<th>合同金额</th>';
+        if (showSettlePrice) theadHtml += '<th>' + getColTitle('settle_price') + '</th>';
         if (showYfPrice) theadHtml += '<th>' + getColTitle('yf_price') + '</th>';
         if (showStackedBar) theadHtml += '<th>' + getColTitle('stackedBar') + '</th>';
         if (showSfPrice) theadHtml += '<th>' + getColTitle('sf_price') + '</th>';
@@ -2670,21 +2672,25 @@ $(document).ready(function() {
         $('#contract-total-thead').html(theadHtml);
         // 构建表体(仅第一层节点)
         let tbodyHtml = '';
-        let sum_total = 0, sum_yf = 0, sum_sf = 0;
+        let sum_total = 0, sum_settle = 0, sum_yf = 0, sum_sf = 0;
         for (const node of topLevelNodes) {
             const nodeTotal = Number(node.total_price || 0);
+            const nodeSettle = Number(node.settle_price || 0);
+            const nodeProgressBase = showSettlePrice && nodeSettle !== 0 ? nodeSettle : nodeTotal;
             const nodeYf = Number(node.yf_price || 0);
             const nodeSf = Number(node.sf_price || 0);
             sum_total = ZhCalc.add(sum_total, nodeTotal);
+            sum_settle = ZhCalc.add(sum_settle, nodeSettle);
             sum_yf = ZhCalc.add(sum_yf, nodeYf);
             sum_sf = ZhCalc.add(sum_sf, nodeSf);
             tbodyHtml += '<tr>';
             tbodyHtml += '<td class="text-left">' + (node.name || '') + '</td>';
             tbodyHtml += '<td class="text-right">' + (nodeTotal || 0) + '</td>';
+            if (showSettlePrice) tbodyHtml += '<td class="text-right">' + (nodeSettle || 0) + '</td>';
             if (showYfPrice) tbodyHtml += '<td class="text-right">' + (nodeYf || 0) + '</td>';
-            if (showStackedBar) tbodyHtml += '<td class="text-right">' + getProgress(nodeYf, nodeTotal) + '</td>';
+            if (showStackedBar) tbodyHtml += '<td class="text-right">' + getProgress(nodeYf, nodeProgressBase) + '</td>';
             if (showSfPrice) tbodyHtml += '<td class="text-right">' + (nodeSf || 0) + '</td>';
-            if (showStackedBarSf) tbodyHtml += '<td class="text-right">' + getProgress(nodeSf, nodeTotal) + '</td>';
+            if (showStackedBarSf) tbodyHtml += '<td class="text-right">' + getProgress(nodeSf, nodeProgressBase) + '</td>';
             tbodyHtml += '</tr>';
         }
         $('#contract-total-tbody').html(tbodyHtml);
@@ -2692,10 +2698,12 @@ $(document).ready(function() {
         let tfootHtml = '<tr class="font-weight-bold">';
         tfootHtml += '<td class="text-left">合计</td>';
         tfootHtml += '<td class="text-right">' + (sum_total || 0) + '</td>';
+        if (showSettlePrice) tfootHtml += '<td class="text-right">' + (sum_settle || 0) + '</td>';
         if (showYfPrice) tfootHtml += '<td class="text-right">' + (sum_yf || 0) + '</td>';
-        if (showStackedBar) tfootHtml += '<td class="text-right">' + getProgress(sum_yf, sum_total) + '</td>';
+        const totalProgressBase = showSettlePrice && sum_settle !== 0 ? sum_settle : sum_total;
+        if (showStackedBar) tfootHtml += '<td class="text-right">' + getProgress(sum_yf, totalProgressBase) + '</td>';
         if (showSfPrice) tfootHtml += '<td class="text-right">' + (sum_sf || 0) + '</td>';
-        if (showStackedBarSf) tfootHtml += '<td class="text-right">' + getProgress(sum_sf, sum_total) + '</td>';
+        if (showStackedBarSf) tfootHtml += '<td class="text-right">' + getProgress(sum_sf, totalProgressBase) + '</td>';
         tfootHtml += '</tr>';
         $('#contract-total-tfoot').html(tfootHtml);
         // 显示弹窗