Quellcode durchsuchen

feat(api): add GET /salesForecastSummary/byMonth endpoint and response type

- types: introduce SalesForecastByMonthResponse reusing ForecastSummaryRecord
- api: add getSalesForecastSummaryByMonth(year, month) with params and JSDoc
- keep style consistent with existing forecast-summary APIs
yz vor 2 Wochen
Ursprung
Commit
1532b3cc47
2 geänderte Dateien mit 21 neuen und 0 gelöschten Zeilen
  1. 18 0
      src/api/forecast/forecast-summary.js
  2. 3 0
      src/api/forecast/types.d.ts

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

@@ -21,6 +21,7 @@ import request from '@/router/axios'
  * @typedef {import('./types').SalesForecastMainDetailResponse} SalesForecastMainDetailResponse
  * @typedef {import('./types').SalesForecastMainUpdateRequest} SalesForecastMainUpdateRequest
  * @typedef {import('./types').SalesForecastMainUpdateResponse} SalesForecastMainUpdateResponse
+ * @typedef {import('./types').SalesForecastByMonthResponse} SalesForecastByMonthResponse
  */
 
 /**
@@ -482,3 +483,20 @@ export const approveSalesForecastSummaryParticulars = async (data) => {
     data: { id, forecastMainId, approvalStatus, remark: remark ?? approvalComment ?? '' }
   })
 }
+
+/**
+ * 按年月查询销售预测汇总明细
+ * 对应后端:GET /api/blade-factory/api/factory/salesForecastSummary/byMonth
+ * @param {number|string} year - 年份,例如 2025
+ * @param {number|string} month - 月份,1-12 或 '01'-'12'
+ * @returns {SalesForecastByMonthResponse} 响应(data: ForecastSummaryRecord[])
+ * @example
+ * const res = await getSalesForecastSummaryByMonth(2025, 12)
+ */
+export const getSalesForecastSummaryByMonth = async (year, month) => {
+  return request({
+    url: '/api/blade-factory/api/factory/salesForecastSummary/byMonth',
+    method: 'get',
+    params: { year, month }
+  })
+}

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

@@ -155,6 +155,9 @@ export type ForecastSummaryPageResponse = Promise<AxiosResponse<ApiResponse<Page
 // 新增:销售预测汇总分页响应类型别名(复用 ForecastSummaryPageResponse)
 export type SalesForecastSummaryPageResponse = ForecastSummaryPageResponse
 
+// 新增:按年月查询销售预测汇总(byMonth)- 响应类型(data 为 ForecastSummaryRecord[])
+export type SalesForecastByMonthResponse = Promise<AxiosResponse<ApiResponse<ForecastSummaryRecord[]>>>
+
 // 品牌库存汇总查询参数
 export interface BrandStockQueryParams {
   storageName?: string