index.js 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230
  1. import request from '@/router/axios';
  2. /**
  3. * 客户查询参数类型定义
  4. * @typedef {Object} CustomerQueryParams
  5. * @property {number} [current=1] - 当前页码
  6. * @property {number} [size=10] - 每页数量
  7. * @property {string} [Customer_CODE] - 客户编码
  8. * @property {string} [Customer_NAME] - 客户名称
  9. * @property {string} [Customer_ShortName] - 客户简称
  10. * @property {string} [CustomerCategory_CODE] - 客户分类编码
  11. * @property {string} [Department_CODE] - 部门编码
  12. * @property {string} [Saleser_CODE] - 销售员编码
  13. * @property {number} [status] - 状态 0-禁用 1-启用
  14. */
  15. /**
  16. * 客户数据项类型定义
  17. * @typedef {Object} CustomerItem
  18. * @property {string} id - 客户ID
  19. * @property {string} createUser - 创建用户ID
  20. * @property {string} createDept - 创建部门ID
  21. * @property {string} createTime - 创建时间
  22. * @property {string} updateUser - 更新用户ID
  23. * @property {string} updateTime - 更新时间
  24. * @property {number} status - 状态
  25. * @property {number} isDeleted - 是否删除
  26. * @property {number} ORG_ID - 组织ID
  27. * @property {string} ORG_CODE - 组织编码
  28. * @property {string} ORG_NAME - 组织名称
  29. * @property {number} Customer_ID - 客户ID
  30. * @property {string} Customer_CODE - 客户编码
  31. * @property {string} Customer_NAME - 客户名称
  32. * @property {string} Customer_ShortName - 客户简称
  33. * @property {number|null} CustomerCategory_ID - 客户分类ID
  34. * @property {string|null} CustomerCategory_CODE - 客户分类编码
  35. * @property {string|null} CustomerCategory_NAME - 客户分类名称
  36. * @property {string} CreatedBy - 创建人
  37. * @property {string} CreatedOn - 创建时间
  38. * @property {string} ModifiedBy - 修改人
  39. * @property {string} ModifiedOn - 修改时间
  40. * @property {string} StateTaxNo - 税号
  41. * @property {string} BuyerNoteName - 买方备注名称
  42. * @property {string} BuyerBankAccount - 买方银行账户
  43. * @property {string} BuyerBankAccountCode - 买方银行账户编码
  44. * @property {string} extend9 - 扩展字段9
  45. * @property {number} TaxSchedule_ID - 税率表ID
  46. * @property {string} TaxSchedule_CODE - 税率表编码
  47. * @property {string} TaxSchedule_NAME - 税率表名称
  48. * @property {string} TaxRate - 税率
  49. * @property {string|null} DescFlexField_PrivateDescSeg1 - 描述弹性字段1
  50. * @property {string|null} DescFlexField_PrivateDescSeg2 - 描述弹性字段2
  51. * @property {string|null} DescFlexField_PrivateDescSeg3 - 描述弹性字段3
  52. * @property {number|null} Department_ID - 部门ID
  53. * @property {string} Department_CODE - 部门编码
  54. * @property {string} Department_NAME - 部门名称
  55. * @property {number|null} Saleser_ID - 销售员ID
  56. * @property {string} Saleser_CODE - 销售员编码
  57. * @property {string} Saleser_NAME - 销售员名称
  58. * @property {number} TradeCurrency_ID - 交易货币ID
  59. * @property {string} TradeCurrency_CODE - 交易货币编码
  60. * @property {string} TradeCurrency_NAME - 交易货币名称
  61. * @property {number} PriceList_ID - 价格表ID
  62. * @property {string} PriceList_CODE - 价格表编码
  63. * @property {string} PriceList_NAME - 价格表名称
  64. * @property {boolean} IsTaxPrice - 是否含税价格
  65. * @property {number} ShippmentRule_ID - 发货规则ID
  66. * @property {string} ShippmentRule_CODE - 发货规则编码
  67. * @property {string} ShippmentRule_NAME - 发货规则名称
  68. * @property {number} RecervalTerm_ID - 收款条件ID
  69. * @property {string} RecervalTerm_CODE - 收款条件编码
  70. * @property {string} RecervalTerm_NAME - 收款条件名称
  71. * @property {number} ARConfirmTerm_ID - 应收立账条件ID
  72. * @property {string} ARConfirmTerm_CODE - 应收立账条件编码
  73. * @property {string} ARConfirmTerm_NAME - 应收立账条件名称
  74. */
  75. /**
  76. * API响应数据类型定义
  77. * @typedef {Object} ApiResponse
  78. * @property {number} code - 响应码
  79. * @property {boolean} success - 是否成功
  80. * @property {string} statusText - 响应消息
  81. * @property {Object} data - 响应数据
  82. */
  83. /**
  84. * 分页响应数据类型定义
  85. * @typedef {Object} PageResponse
  86. * @property {CustomerItem[]} records - 数据记录
  87. * @property {number} total - 总记录数
  88. * @property {number} size - 每页数量
  89. * @property {number} current - 当前页码
  90. * @property {Array} orders - 排序信息
  91. * @property {boolean} optimizeCountSql - 是否优化count查询
  92. * @property {boolean} hitCount - 是否命中count缓存
  93. * @property {string|null} countId - count查询ID
  94. * @property {number|null} maxLimit - 最大限制
  95. * @property {boolean} searchCount - 是否查询count
  96. * @property {number} pages - 总页数
  97. */
  98. /**
  99. * 获取客户档案列表
  100. * @param {number} [current=1] - 当前页码
  101. * @param {number} [size=10] - 每页数量
  102. * @param {CustomerQueryParams} [params={}] - 查询参数
  103. * @returns {Promise<ApiResponse<PageResponse>>} 客户档案列表响应
  104. */
  105. export const getCustomerList = async (current = 1, size = 10, params = {}) => {
  106. return request({
  107. url: '/api/blade-factory/api/factory/view-customer',
  108. method: 'get',
  109. params: {
  110. current,
  111. size,
  112. ...params
  113. }
  114. });
  115. };
  116. /**
  117. * 获取客户档案详情
  118. * @param {string} customerId - 客户ID
  119. * @returns {Promise<AxiosResponse<CustomerItem>>} 客户档案详情响应
  120. */
  121. export const getCustomerDetail = async (customerId) => {
  122. return request({
  123. url: `/api/blade-factory/api/factory/view-customer/${customerId}`,
  124. method: 'get'
  125. });
  126. };
  127. /**
  128. * 物料查询参数类型定义
  129. * @typedef {Object} ItemQueryParams
  130. * @property {number} [current=1] - 当前页码
  131. * @property {number} [size=10] - 每页数量
  132. * @property {string} [itemName] - 物料名称(模糊查询)
  133. */
  134. /**
  135. * 物料数据项类型定义
  136. * @typedef {Object} ItemRecord
  137. * @property {string} id - 记录ID
  138. * @property {string} createUser - 创建用户ID
  139. * @property {string} createDept - 创建部门ID
  140. * @property {string} createTime - 创建时间
  141. * @property {string} updateUser - 更新用户ID
  142. * @property {string} updateTime - 更新时间
  143. * @property {number} status - 状态 1-正常 0-禁用
  144. * @property {number} isDeleted - 是否删除 0-未删除 1-已删除
  145. * @property {number} ORG_ID - 组织ID
  146. * @property {string} ORG_CODE - 组织编码
  147. * @property {string} ORG_NAME - 组织名称
  148. * @property {number} Item_ID - 物料ID
  149. * @property {string} Item_Code - 物料编码
  150. * @property {string} Item_Name - 物料名称
  151. * @property {string} Item_PECS - 物料规格
  152. * @property {string} Item_Description - 物料描述
  153. * @property {string} Item_Code1 - 物料编码1
  154. * @property {string} Item_Code2 - 物料编码2
  155. * @property {number} MainItemCategory_ID - 主物料分类ID
  156. * @property {string} MainItemCategory_Code - 主物料分类编码
  157. * @property {string} MainItemCategory_Name - 主物料分类名称
  158. * @property {number} InventoryInfo_ID - 库存信息ID
  159. * @property {string} InventoryInfo_Code - 库存信息编码
  160. * @property {string} InventoryInfo_Name - 库存信息名称(单位)
  161. * @property {number|null} Warehouse_ID - 仓库ID
  162. * @property {string|null} Warehouse_Code - 仓库编码
  163. * @property {string|null} Warehouse_Name - 仓库名称
  164. * @property {number|null} Saleser_ID - 销售员ID
  165. * @property {string|null} Saleser_CODE - 销售员编码
  166. * @property {string|null} Saleser_NAME - 销售员名称
  167. * @property {number|null} ShipmentWarehouse_ID - 发货仓库ID
  168. * @property {string|null} ShipmentWarehouse_Code - 发货仓库编码
  169. * @property {string|null} ShipmentWarehouse_Name - 发货仓库名称
  170. * @property {string} createdon - 创建日期
  171. * @property {string} ModifiedOn - 修改日期
  172. */
  173. /**
  174. * 物料分页响应数据类型定义
  175. * @typedef {Object} ItemPageResponse
  176. * @property {ItemRecord[]} records - 物料数据记录
  177. * @property {number} total - 总记录数
  178. * @property {number} size - 每页数量
  179. * @property {number} current - 当前页码
  180. * @property {Array} orders - 排序信息
  181. * @property {boolean} optimizeCountSql - 是否优化count查询
  182. * @property {boolean} hitCount - 是否命中count缓存
  183. * @property {string|null} countId - count查询ID
  184. * @property {number|null} maxLimit - 最大限制
  185. * @property {boolean} searchCount - 是否查询count
  186. * @property {number} pages - 总页数
  187. */
  188. /**
  189. * 获取物料列表
  190. * @param {number} [current=1] - 当前页码
  191. * @param {number} [size=10] - 每页数量
  192. * @param {ItemQueryParams} [params={}] - 查询参数
  193. * @returns {Promise<ApiResponse<ItemPageResponse>>} 物料列表响应
  194. * @description 获取物料档案列表,支持按物料名称模糊查询和分页
  195. * @example
  196. * // 获取第一页10条数据
  197. * const result = await getItemList(1, 10);
  198. *
  199. * // 按物料名称查询
  200. * const result = await getItemList(1, 10, { itemName: '炭黑' });
  201. */
  202. /**
  203. * 获取物料列表
  204. * @param {number|string} current - 当前页码
  205. * @param {number|string} size - 每页数量
  206. * @param {ItemQueryParams} params - 查询参数
  207. * @returns {Promise<ApiResponse<ItemPageResponse>>} 物料列表响应
  208. */
  209. export const getItemList = async (current = 1, size = 10, params = {}) => {
  210. return request({
  211. url: '/api/blade-factory/api/factory/view-item',
  212. method: 'get',
  213. params: {
  214. current,
  215. size,
  216. ...params
  217. }
  218. });
  219. };