Ver Fonte

feat(api): 添加物料列表查询接口及相关类型定义

yz há 2 semanas atrás
pai
commit
15543ad8a0
1 ficheiros alterados com 98 adições e 1 exclusões
  1. 98 1
      src/api/common/index.js

+ 98 - 1
src/api/common/index.js

@@ -81,7 +81,7 @@ import request from '@/router/axios';
  * @typedef {Object} ApiResponse
  * @property {number} code - 响应码
  * @property {boolean} success - 是否成功
- * @property {string} msg - 响应消息
+ * @property {string} statusText - 响应消息
  * @property {Object} data - 响应数据
  */
 
@@ -131,3 +131,100 @@ export const getCustomerDetail = async (customerId) => {
     method: 'get'
   });
 };
+
+/**
+ * 物料查询参数类型定义
+ * @typedef {Object} ItemQueryParams
+ * @property {number} [current=1] - 当前页码
+ * @property {number} [size=10] - 每页数量
+ * @property {string} [itemName] - 物料名称(模糊查询)
+ */
+
+/**
+ * 物料数据项类型定义
+ * @typedef {Object} ItemRecord
+ * @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 - 状态 1-正常 0-禁用
+ * @property {number} isDeleted - 是否删除 0-未删除 1-已删除
+ * @property {number} ORG_ID - 组织ID
+ * @property {string} ORG_CODE - 组织编码
+ * @property {string} ORG_NAME - 组织名称
+ * @property {number} Item_ID - 物料ID
+ * @property {string} Item_Code - 物料编码
+ * @property {string} Item_Name - 物料名称
+ * @property {string} Item_PECS - 物料规格
+ * @property {string} Item_Description - 物料描述
+ * @property {string} Item_Code1 - 物料编码1
+ * @property {string} Item_Code2 - 物料编码2
+ * @property {number} MainItemCategory_ID - 主物料分类ID
+ * @property {string} MainItemCategory_Code - 主物料分类编码
+ * @property {string} MainItemCategory_Name - 主物料分类名称
+ * @property {number} InventoryInfo_ID - 库存信息ID
+ * @property {string} InventoryInfo_Code - 库存信息编码
+ * @property {string} InventoryInfo_Name - 库存信息名称(单位)
+ * @property {number|null} Warehouse_ID - 仓库ID
+ * @property {string|null} Warehouse_Code - 仓库编码
+ * @property {string|null} Warehouse_Name - 仓库名称
+ * @property {number|null} Saleser_ID - 销售员ID
+ * @property {string|null} Saleser_CODE - 销售员编码
+ * @property {string|null} Saleser_NAME - 销售员名称
+ * @property {number|null} ShipmentWarehouse_ID - 发货仓库ID
+ * @property {string|null} ShipmentWarehouse_Code - 发货仓库编码
+ * @property {string|null} ShipmentWarehouse_Name - 发货仓库名称
+ * @property {string} createdon - 创建日期
+ * @property {string} ModifiedOn - 修改日期
+ */
+
+/**
+ * 物料分页响应数据类型定义
+ * @typedef {Object} ItemPageResponse
+ * @property {ItemRecord[]} 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 - 总页数
+ */
+
+/**
+ * 获取物料列表
+ * @param {number} [current=1] - 当前页码
+ * @param {number} [size=10] - 每页数量
+ * @param {ItemQueryParams} [params={}] - 查询参数
+ * @returns {Promise<ApiResponse<ItemPageResponse>>} 物料列表响应
+ * @description 获取物料档案列表,支持按物料名称模糊查询和分页
+ * @example
+ * // 获取第一页10条数据
+ * const result = await getItemList(1, 10);
+ * 
+ * // 按物料名称查询
+ * const result = await getItemList(1, 10, { itemName: '炭黑' });
+ */
+/**
+ * 获取物料列表
+ * @param {number|string} current - 当前页码
+ * @param {number|string} size - 每页数量
+ * @param {ItemQueryParams} params - 查询参数
+ * @returns {Promise<ApiResponse<ItemPageResponse>>} 物料列表响应
+ */
+export const getItemList = async (current = 1, size = 10, params = {}) => {
+  return request({
+    url: '/api/blade-factory/api/factory/view-item',
+    method: 'get',
+    params: {
+      current,
+      size,
+      ...params
+    }
+  });
+};