From e472d8042eafa484a774a75c0ffac046e969cae7 Mon Sep 17 00:00:00 2001
From: syruan <15555146157@163.com>
Date: Sun, 24 Aug 2025 15:41:06 +0800
Subject: [PATCH] =?UTF-8?q?=E6=9C=AA=E7=BB=93=E7=AE=97=E6=8A=A5=E8=A1=A8?=
 =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E8=B4=B9=E7=94=A8=E5=87=8F=E5=85=8D=E5=88=97?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
 .../material/cost/component/unreportHome.vue  | 156 +++++++++++++++---
 1 file changed, 137 insertions(+), 19 deletions(-)
diff --git a/src/views/material/cost/component/unreportHome.vue b/src/views/material/cost/component/unreportHome.vue
index 73165bec..fbe84491 100644
--- a/src/views/material/cost/component/unreportHome.vue
+++ b/src/views/material/cost/component/unreportHome.vue
@@ -92,18 +92,26 @@
                 {{ scope.row.scrapCost || 0 }}
               
             
+          
+          
+            
+              
+                {{ scope.row.reductionCost || 0 }}
+              
+            
           
             
               
                 
-                  
-                    {{ scope.row.costs.toFixed(2) }}
-                  
-                  {{ 0.00 }}
+                  :style="{color: calculateTotalCost(scope.row) > 0 ? '#409EFF' : '#606266'}"
+                  :disabled="!(calculateTotalCost(scope.row) > 0)">
+                  {{ calculateTotalCost(scope.row).toFixed(2) }}
                 
               
             
@@ -163,6 +171,13 @@
                 
                 
                 
+                
+                    
+                        收费
+                        不收费
+                        {{ scope.row.partType || '-' }}
+                    
+                
                 
                     
                         {{ scope.row.cost ? scope.row.cost.toFixed(2) : '0.00' }}
@@ -210,6 +225,26 @@
                 
             
 
+            
+            
+                
+                
+                
+                
+                
+                
+                    
+                        {{ scope.row.cost ? scope.row.cost.toFixed(2) : '0.00' }}
+                    
+                
+            
+
             
             
                 
                 
-                
-                
-                
-                
-                
-                
+                
+                    
+                        {{ scope.row.unitPrice || 0 }}
+                        -
+                    
+                
+                
+                    
+                        {{ scope.row.quantity || 0 }}
+                        {{ scope.row.repairQuantity || 0 }}
+                        {{ scope.row.loseQuantity || 0 }}
+                        {{ scope.row.scrapQuantity || 0 }}
+                        {{ scope.row.reductionQuantity || 0 }}
+                        {{ scope.row.quantity || 0 }}
+                    
+                
+                
+                    
+                        {{ scope.row.returnQuantity || 0 }}
+                        -
+                    
+                
+                
+                    
+                        {{ scope.row.leaseDate || '-' }}
+                        -
+                    
+                
+                
+                    
+                        {{ scope.row.returnDate || '-' }}
+                        -
+                    
+                
+                
+                    
+                        {{ scope.row.days || 0 }}
+                        -
+                    
+                
                 
                     
                         {{ scope.row.cost ? scope.row.cost.toFixed(2) : '0.00' }}
@@ -239,6 +308,7 @@
                         维修费用
                         丢失费用
                         报废费用
+                        减免费用
                         未知
                     
                 
@@ -495,7 +565,7 @@ export default {
                     scrapCost: row.scrapCost || 0,
                     reductionCost: row.reductionCost || 0
                 };
