moonsflyer 9 months ago
parent
commit
221a0a200f
1 changed files with 35 additions and 0 deletions
  1. 35 0
      app/adminapi/lists/asset/AssetLeaseLists.php

+ 35 - 0
app/adminapi/lists/asset/AssetLeaseLists.php

@@ -149,6 +149,8 @@ class AssetLeaseLists extends BaseAdminDataLists implements ListsSearchInterface
      */
     public function count(): int
     {
+        $admin_info = $this->adminInfo;
+
         $parms =  $this->request->get();
         $where = [] ;
         if(!empty($parms))
@@ -179,6 +181,39 @@ class AssetLeaseLists extends BaseAdminDataLists implements ListsSearchInterface
             }
 
         }
+
+        if(!$admin_info['root']) {
+//            $where[] = ['lease_start_time', '>=', $parms['start_time']];
+            $jwhere = [];
+            $jwhere[] = ['admin_id', '=', $admin_info['admin_id']];
+            $jobs_list = AdminJobs::where($jwhere)->select()->toArray();
+            $all = false;
+            $first = false;
+            $second = false;
+            foreach ($jobs_list as $v) {
+                switch ($v['jobs_id']) {
+                    case 1:
+                        $all = true;
+                        break;
+                    case 2:
+                        $first = true;
+                        break;
+                    case 3:
+                        $second = true;
+                        break;
+                }
+            }
+            if (!$all) {
+                if(!($first && $second)){
+                    if($first){
+                        $where[] = ['approval_status','in',[1,2]];
+                    }
+                    if($second){
+                        $where[] = ['approval_status','in',[3,4,5]];
+                    }
+                }
+            }
+        }
         return (new AssetLeaseInfo())->where($this->searchWhere)->where($where)->count();
     }