cqp 1 mês atrás
pai
commit
b288e6b433
1 arquivos alterados com 7 adições e 3 exclusões
  1. 7 3
      app/Service/ExportFileService.php

+ 7 - 3
app/Service/ExportFileService.php

@@ -512,6 +512,9 @@ class ExportFileService extends Service
             return date('Y年m月', strtotime($item['order_date']));
             return date('Y年m月', strtotime($item['order_date']));
         });
         });
 
 
+        //获取公司基本信息
+        $company = EmployeeService::getCompanyDetail($user);
+
         foreach ($groupedByMonth as $monthName => $monthItems) {
         foreach ($groupedByMonth as $monthName => $monthItems) {
             // A. 计算该月总天数
             // A. 计算该月总天数
             // 转换 '2024年04月' 为 '2024-04' 获取天数
             // 转换 '2024年04月' 为 '2024-04' 获取天数
@@ -526,9 +529,9 @@ class ExportFileService extends Service
             $sheetRows = [];
             $sheetRows = [];
             foreach ($groupedByUserItem as $key => $records) {
             foreach ($groupedByUserItem as $key => $records) {
                 $first = $records->first();
                 $first = $records->first();
-                // 初始化行:前两列是 项目编号 和 姓名
+                // 初始化行:前两列是 项目名称 和 姓名
                 $row = [
                 $row = [
-                    $first['item_code'],
+                    $first['item_title'],
                     $first['employee_name']
                     $first['employee_name']
                 ];
                 ];
 
 
@@ -549,7 +552,8 @@ class ExportFileService extends Service
 
 
             $monthsData[$monthName] = [
             $monthsData[$monthName] = [
                 'days' => (int)$daysInMonth,
                 'days' => (int)$daysInMonth,
-                'data' => $sheetRows
+                'data' => $sheetRows,
+                'company_name' => $company['title'] ?? '',
             ];
             ];
         }
         }