feat(@vben/web-antd): 新增 ERP API 接口并符合 Vben 项目标准

- 将所有 ERP API 文件从旧的 axios 配置迁移到新的 requestClient
- 使用 namespace 组织接口类型定义,提高代码可维护性
- 将对象方法改为独立的导出函数,符合现代 JavaScript 最佳实践
- 为所有 API 函数添加完整的 TypeScript 类型定义
- 统一分页查询参数和状态更新参数的接口定义
- 涵盖财务、采购、销售、库存等所有 ERP 业务模块
This commit is contained in:
nehc
2025-07-21 19:07:47 +08:00
committed by xingyu
parent 7b7402b986
commit f763ad2855
26 changed files with 2031 additions and 19 deletions

View File

@@ -0,0 +1,92 @@
import type { PageParam, PageResult } from '@vben/request';
import { requestClient } from '#/api/request';
namespace ErpStockInApi {
/** 其它入库单信息 */
export interface StockIn {
id?: number; // 入库编号
no: string; // 入库单号
supplierId: number; // 供应商编号
inTime: Date; // 入库时间
totalCount: number; // 合计数量
totalPrice: number; // 合计金额,单位:元
status: number; // 状态
remark: string; // 备注
}
/** 其它入库单分页查询参数 */
export interface StockInPageParams extends PageParam {
no?: string;
supplierId?: number;
status?: number;
}
/** 其它入库单状态更新参数 */
export interface StockInStatusParams {
id: number;
status: number;
}
}
/**
* 查询其它入库单分页
*/
export function getStockInPage(params: ErpStockInApi.StockInPageParams) {
return requestClient.get<PageResult<ErpStockInApi.StockIn>>(
'/erp/stock-in/page',
{
params,
},
);
}
/**
* 查询其它入库单详情
*/
export function getStockIn(id: number) {
return requestClient.get<ErpStockInApi.StockIn>(`/erp/stock-in/get?id=${id}`);
}
/**
* 新增其它入库单
*/
export function createStockIn(data: ErpStockInApi.StockIn) {
return requestClient.post('/erp/stock-in/create', data);
}
/**
* 修改其它入库单
*/
export function updateStockIn(data: ErpStockInApi.StockIn) {
return requestClient.put('/erp/stock-in/update', data);
}
/**
* 更新其它入库单的状态
*/
export function updateStockInStatus(params: ErpStockInApi.StockInStatusParams) {
return requestClient.put('/erp/stock-in/update-status', null, {
params,
});
}
/**
* 删除其它入库单
*/
export function deleteStockIn(ids: number[]) {
return requestClient.delete('/erp/stock-in/delete', {
params: {
ids: ids.join(','),
},
});
}
/**
* 导出其它入库单 Excel
*/
export function exportStockIn(params: ErpStockInApi.StockInPageParams) {
return requestClient.download('/erp/stock-in/export-excel', {
params,
});
}