fix(api): 解决生产订单进度和今日生产计划接口参数安全验证问题
- 为productionOrderProgress函数添加默认参数值和安全验证
- 实现页码、页面大小和标签参数的安全范围限制
- 为todayProductionPlan函数添加默认参数值和安全验证
- 限制limit参数在1-20范围内,默认值为4
- 更新接口请求参数结构以包含验证后的安全参数
- 修复首页生产数据展示的数量控制问题
| | |
| | | }); |
| | | }; |
| | | |
| | | 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, |
| | | }, |
| | |
| | | |
| | | 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); |