feat(@vben/web-antd): 新增 ERP API 接口并符合 Vben 项目标准
- 将所有 ERP API 文件从旧的 axios 配置迁移到新的 requestClient - 使用 namespace 组织接口类型定义,提高代码可维护性 - 将对象方法改为独立的导出函数,符合现代 JavaScript 最佳实践 - 为所有 API 函数添加完整的 TypeScript 类型定义 - 统一分页查询参数和状态更新参数的接口定义 - 涵盖财务、采购、销售、库存等所有 ERP 业务模块
This commit is contained in:
103
apps/web-antd/src/api/erp/finance/payment/index.ts
Normal file
103
apps/web-antd/src/api/erp/finance/payment/index.ts
Normal file
@@ -0,0 +1,103 @@
|
||||
import type { PageParam, PageResult } from '@vben/request';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
namespace ErpFinancePaymentApi {
|
||||
/** 付款单信息 */
|
||||
export interface FinancePayment {
|
||||
id?: number; // 付款单编号
|
||||
no: string; // 付款单号
|
||||
supplierId: number; // 供应商编号
|
||||
paymentTime: Date; // 付款时间
|
||||
totalPrice: number; // 合计金额,单位:元
|
||||
status: number; // 状态
|
||||
remark: string; // 备注
|
||||
}
|
||||
|
||||
/** 付款单分页查询参数 */
|
||||
export interface FinancePaymentPageParams extends PageParam {
|
||||
no?: string;
|
||||
supplierId?: number;
|
||||
status?: number;
|
||||
}
|
||||
|
||||
/** 付款单状态更新参数 */
|
||||
export interface FinancePaymentStatusParams {
|
||||
id: number;
|
||||
status: number;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询付款单分页
|
||||
*/
|
||||
export function getFinancePaymentPage(
|
||||
params: ErpFinancePaymentApi.FinancePaymentPageParams,
|
||||
) {
|
||||
return requestClient.get<PageResult<ErpFinancePaymentApi.FinancePayment>>(
|
||||
'/erp/finance-payment/page',
|
||||
{
|
||||
params,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询付款单详情
|
||||
*/
|
||||
export function getFinancePayment(id: number) {
|
||||
return requestClient.get<ErpFinancePaymentApi.FinancePayment>(
|
||||
`/erp/finance-payment/get?id=${id}`,
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增付款单
|
||||
*/
|
||||
export function createFinancePayment(
|
||||
data: ErpFinancePaymentApi.FinancePayment,
|
||||
) {
|
||||
return requestClient.post('/erp/finance-payment/create', data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改付款单
|
||||
*/
|
||||
export function updateFinancePayment(
|
||||
data: ErpFinancePaymentApi.FinancePayment,
|
||||
) {
|
||||
return requestClient.put('/erp/finance-payment/update', data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新付款单的状态
|
||||
*/
|
||||
export function updateFinancePaymentStatus(
|
||||
params: ErpFinancePaymentApi.FinancePaymentStatusParams,
|
||||
) {
|
||||
return requestClient.put('/erp/finance-payment/update-status', null, {
|
||||
params,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除付款单
|
||||
*/
|
||||
export function deleteFinancePayment(ids: number[]) {
|
||||
return requestClient.delete('/erp/finance-payment/delete', {
|
||||
params: {
|
||||
ids: ids.join(','),
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出付款单 Excel
|
||||
*/
|
||||
export function exportFinancePayment(
|
||||
params: ErpFinancePaymentApi.FinancePaymentPageParams,
|
||||
) {
|
||||
return requestClient.download('/erp/finance-payment/export-excel', {
|
||||
params,
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user