Parcourir la source

feat(forecast): 新增销售预测主表添加接口及类型定义

yz il y a 4 semaines
Parent
commit
9d52caf16c
2 fichiers modifiés avec 66 ajouts et 5 suppressions
  1. 36 5
      src/api/forecast/forecast-summary.js
  2. 30 0
      src/api/forecast/types.d.ts

+ 36 - 5
src/api/forecast/forecast-summary.js

@@ -93,11 +93,42 @@ export const getSalesForecastMainList = async (current = 1, size = 10, params =
   return request({
     url: '/api/blade-factory/api/factory/salesForecastSummary/main-list',
     method: 'get',
-    params: {
-      current,
-      size,
-      ...params
-    }
+    params: { current, size, ...params }
+  })
+}
+
+/**
+ * 新增销售预测主表(main-add)
+ * @param {import('./types').SalesForecastMainAddRequest} data - 主表新增请求体(包含年份、月份、审批状态以及子项列表)
+ * @returns {Promise<import('./types').SalesForecastMainAddResponse>} 新增主表响应(data 通常为 null,msg 为提示信息)
+ * @description 新增销售预测主表记录,提交 pcBladeSalesForecastSummaryList 子项明细;遵循后端通用响应结构 { code, success, data, msg }
+ * @example
+ * const payload = {
+ *   year: 2025,
+ *   month: 10,
+ *   approvalStatus: 0,
+ *   pcBladeSalesForecastSummaryList: [
+ *     {
+ *       brandId: 101,
+ *       brandCode: 'BD-001',
+ *       brandName: '品牌A',
+ *       itemId: 2001,
+ *       itemCode: 'IT-2001',
+ *       itemName: '刀片型号A1',
+ *       specs: '100x200mm',
+ *       pattern: '标准花纹',
+ *       forecastQuantity: 500.00,
+ *       approvalStatus: 0
+ *     }
+ *   ]
+ * }
+ * const res = await addSalesForecastMain(payload)
+ */
+export const addSalesForecastMain = async (data) => {
+  return request({
+    url: '/api/blade-factory/api/factory/salesForecastSummary/main-add',
+    method: 'post',
+    data
   })
 }
 

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

@@ -297,3 +297,33 @@ export interface SalesForecastMainRecord {
 
 // 新增:销售预测主表分页(main-list)响应类型
 export type SalesForecastMainListResponse = Promise<AxiosResponse<ApiResponse<PageResult<SalesForecastMainRecord>>>>
+
+// 新增:销售预测主表(main-add)- 子项请求体元素
+export interface SalesForecastMainAddItem {
+  brandId: number
+  brandCode: string
+  brandName: string
+  itemId: number
+  itemCode: string
+  itemName: string
+  specs: string
+  pattern: string
+  forecastQuantity: number
+  /** 审批状态,沿用全局枚举定义 */
+  approvalStatus: ApprovalStatus | number
+}
+
+// 新增:销售预测主表(main-add)- 请求体
+export interface SalesForecastMainAddRequest {
+  /** 年份,例如 2025 */
+  year: number
+  /** 月份,1-12 */
+  month: number
+  /** 顶层审批状态 */
+  approvalStatus: ApprovalStatus | number
+  /** 子项明细列表 */
+  pcBladeSalesForecastSummaryList: SalesForecastMainAddItem[]
+}
+
+// 新增:销售预测主表(main-add)- 响应类型(data 返回为 null,msg 为提示文本,success 表示成功与否)
+export type SalesForecastMainAddResponse = Promise<AxiosResponse<ApiResponse<null>>>