Pārlūkot izejas kodu

feat: 更新Vue配置中的API代理目标并调整预测摘要API及其类型定义

yz 1 mēnesi atpakaļ
vecāks
revīzija
2abac46af4
2 mainītis faili ar 29 papildinājumiem un 0 dzēšanām
  1. 20 0
      src/api/forecast/forecast-summary.js
  2. 9 0
      src/api/forecast/types.d.ts

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

@@ -22,6 +22,7 @@ import request from '@/router/axios'
  * @typedef {import('./types').SalesForecastMainUpdateRequest} SalesForecastMainUpdateRequest
  * @typedef {import('./types').SalesForecastMainUpdateRequest} SalesForecastMainUpdateRequest
  * @typedef {import('./types').SalesForecastMainUpdateResponse} SalesForecastMainUpdateResponse
  * @typedef {import('./types').SalesForecastMainUpdateResponse} SalesForecastMainUpdateResponse
  * @typedef {import('./types').SalesForecastByMonthResponse} SalesForecastByMonthResponse
  * @typedef {import('./types').SalesForecastByMonthResponse} SalesForecastByMonthResponse
+ * @typedef {import('./types').SalesForecastExportByYearMonthParams} SalesForecastExportByYearMonthParams
  */
  */
 
 
 /**
 /**
@@ -393,6 +394,25 @@ export const exportSalesForecastByMonth = async (year, month) => {
 }
 }
 
 
 /**
 /**
+ * 销售预测数据导出(按年月:query参数)
+ * 对应后端:GET /api/blade-factory/api/factory/salesForecastSummary/exportByYearMonth?year=2025&month=10
+ * @param {SalesForecastExportByYearMonthParams['year']} year - 年份,如 2025
+ * @param {SalesForecastExportByYearMonthParams['month']} month - 月份,1-12 或 '01'-'12'
+ * @returns {Promise<SalesForecastTemplateResponse>} 导出响应(Blob 数据 + 响应头)
+ * @example
+ * const res = await exportSalesForecastByYearMonthQuery(2025, 10)
+ * // 文件名可从 res.headers['content-disposition'] 中解析
+ */
+export const exportSalesForecastByYearMonthQuery = async (year, month) => {
+  return request({
+    url: '/api/blade-factory/api/factory/salesForecastSummary/exportByYearMonth',
+    method: 'get',
+    responseType: 'blob',
+    params: { year, month }
+  })
+}
+
+/**
  * 销售预测数据导出(用户维度,按年月)
  * 销售预测数据导出(用户维度,按年月)
  * 对应后端:GET /api/blade-factory/api/factory/salesForecastSummary/user/export/{year}/{month}
  * 对应后端:GET /api/blade-factory/api/factory/salesForecastSummary/user/export/{year}/{month}
  * @param {number|string} year - 年份,如 2025
  * @param {number|string} year - 年份,如 2025

+ 9 - 0
src/api/forecast/types.d.ts

@@ -363,5 +363,14 @@ export interface DownloadHeaders {
   'content-type'?: string
   'content-type'?: string
   date?: string
   date?: string
 }
 }
+
+// 新增:销售预测汇总按年月导出(exportByYearMonth)- 查询参数
+export interface SalesForecastExportByYearMonthParams {
+  /** 年份,例如 2025 */
+  year: number | string
+  /** 月份,1-12 或 '01'-'12' */
+  month: number | string
+}
+
 // 新增:销售预测模板下载响应类型(Blob + 下载头)
 // 新增:销售预测模板下载响应类型(Blob + 下载头)
 export type SalesForecastTemplateResponse = Promise<AxiosResponse<Blob> & { headers: DownloadHeaders }>
 export type SalesForecastTemplateResponse = Promise<AxiosResponse<Blob> & { headers: DownloadHeaders }>