Browse Source

pc端,维保流程,分页total与list

lizhen_gitee 7 months ago
parent
commit
48750f4205
2 changed files with 14 additions and 2 deletions
  1. 11 2
      application/company/controller/Maintain.php
  2. 3 0
      thinkphp/library/think/db/Query.php

+ 11 - 2
application/company/controller/Maintain.php

@@ -109,7 +109,11 @@ class Maintain extends Apic
             ->join('user_company uc','mt.uc_id = uc.id','LEFT')
             ->field($field)
             ->where($map)->order('mt.id desc')
-            ->autopage()->select();
+            ->paginate();
+        
+        $total = $list->total();
+        $list = $list->items();
+
         if(!empty($list)){
             $maintain_model = new Maintainmodel();
             foreach($list as $key => $val){
@@ -120,7 +124,12 @@ class Maintain extends Apic
             }
         }
 
-        $this->success(1,$list);
+        $rs = [
+            'list' => $list,
+            'total'=> $total,
+        ];
+
+        $this->success(1,$rs);
     }
 
     //整合过的状态

+ 3 - 0
thinkphp/library/think/db/Query.php

@@ -1486,6 +1486,9 @@ class Query
             $listRows = $listRows ?: $config['list_rows'];
         }
 
+        //list_rows
+        $listRows = isset($_REQUEST['listrow']) ? (int)$_REQUEST['listrow'] : $listRows;
+
         /** @var Paginator $class */
         $class = false !== strpos($config['type'], '\\') ? $config['type'] : '\\think\\paginator\\driver\\' . ucwords($config['type']);
         $page  = isset($config['page']) ? (int) $config['page'] : call_user_func([