| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146 |
- 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<ApiResponse<ForecastSummaryPageResponse>>} 预测汇总列表响应
- * @description 获取经销商销售预测汇总列表,支持多条件查询和分页
- * @example
- * // 获取第一页10条数据
- * const result = await getForecastSummaryList(1, 10)
- *
- * // 按年月查询
- * const result = await getForecastSummaryList(1, 10, { year: 2023, month: 8 })
- *
- * // 按客户查询
- * const result = await getForecastSummaryList(1, 10, { customerId: 1002 })
- *
- * // 按审批状态查询
- * const result = await getForecastSummaryList(1, 10, { approvalStatus: 2 })
- */
- export const getForecastSummaryList = async (current = 1, size = 10, params = {}) => {
- return request({
- url: '/api/blade-factory/api/factory/forecast-summary',
- method: 'get',
- params: {
- current,
- size,
- ...params
- }
- })
- }
- /**
- * 获取预测汇总详情
- * @param {string|number} forecastSummaryId - 预测汇总ID
- * @returns {Promise<ApiResponse<ForecastSummaryItem>>} 预测汇总详情响应
- * @description 根据ID获取预测汇总的详细信息
- * @example
- * const result = await getForecastSummaryDetail('1954819531796865026')
- *
- * // 处理响应数据
- * if (result.success && result.code === 200) {
- * const summaryData = result.data
- * console.log('预测汇总详情:', summaryData)
- * }
- */
- export const getForecastSummaryDetail = async (forecastSummaryId) => {
- return request({
- url: `/api/blade-factory/api/factory/forecast-summary/${forecastSummaryId}`,
- method: 'get'
- })
- }
|