Browse Source

feat(forecast): 添加按月导出销售预测数据的功能

yz 1 month ago
parent
commit
6779abe7e9
1 changed files with 18 additions and 0 deletions
  1. 18 0
      src/api/forecast/forecast-summary.js

+ 18 - 0
src/api/forecast/forecast-summary.js

@@ -327,6 +327,24 @@ export const exportSalesForecastTemplate = async (current = 1, size = 10, params
 }
 
 /**
+ * 销售预测数据导出(按年月)
+ * 对应后端:GET /api/blade-factory/api/factory/salesForecastSummary/export/{year}/{month}
+ * @param {number|string} year - 年份,如 2025
+ * @param {number|string} month - 月份,1-12 或 '01'-'12'
+ * @returns {Promise<SalesForecastTemplateResponse>} 导出响应(Blob 数据 + 响应头)
+ * @example
+ * const res = await exportSalesForecastByMonth(2025, 10)
+ * // 文件名可从 res.headers['content-disposition'] 中解析
+ */
+export const exportSalesForecastByMonth = async (year, month) => {
+  return request({
+    url: `/api/blade-factory/api/factory/salesForecastSummary/export/${year}/${month}`,
+    method: 'get',
+    responseType: 'blob'
+  })
+}
+
+/**
  * 获取销售预测主表详情
  * 对应后端:GET /api/blade-factory/api/factory/salesForecastSummary/forecast/detail
  * @param {string|number} id - 主表ID