feat(credit): 添加客户管理模块
- 新增客户数据模型定义 - 实现客户分页查询、列表查询、新增、修改、删除等API接口 - 创建客户管理页面,包含表格展示、编辑弹窗、搜索功能 - 添加客户编辑表单,支持客户信息的录入与修改 - 实现客户数据的状态管理与操作功能 - 优化开庭公告等模块的字段命名与代码结构 - 统一导入导出功能组件的使用方式 - 修复被告/被上诉人字段绑定错误的问题
This commit is contained in:
105
src/api/credit/creditCustomer/index.ts
Normal file
105
src/api/credit/creditCustomer/index.ts
Normal file
@@ -0,0 +1,105 @@
|
||||
import request from '@/utils/request';
|
||||
import type { ApiResult, PageResult } from '@/api';
|
||||
import type { CreditCustomer, CreditCustomerParam } from './model';
|
||||
|
||||
/**
|
||||
* 分页查询客户
|
||||
*/
|
||||
export async function pageCreditCustomer(params: CreditCustomerParam) {
|
||||
const res = await request.get<ApiResult<PageResult<CreditCustomer>>>(
|
||||
'/credit/credit-customer/page',
|
||||
{
|
||||
params
|
||||
}
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询客户列表
|
||||
*/
|
||||
export async function listCreditCustomer(params?: CreditCustomerParam) {
|
||||
const res = await request.get<ApiResult<CreditCustomer[]>>(
|
||||
'/credit/credit-customer',
|
||||
{
|
||||
params
|
||||
}
|
||||
);
|
||||
if (res.data.code === 0 && res.data.data) {
|
||||
return res.data.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加客户
|
||||
*/
|
||||
export async function addCreditCustomer(data: CreditCustomer) {
|
||||
const res = await request.post<ApiResult<unknown>>(
|
||||
'/credit/credit-customer',
|
||||
data
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改客户
|
||||
*/
|
||||
export async function updateCreditCustomer(data: CreditCustomer) {
|
||||
const res = await request.put<ApiResult<unknown>>(
|
||||
'/credit/credit-customer',
|
||||
data
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除客户
|
||||
*/
|
||||
export async function removeCreditCustomer(id?: number) {
|
||||
const res = await request.delete<ApiResult<unknown>>(
|
||||
'/credit/credit-customer/' + id
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除客户
|
||||
*/
|
||||
export async function removeBatchCreditCustomer(data: (number | undefined)[]) {
|
||||
const res = await request.delete<ApiResult<unknown>>(
|
||||
'/credit/credit-customer/batch',
|
||||
{
|
||||
data
|
||||
}
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据id查询客户
|
||||
*/
|
||||
export async function getCreditCustomer(id: number) {
|
||||
const res = await request.get<ApiResult<CreditCustomer>>(
|
||||
'/credit/credit-customer/' + id
|
||||
);
|
||||
if (res.data.code === 0 && res.data.data) {
|
||||
return res.data.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
Reference in New Issue
Block a user