From b9be343f3715dbbb737b2a5a5247440e70871e73 Mon Sep 17 00:00:00 2001
From: 云 <2163098428@qq.com>
Date: 星期三, 20 五月 2026 17:52:54 +0800
Subject: [PATCH] fix(api): 解决生产订单进度和今日生产计划接口参数安全验证问题

---
 src/views/index.vue  |    2 +-
 src/api/viewIndex.js |   22 ++++++++++++++++++----
 2 files changed, 19 insertions(+), 5 deletions(-)

diff --git a/src/api/viewIndex.js b/src/api/viewIndex.js
index 89f43b8..9cae219 100644
--- a/src/api/viewIndex.js
+++ b/src/api/viewIndex.js
@@ -347,22 +347,36 @@
   });
 };
 
-export const productionOrderProgress = (params) => {
+export const productionOrderProgress = (params = {}) => {
+  const safePageNum = Math.max(1, Number(params.pageNum || 1));
+  const safePageSize = Math.min(50, Math.max(1, Number(params.pageSize || 10)));
+  const safeTab = ["all", "inProgress", "completed", "paused"].includes(params.tab)
+    ? params.tab
+    : "all";
   return request({
     url: "/home/productionOrderProgress",
     method: "get",
-    params,
+    params: {
+      ...params,
+      tab: safeTab,
+      pageNum: safePageNum,
+      pageSize: safePageSize,
+    },
     headers: {
       handleAuthError: false,
     },
   });
 };
 
-export const todayProductionPlan = (params) => {
+export const todayProductionPlan = (params = {}) => {
+  const safeLimit = Math.min(20, Math.max(1, Number(params.limit || 4)));
   return request({
     url: "/home/todayProductionPlan",
     method: "get",
-    params,
+    params: {
+      ...params,
+      limit: safeLimit,
+    },
     headers: {
       handleAuthError: false,
     },
diff --git a/src/views/index.vue b/src/views/index.vue
index 5558d81..3176042 100644
--- a/src/views/index.vue
+++ b/src/views/index.vue
@@ -1229,7 +1229,7 @@
 
 const refreshTodayProductionPlan = async () => {
   try {
-    const res = await todayProductionPlan({ limit: 5 });
+    const res = await todayProductionPlan({ limit: 4 });
     const data = res?.data || {};
     todayPlanTotal.value = Number(data.total || 0);
     todayPlanList.value = (data.records || []).map(mapTodayPlanRecord);

--
Gitblit v1.9.3