فهرست منبع

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

MaiXinRong 1 روز پیش
والد
کامیت
e647fb2d02
1فایلهای تغییر یافته به همراه10 افزوده شده و 6 حذف شده
  1. 10 6
      app/public/js/contract_detail.js

+ 10 - 6
app/public/js/contract_detail.js

@@ -270,12 +270,12 @@ $(document).ready(function() {
             if (sel.rowCount > 1 && first) {
                 for (let r = 1; r < sel.rowCount; r++) {
                     const rNode = tree.nodes[sel.row + r];
-                    childCanDel = this.checkDelete(rNode, childCanDel);
-                    // if (!hadContract) hadContract = this.checkContract(rNode);
                     if (!rNode) {
                         sameParent = false;
                         break;
                     }
+                    childCanDel = this.checkDelete(rNode, childCanDel);
+                    // if (!hadContract) hadContract = this.checkContract(rNode);
                     if (rNode.level > first.level) continue;
                     if ((rNode.level < first.level) || (rNode.level === first.level && rNode.contract_pid !== first.contract_pid)) {
                         sameParent = false;
@@ -1137,6 +1137,7 @@ $(document).ready(function() {
             return haveContract;
         },
         checkDelete: function (select, oldFlag = true) {
+            if (!select) return false;
             let canDelete = oldFlag;
             if (select.c_code) {
                 if (!(select.uid === user_id || is_admin)) {
@@ -1460,11 +1461,11 @@ $(document).ready(function() {
             if (sel.rowCount > 1 && first) {
                 for (let r = 1; r < sel.rowCount; r++) {
                     const rNode = tree.nodes[sel.row + r];
-                    childCanDel = contractTreeSpreadObj.checkDelete(rNode, childCanDel);
                     if (!rNode) {
                         sameParent = false;
                         break;
                     }
+                    childCanDel = contractTreeSpreadObj.checkDelete(rNode, childCanDel);
                     if (rNode.level > first.level) continue;
                     if ((rNode.level < first.level) || (rNode.level === first.level && rNode.contract_pid !== first.contract_pid)) {
                         sameParent = false;
@@ -2661,7 +2662,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 +2675,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 +2686,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,7 +2699,8 @@ $(document).ready(function() {
         $('#contract-total-tbody').html(tbodyHtml);
         // 构建合计行
         let tfootHtml = '<tr class="font-weight-bold">';
-        tfootHtml += '<td class="text-left">合计</td>';
+        tfootHtml += '<td></td>';
+        tfootHtml += '<td class="text-center">合计</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>';