-                this.agreementContent.costAll = Number(this.agreementContent.leaseCost) + Number(this.agreementContent.repairCost) + Number(this.agreementContent.scrapCost) + Number(this.agreementContent.loseCost) - Number(this.agreementContent.reductionCost)
+                this.agreementContent.costAll = this.calculateTotalCost(row)
                 // costAllUpper 中文大写
                 this.agreementContent.costAllUpper = toChineseAmount(this.agreementContent.costAll.toFixed(2))
             } catch (error) {
@@ -514,6 +584,7 @@ export default {
                 'repair': '维修费用',
                 'lose': '丢失费用',
                 'scrap': '报废费用',
+                'reduction': '减免费用',
                 'total': '合计费用'
             };
 
@@ -540,13 +611,17 @@ export default {
                 case 'scrap':
                     sourceList = row.scrapList || [];
                     break;
+                case 'reduction':
+                    sourceList = row.reductionList || [];
+                    break;
                 case 'total':
                     // 合计费用显示所有类型的数据
                     const allLists = [
                         ...(row.leaseList || []).map(item => ({...item, costType: 'lease'})),
                         ...(row.repairList || []).map(item => ({...item, costType: 'repair'})),
                         ...(row.loseList || []).map(item => ({...item, costType: 'lose'})),
-                        ...(row.scrapList || []).map(item => ({...item, costType: 'scrap'}))
+                        ...(row.scrapList || []).map(item => ({...item, costType: 'scrap'})),
+                        ...(row.reductionList || []).map(item => ({...item, costType: 'reduction'}))
                     ];
                     sourceList = allLists;
                     break;
@@ -578,7 +653,8 @@ export default {
                 } else if (costType === 'repair' || (costType === 'total' && item.costType === 'repair')) {
                     return {
                         ...baseData,
-                        repairQuantity: item.num || 0
+                        repairQuantity: item.num || 0,
+                        partType: item.partType
                     };
                 } else if (costType === 'lose' || (costType === 'total' && item.costType === 'lose')) {
                     return {
@@ -590,6 +666,11 @@ export default {
                         ...baseData,
                         scrapQuantity: item.num || 0
                     };
+                } else if (costType === 'reduction' || (costType === 'total' && item.costType === 'reduction')) {
+                    return {
+                        ...baseData,
+                        reductionQuantity: item.num || 0
+                    };
                 }
 
                 return baseData;
@@ -615,6 +696,7 @@ export default {
                     { key: 'repairCost', title: '维修费用' },
                     { key: 'loseCost', title: '丢失费用' },
                     { key: 'scrapCost', title: '报废费用' },
+                    { key: 'reductionCost', title: '减免费用' },
                     { key: 'costs', title: '合计费用(元)' }
                 ];
 
@@ -636,9 +718,9 @@ export default {
                             if (row.settlementType === 2) return '安全工器具';
                             return '总费用';
                         } else if (col.key === 'costs') {
-                            // 处理合计费用格式
-                            return row.costs != null && row.costs !== '' ? parseFloat(row.costs.toFixed(2)) : 0.00;
-                        } else if (col.key === 'leaseCost' || col.key === 'repairCost' || col.key === 'loseCost' || col.key === 'scrapCost') {
+                            // 处理合计费用格式 - 前端计算
+                            return parseFloat(this.calculateTotalCost(row).toFixed(2));
+                        } else if (col.key === 'leaseCost' || col.key === 'repairCost' || col.key === 'loseCost' || col.key === 'scrapCost' || col.key === 'reductionCost') {
                             // 处理费用字段格式
                             return row[col.key] || 0;
                         } else {
@@ -663,6 +745,7 @@ export default {
                     { wch: 12 },  // 维修费用
                     { wch: 12 },  // 丢失费用
                     { wch: 12 },  // 报废费用
+                    { wch: 12 },  // 减免费用
                     { wch: 15 }   // 合计费用
                 ];
                 worksheet['!cols'] = columnWidths;
@@ -733,6 +816,7 @@ export default {
                             { key: 'model', title: '规格型号' },
                             { key: 'unit', title: '单位' },
                             { key: 'repairQuantity', title: '维修数量' },
+                            { key: 'partType', title: '是否收费' },
                             { key: 'cost', title: '维修费用(元)' }
                         ];
                         fileName = '维修费用详情';
@@ -760,6 +844,17 @@ export default {
                         fileName = '报废费用详情';
                         sheetName = '报废费用';
                         break;
+                    case 'reduction':
+                        columns = [
+                            { key: 'name', title: '机具名称' },
+                            { key: 'model', title: '机具规格' },
+                            { key: 'unit', title: '单位' },
+                            { key: 'reductionQuantity', title: '减免数量' },
+                            { key: 'cost', title: '减免费用(元)' }
+                        ];
+                        fileName = '减免费用详情';
+                        sheetName = '减免费用';
+                        break;
                     case 'total':
                         columns = [
                             { key: 'name', title: '名称' },
@@ -800,11 +895,23 @@ export default {
                                 'lease': '租赁费用',
                                 'repair': '维修费用',
                                 'lose': '丢失费用',
-                                'scrap': '报废费用'
+                                'scrap': '报废费用',
+                                'reduction': '减免费用'
                             };
                             value = typeMap[value] || value;
                         }
 
+                        // 特殊处理是否收费字段
+                        if (col.key === 'partType') {
+                            if (value === '收费') {
+                                value = '收费';
+                            } else if (value === '不收费') {
+                                value = '不收费';
+                            } else {
+                                value = value || '-';
+                            }
+                        }
+
                         // 处理数值字段的格式
                         if (col.key === 'cost' || col.key === 'unitPrice') {
                             value = typeof value === 'number' ? parseFloat(value.toFixed(2)) : value;
@@ -858,6 +965,17 @@ export default {
             }
         },
 
+        // 计算合计费用
+        calculateTotalCost(row) {
+            const leaseCost = Number(row.leaseCost) || 0;
+            const repairCost = Number(row.repairCost) || 0;
+            const loseCost = Number(row.loseCost) || 0;
+            const scrapCost = Number(row.scrapCost) || 0;
+            const reductionCost = Number(row.reductionCost) || 0;
+
+            return leaseCost + repairCost + loseCost + scrapCost - reductionCost;
+        },
+
     },
 }