cqp 7 ay önce
ebeveyn
işleme
aa95d3ff23
1 değiştirilmiş dosya ile 12 ekleme ve 1 silme
  1. 12 1
      app/Service/RangeService.php

+ 12 - 1
app/Service/RangeService.php

@@ -358,11 +358,22 @@ class RangeService extends Service
             ->get()->toArray();
         $sales_order_id = array_unique(array_column($sales_order_id,'sales_order_id'));
 
+        $bool = ! empty($search['top_depart_id']) && ! empty($user['is_all_depart']);
+        if(! $bool){
+            $current_top_depart_id = $user['depart_top'][0] ?? [];
+            $current_top_depart_id = $current_top_depart_id['depart_id'] ?? 0;
+            $sales_order_id = SalesOrder::whereIn('id', $sales_order_id)
+                ->where('top_depart_id',$current_top_depart_id)
+                ->select('id')
+                ->get()->toArray();
+            $sales_order_id = array_column($sales_order_id,'sales_order_id');
+        }
+
         //指派后 可见范围id
         $return = Self::getRangeDataId($user,SeeRange::type_seven);
 
         $return_id = array_unique(array_merge_recursive($sales_order_id,$return));
-        if(! empty($search['top_depart_id']) && ! empty($user['is_all_depart'])){
+        if($bool){
             $id = DB::table('sales_order')
                 ->where('del_time',0)
                 ->where('top_depart_id',$search['top_depart_id'])