Просмотр исходного кода

feat: 更新合同详情表格,增加序号和项目名称列

lanjianrong 9 часов назад
Родитель
Сommit
09fe2e650a
1 измененных файлов с 5 добавлено и 2 удалено
  1. 5 2
      app/public/js/contract_detail.js

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

@@ -2661,7 +2661,8 @@ $(document).ready(function() {
         };
         // 构建表头
         let theadHtml = '<tr>';
-        theadHtml += '<th style="width: 30%">节点名称</th>';
+        theadHtml += '<th style="width: 6%">序号</th>';
+        theadHtml += '<th style="width: 24%">项目名称</th>';
         theadHtml += '<th>合同金额</th>';
         if (showSettlePrice) theadHtml += '<th>' + getColTitle('settle_price') + '</th>';
         if (showYfPrice) theadHtml += '<th>' + getColTitle('yf_price') + '</th>';
@@ -2673,7 +2674,7 @@ $(document).ready(function() {
         // 构建表体(仅第一层节点)
         let tbodyHtml = '';
         let sum_total = 0, sum_settle = 0, sum_yf = 0, sum_sf = 0;
-        for (const node of topLevelNodes) {
+        for (const [index, node] of topLevelNodes.entries()) {
             const nodeTotal = Number(node.total_price || 0);
             const nodeSettle = Number(node.settle_price || 0);
             const nodeProgressBase = showSettlePrice && nodeSettle !== 0 ? nodeSettle : nodeTotal;
@@ -2684,6 +2685,7 @@ $(document).ready(function() {
             sum_yf = ZhCalc.add(sum_yf, nodeYf);
             sum_sf = ZhCalc.add(sum_sf, nodeSf);
             tbodyHtml += '<tr>';
+            tbodyHtml += '<td>' + (index + 1) + '</td>';
             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>';
@@ -2696,6 +2698,7 @@ $(document).ready(function() {
         $('#contract-total-tbody').html(tbodyHtml);
         // 构建合计行
         let tfootHtml = '<tr class="font-weight-bold">';
+        tfootHtml += '<td></td>';
         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>';