浏览代码

优先级

cqp 1 月之前
父节点
当前提交
efa3007c49
共有 2 个文件被更改,包括 14 次插入5 次删除
  1. 1 1
      app/Service/PLeaveOverService.php
  2. 13 4
      app/Service/PersonWorkService.php

+ 1 - 1
app/Service/PLeaveOverService.php

@@ -393,7 +393,7 @@ class PLeaveOverService extends Service
         if(empty($data['data'])) return $data;
 
         $emp = (new EmployeeService())->getEmployeeMap(array_unique(array_column($data['data'],'crt_id')));
-        $map = ArchiveService::fillIsArchive(array_unique(array_column($data['data'],'month')), $user);
+        $map = ArchiveService::fillIsArchive(array_unique(array_column($data['data'],'order_time')), $user);
 
         foreach ($data['data'] as $key => $value){
             $data['data'][$key]['crt_time'] = $value['crt_time'] ? date('Y-m-d H:i:s',$value['crt_time']) : '';

+ 13 - 4
app/Service/PersonWorkService.php

@@ -164,6 +164,8 @@ class PersonWorkService extends Service
         $customer = $customer->toArray();
         $customer['crt_name'] = Employee::where('id',$customer['crt_id'])->value('title');
         $customer['crt_time'] = $customer['crt_time'] ? date("Y-m-d H:i:s",$customer['crt_time']): '';
+        $map = ArchiveService::fillIsArchive($customer['month'], $user);
+        $customer['is_archive'] = $map[$customer['month']] ?? false;
         $customer['month'] = $customer['month'] ? date("Y-m",$customer['month']): '';
 
         $details = $this->getDetail($data['id']);
@@ -199,7 +201,7 @@ class PersonWorkService extends Service
     public function monthlyPwOrderList($data,$user){
         $model = $this->monthlyPwOrderCommon($data, $user);
         $list = $this->limit($model,'',$data);
-        $list = $this->fillData($list);
+        $list = $this->fillData($list, $user);
 
         return [true, $list];
     }
@@ -289,14 +291,17 @@ class PersonWorkService extends Service
         return [true, ''];
     }
 
-    public function fillData($data){
+    public function fillData($data, $user){
         if(empty($data['data'])) return $data;
 
         $emp = (new EmployeeService())->getEmployeeMap(array_unique(array_column($data['data'],'crt_id')));
+        $map = ArchiveService::fillIsArchive(array_unique(array_column($data['data'],'month')), $user);
+
         foreach ($data['data'] as $key => $value){
             $data['data'][$key]['crt_time'] = $value['crt_time'] ? date('Y-m-d H:i:s',$value['crt_time']) : '';
             $data['data'][$key]['month'] = $value['month'] ? date('Y-m',$value['month']) : '';
             $data['data'][$key]['crt_name'] = $emp[$value['crt_id']] ?? '';
+            $data['data'][$key]['is_archive'] = $map[$value['month']] ?? false;
         }
 
         return $data;
@@ -526,6 +531,8 @@ class PersonWorkService extends Service
         $item = Item::where('id', $customer['item_id'])->first();
         $customer['item_title'] = $item->title;
         $customer['item_code'] = $item->code;
+        $map = ArchiveService::fillIsArchive($customer['order_time'], $user);
+        $customer['is_archive'] = $map[$customer['order_time']] ?? false;
         $customer['order_time'] = $customer['order_time'] ? date("Y-m-d",$customer['order_time']): '';
 
         $details = $this->getDetailDaily($data['id']);
@@ -569,7 +576,7 @@ class PersonWorkService extends Service
     public function dailyPwOrderList($data,$user){
         $model = $this->dailyPwOrderCommon($data, $user);
         $list = $this->limit($model,'',$data);
-        $list = $this->fillDataDaily($list);
+        $list = $this->fillDataDaily($list, $user);
 
         return [true, $list];
     }
@@ -688,11 +695,12 @@ class PersonWorkService extends Service
         return [true, ''];
     }
 
-    public function fillDataDaily($data){
+    public function fillDataDaily($data, $user){
         if(empty($data['data'])) return $data;
 
         $emp = (new EmployeeService())->getEmployeeMap(array_unique(array_column($data['data'],'crt_id')));
         $item = (new ItemService())->getItemMap(array_unique(array_column($data['data'],'item_id')));
+        $map = ArchiveService::fillIsArchive(array_unique(array_column($data['data'],'order_time')), $user);
         foreach ($data['data'] as $key => $value){
             $data['data'][$key]['crt_time'] = $value['crt_time'] ? date('Y-m-d H:i:s',$value['crt_time']) : '';
             $data['data'][$key]['order_time'] = $value['order_time'] ? date('Y-m-d',$value['order_time']) : '';
@@ -700,6 +708,7 @@ class PersonWorkService extends Service
             $item_tmp = $item[$value['item_id']] ?? [];
             $data['data'][$key]['item_title'] = $item_tmp['title'] ?? '';
             $data['data'][$key]['item_code'] = $item_tmp['code'] ?? '';
+            $data['data'][$key]['is_archive'] = $map[$value['order_time']] ?? false;
         }
 
         return $data;