|
@@ -1,103 +1,13 @@
|
|
|
import request from '@/router/axios'
|
|
|
|
|
|
-/**
|
|
|
- * 预测汇总查询参数类型定义
|
|
|
- * @typedef {Object} ForecastSummaryQueryParams
|
|
|
- * @property {number} [current=1] - 当前页码
|
|
|
- * @property {number} [size=10] - 每页数量
|
|
|
- * @property {number} [year] - 年份
|
|
|
- * @property {number} [month] - 月份
|
|
|
- * @property {number} [customerId] - 客户ID
|
|
|
- * @property {string} [customerCode] - 客户编码
|
|
|
- * @property {string} [customerName] - 客户名称
|
|
|
- * @property {number} [brandId] - 品牌ID
|
|
|
- * @property {string} [brandCode] - 品牌编码
|
|
|
- * @property {string} [brandName] - 品牌名称
|
|
|
- * @property {number} [itemId] - 物料ID
|
|
|
- * @property {string} [itemCode] - 物料编码
|
|
|
- * @property {string} [itemName] - 物料名称
|
|
|
- * @property {number} [approvalStatus] - 审批状态 0未审批 1已通过 2已拒绝
|
|
|
- */
|
|
|
-
|
|
|
-/**
|
|
|
- * 预测汇总数据项类型定义
|
|
|
- * @typedef {Object} ForecastSummaryItem
|
|
|
- * @property {string} id - 预测汇总ID
|
|
|
- * @property {string} createUser - 创建用户ID
|
|
|
- * @property {string} createDept - 创建部门ID
|
|
|
- * @property {string} createTime - 创建时间
|
|
|
- * @property {string} updateUser - 更新用户ID
|
|
|
- * @property {string} updateTime - 更新时间
|
|
|
- * @property {number} status - 状态
|
|
|
- * @property {number} isDeleted - 是否删除
|
|
|
- * @property {number} year - 年份
|
|
|
- * @property {number} month - 月份
|
|
|
- * @property {number} customerId - 客户ID
|
|
|
- * @property {string} customerCode - 客户编码
|
|
|
- * @property {string} customerName - 客户名称
|
|
|
- * @property {number} brandId - 品牌ID
|
|
|
- * @property {string} brandCode - 品牌编码
|
|
|
- * @property {string} brandName - 品牌名称
|
|
|
- * @property {number} itemId - 物料ID
|
|
|
- * @property {string} itemCode - 物料编码
|
|
|
- * @property {string} itemName - 物料名称
|
|
|
- * @property {string} specs - 规格
|
|
|
- * @property {string} pattern - 花纹
|
|
|
- * @property {string} forecastQuantity - 预测数量
|
|
|
- * @property {number} approvalStatus - 审批状态 0未审批 1已通过 2已拒绝
|
|
|
- * @property {number|null} approvedBy - 审批人ID
|
|
|
- * @property {string|null} approvedName - 审批人姓名
|
|
|
- * @property {string|null} approvedTime - 审批时间
|
|
|
- */
|
|
|
-
|
|
|
-/**
|
|
|
- * 预测汇总分页响应数据类型定义
|
|
|
- * @typedef {Object} ForecastSummaryPageResponse
|
|
|
- * @property {ForecastSummaryItem[]} records - 预测汇总数据记录
|
|
|
- * @property {number} total - 总记录数
|
|
|
- * @property {number} size - 每页数量
|
|
|
- * @property {number} current - 当前页码
|
|
|
- * @property {Array} orders - 排序信息
|
|
|
- * @property {boolean} optimizeCountSql - 是否优化count查询
|
|
|
- * @property {boolean} hitCount - 是否命中count缓存
|
|
|
- * @property {string|null} countId - count查询ID
|
|
|
- * @property {number|null} maxLimit - 最大限制
|
|
|
- * @property {boolean} searchCount - 是否查询count
|
|
|
- * @property {number} pages - 总页数
|
|
|
- */
|
|
|
-
|
|
|
-/**
|
|
|
- * API响应数据类型定义
|
|
|
- * @template T
|
|
|
- * @typedef {Object} ApiResponse
|
|
|
- * @property {ApiResponseData<T>} data
|
|
|
- * @property {ApiResponseData<T>} data
|
|
|
- * @property {string} statusText - HTTP状态文本 (来自AxiosResponse)
|
|
|
- * @property {Object} headers - 响应头信息 (来自AxiosResponse)
|
|
|
- * @property {string} [headers.content-type] - 内容类型
|
|
|
- * @property {Object} config - 请求配置信息 (来自AxiosResponse)
|
|
|
- * @property {string} [config.method] - 请求方法
|
|
|
- * @property {string} [config.url] - 请求URL
|
|
|
- * @property {Record<string, any>} [config.params] - 请求参数
|
|
|
- * @property {Record<string, any>} [config.headers] - 请求头
|
|
|
- */
|
|
|
-
|
|
|
-/**
|
|
|
- * API响应内层data类型定义
|
|
|
- * @template T
|
|
|
- * @typedef {Object} ApiResponseData
|
|
|
- * @property {number} code - 响应码
|
|
|
- * @property {boolean} success - 是否成功
|
|
|
- * @property {T} data - 响应数据
|
|
|
- * @property {string} msg - 响应消息
|
|
|
- */
|
|
|
+// 导入类型定义
|
|
|
|
|
|
/**
|
|
|
* 获取预测汇总列表
|
|
|
* @param {number} [current=1] - 当前页码
|
|
|
* @param {number} [size=10] - 每页数量
|
|
|
- * @param {ForecastSummaryQueryParams} [params={}] - 查询参数
|
|
|
- * @returns {Promise<AxiosResponse<ForecastSummaryPageResponse>>} 预测汇总列表响应
|
|
|
+ * @param {import('../types/forecast').ForecastSummaryQueryParams} [params={}] - 查询参数
|
|
|
+ * @returns {Promise<import('../types/forecast').ForecastSummaryListResponse>} 预测汇总列表响应
|
|
|
* @description 获取经销商销售预测汇总列表,支持多条件查询和分页
|
|
|
* @example
|
|
|
* // 获取第一页10条数据
|
|
@@ -127,7 +37,7 @@ export const getForecastSummaryList = async (current = 1, size = 10, params = {}
|
|
|
/**
|
|
|
* 获取预测汇总详情
|
|
|
* @param {string|number} forecastSummaryId - 预测汇总ID
|
|
|
- * @returns {Promise<AxiosResponse<ForecastSummaryItem>>} 预测汇总详情响应
|
|
|
+ * @returns {Promise<import('../types/forecast').ForecastSummaryOperationResponse>} 预测汇总详情响应
|
|
|
* @description 根据ID获取预测汇总的详细信息
|
|
|
* @example
|
|
|
* const result = await getForecastSummaryDetail('1954819531796865026')
|
|
@@ -144,3 +54,120 @@ export const getForecastSummaryDetail = async (forecastSummaryId) => {
|
|
|
method: 'get'
|
|
|
})
|
|
|
}
|
|
|
+
|
|
|
+/**
|
|
|
+ * 添加预测汇总
|
|
|
+ * @param {import('../types/forecast').ForecastSummaryForm} data - 预测汇总表单数据
|
|
|
+ * @returns {Promise<import('../types/forecast').ForecastSummaryOperationResponse>} 添加预测汇总响应
|
|
|
+ * @description 创建新的销售预测汇总记录
|
|
|
+ * @example
|
|
|
+ * const formData = {
|
|
|
+ * year: 2023,
|
|
|
+ * month: 8,
|
|
|
+ * customerId: 1001,
|
|
|
+ * customerCode: 'DLR001',
|
|
|
+ * customerName: '上海轮胎经销商',
|
|
|
+ * brandId: 2001,
|
|
|
+ * brandCode: 'BRD001',
|
|
|
+ * brandName: '米其林',
|
|
|
+ * itemId: 3001,
|
|
|
+ * itemCode: 'ITEM001',
|
|
|
+ * itemName: '轮胎A型号',
|
|
|
+ * specs: '225/65R17',
|
|
|
+ * pattern: 'Primacy SUV',
|
|
|
+ * forecastQuantity: 150,
|
|
|
+ * approvalStatus: 0
|
|
|
+ * }
|
|
|
+ * const result = await addForecastSummary(formData)
|
|
|
+ */
|
|
|
+export const addForecastSummary = async (data) => {
|
|
|
+ return request({
|
|
|
+ url: '/api/blade-factory/api/factory/forecast-summary',
|
|
|
+ method: 'post',
|
|
|
+ data
|
|
|
+ })
|
|
|
+}
|
|
|
+
|
|
|
+/**
|
|
|
+ * 更新预测汇总
|
|
|
+ * @param {Object} data - 预测汇总表单数据(必须包含id)
|
|
|
+ * @returns {Promise<import('../types/forecast').ForecastSummaryOperationResponse>} 更新预测汇总响应
|
|
|
+ * @description 更新现有的销售预测汇总记录
|
|
|
+ * @example
|
|
|
+ * const formData = {
|
|
|
+ * id: '1954819531796865026',
|
|
|
+ * year: 2023,
|
|
|
+ * month: 8,
|
|
|
+ * customerId: 1001,
|
|
|
+ * customerCode: 'DLR001',
|
|
|
+ * customerName: '上海轮胎经销商',
|
|
|
+ * brandId: 2001,
|
|
|
+ * brandCode: 'BRD001',
|
|
|
+ * brandName: '米其林',
|
|
|
+ * itemId: 3001,
|
|
|
+ * itemCode: 'ITEM001',
|
|
|
+ * itemName: '轮胎A型号',
|
|
|
+ * specs: '225/65R17',
|
|
|
+ * pattern: 'Primacy SUV',
|
|
|
+ * forecastQuantity: 180,
|
|
|
+ * approvalStatus: 0
|
|
|
+ * }
|
|
|
+ * const result = await updateForecastSummary(formData)
|
|
|
+ */
|
|
|
+export const updateForecastSummary = async (data) => {
|
|
|
+ return request({
|
|
|
+ url: '/api/blade-factory/api/factory/forecast-summary',
|
|
|
+ method: 'put',
|
|
|
+ data
|
|
|
+ })
|
|
|
+}
|
|
|
+
|
|
|
+/**
|
|
|
+ * 删除预测汇总
|
|
|
+ * @param {string|number} id - 预测汇总ID
|
|
|
+ * @returns {Promise<import('../types/forecast').ForecastSummaryOperationResponse>} 删除预测汇总响应
|
|
|
+ * @description 根据ID删除销售预测汇总记录
|
|
|
+ * @example
|
|
|
+ * const result = await removeForecastSummary('1954819531796865026')
|
|
|
+ */
|
|
|
+export const removeForecastSummary = async (id) => {
|
|
|
+ return request({
|
|
|
+ url: `/api/blade-factory/api/factory/forecast-summary/${id}`,
|
|
|
+ method: 'delete'
|
|
|
+ })
|
|
|
+}
|
|
|
+
|
|
|
+/**
|
|
|
+ * 批量删除预测汇总
|
|
|
+ * @param {Array<string|number>} ids - 预测汇总ID数组
|
|
|
+ * @returns {Promise<import('../types/forecast').ForecastSummaryBatchOperationResponse>} 批量删除预测汇总响应
|
|
|
+ * @description 批量删除多个销售预测汇总记录
|
|
|
+ * @example
|
|
|
+ * const result = await batchRemoveForecastSummary(['1954819531796865026', '1954819531796865027'])
|
|
|
+ */
|
|
|
+export const batchRemoveForecastSummary = async (ids) => {
|
|
|
+ return request({
|
|
|
+ url: '/api/blade-factory/api/factory/forecast-summary/batch',
|
|
|
+ method: 'delete',
|
|
|
+ data: ids
|
|
|
+ })
|
|
|
+}
|
|
|
+
|
|
|
+/**
|
|
|
+ * 审批预测汇总
|
|
|
+ * @param {Object} data - 审批数据
|
|
|
+ * @param {string|number} data.id - 预测汇总ID
|
|
|
+ * @param {number} data.approvalStatus - 审批状态 1-通过 2-拒绝
|
|
|
+ * @param {string} [data.approvalComment] - 审批意见
|
|
|
+ * @returns {Promise<import('../types/forecast').ForecastSummaryOperationResponse>} 审批预测汇总响应
|
|
|
+ * @description 审批销售预测汇总记录
|
|
|
+ * @example
|
|
|
+ * const result = await approveForecastSummary({ id: '1954819531796865026', approvalStatus: 1, approvalComment: '同意申报' })
|
|
|
+ */
|
|
|
+export const approveForecastSummary = async (data) => {
|
|
|
+ return request({
|
|
|
+ url: '/api/blade-factory/api/factory/forecast-summary/approve',
|
|
|
+ method: 'post',
|
|
|
+ data
|
|
|
+ })
|
|
|
+}
|