3 天以前 b9be343f3715dbbb737b2a5a5247440e70871e73
fix(api): 解决生产订单进度和今日生产计划接口参数安全验证问题

- 为productionOrderProgress函数添加默认参数值和安全验证
- 实现页码、页面大小和标签参数的安全范围限制
- 为todayProductionPlan函数添加默认参数值和安全验证
- 限制limit参数在1-20范围内,默认值为4
- 更新接口请求参数结构以包含验证后的安全参数
- 修复首页生产数据展示的数量控制问题
已修改2个文件
24 ■■■■ 文件已修改
src/api/viewIndex.js 22 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/index.vue 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
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,
    },
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);