m0_70156489 2 weeks ago
parent
commit
9c8932217f

+ 36 - 7
application/api/controller/MonthlyGarments.php

@@ -61,9 +61,14 @@ class MonthlyGarments extends Api
         $this->success('成功', $formattedData);
         $this->success('成功', $formattedData);
     }
     }
 
 
-         /**
- * 样衣进度列表数据
- */
+    /**
+     * 样衣进度列表数据(支持分页)
+     * @param string sys_rq 年月,如 2026-09
+     * @param string customer 客户编号
+     * @param string search 搜索
+     * @param int page 页码,默认1
+     * @param int pageSize|limit 每页条数,默认30
+     */
     public function getMonthlyGarmentsList()
     public function getMonthlyGarmentsList()
     {
     {
         if (!$this->request->isGet()) {
         if (!$this->request->isGet()) {
@@ -73,6 +78,13 @@ class MonthlyGarments extends Api
         $yearMonth = $this->request->param('sys_rq', '');
         $yearMonth = $this->request->param('sys_rq', '');
         $customerCode = $this->request->param('customer', '');
         $customerCode = $this->request->param('customer', '');
         $search = $this->request->param('search', '');
         $search = $this->request->param('search', '');
+        $page = max(1, intval($this->request->param('page', 1)));
+        $limit = intval($this->request->param('pageSize', 0));
+        if ($limit <= 0) {
+            $limit = intval($this->request->param('limit', 30));
+        }
+        $limit = max(1, min(200, $limit));
+        $offset = ($page - 1) * $limit;
 
 
         $query = \db('月度样衣进度')
         $query = \db('月度样衣进度')
             ->whereNull('Mod_rq');
             ->whereNull('Mod_rq');
@@ -97,15 +109,32 @@ class MonthlyGarments extends Api
             });
             });
         }
         }
 
 
-        $results = $query->order('UniqId DESC')->select();
+        $total = (int)(clone $query)->count();
+        $results = $query
+            ->order('UniqId DESC')
+            ->limit($offset, $limit)
+            ->select();
+
+        foreach ($results as &$row) {
+            if (!empty($row['下单日期'])) {
+                $row['下单日期'] = date('Y-m-d', strtotime($row['下单日期']));
+            }
+            if (!empty($row['计划交办日期'])) {
+                $row['计划交办日期'] = date('Y-m-d', strtotime($row['计划交办日期']));
+            }
+        }
+        unset($row);
 
 
         $this->success('成功', [
         $this->success('成功', [
             'result' => $results,
             'result' => $results,
-            'total' => count($results)
+            'total' => $total,
+            'page' => $page,
+            'pageSize' => $limit,
         ]);
         ]);
     }
     }
-     /**
- * 样衣进度新增数据
+
+ /**
+     * 样衣进度新增数据
  */
  */
     public function saveMonthlyGarments()
     public function saveMonthlyGarments()
     {
     {

+ 5 - 8
application/api/controller/ReportingWork.php

@@ -726,21 +726,18 @@ class ReportingWork extends Api
     }
     }
 
 
     /**
     /**
-     * 清理工分报工操作日志(默认仅保留近180天)
-     * @ApiMethod (POST)
-     * @param int $days 保留天数,默认180
-     * @param int $batch 每批删除条数,默认1000
+     * 清理工分报工操作日志(仅保留近180天)
+     * @ApiMethod (GET)
      */
      */
     public function cleanReportingWorkLog()
     public function cleanReportingWorkLog()
     {
     {
-        if (!$this->request->isPost()) {
+        if (!$this->request->isGet()) {
             $this->error('请求方法错误');
             $this->error('请求方法错误');
         }
         }
         $this->ensureReportingWorkLogTable();
         $this->ensureReportingWorkLogTable();
 
 
-        $params = $this->request->post();
-        $days = max(1, intval($params['days'] ?? 180));
-        $batch = max(1, min(5000, intval($params['batch'] ?? 1000)));
+        $days = 180;
+        $batch = 1000;
         $deadline = date('Y-m-d H:i:s', strtotime("-{$days} days"));
         $deadline = date('Y-m-d H:i:s', strtotime("-{$days} days"));
 
 
         $totalDeleted = 0;
         $totalDeleted = 0;