- 在多个信用模块API中新增历史数据导入功能,包括行政许可、破产重整、失信被执行人、开庭公告、终本案件等 - 为信用相关页面表格增加操作人(realName)字段显示 - 新增历史数据导入弹窗组件,支持Excel文件上传和模板下载 - 实现导入历史数据的API接口函数,支持文件和公司ID参数 - 优化信用模块页面UI布局,添加历史导入按钮和相关组件引用
154 lines
3.5 KiB
TypeScript
154 lines
3.5 KiB
TypeScript
import request from '@/utils/request';
|
|
import type { ApiResult, PageResult } from '@/api';
|
|
import type { CreditXgxf, CreditXgxfParam } from './model';
|
|
|
|
/**
|
|
* 分页查询限制高消费
|
|
*/
|
|
export async function pageCreditXgxf(params: CreditXgxfParam) {
|
|
const res = await request.get<ApiResult<PageResult<CreditXgxf>>>(
|
|
'/credit/credit-xgxf/page',
|
|
{
|
|
params
|
|
}
|
|
);
|
|
if (res.data.code === 0) {
|
|
return res.data.data;
|
|
}
|
|
return Promise.reject(new Error(res.data.message));
|
|
}
|
|
|
|
/**
|
|
* 查询限制高消费列表
|
|
*/
|
|
export async function listCreditXgxf(params?: CreditXgxfParam) {
|
|
const res = await request.get<ApiResult<CreditXgxf[]>>(
|
|
'/credit/credit-xgxf',
|
|
{
|
|
params
|
|
}
|
|
);
|
|
if (res.data.code === 0 && res.data.data) {
|
|
return res.data.data;
|
|
}
|
|
return Promise.reject(new Error(res.data.message));
|
|
}
|
|
|
|
/**
|
|
* 添加限制高消费
|
|
*/
|
|
export async function addCreditXgxf(data: CreditXgxf) {
|
|
const res = await request.post<ApiResult<unknown>>(
|
|
'/credit/credit-xgxf',
|
|
data
|
|
);
|
|
if (res.data.code === 0) {
|
|
return res.data.message;
|
|
}
|
|
return Promise.reject(new Error(res.data.message));
|
|
}
|
|
|
|
/**
|
|
* 修改限制高消费
|
|
*/
|
|
export async function updateCreditXgxf(data: CreditXgxf) {
|
|
const res = await request.put<ApiResult<unknown>>(
|
|
'/credit/credit-xgxf',
|
|
data
|
|
);
|
|
if (res.data.code === 0) {
|
|
return res.data.message;
|
|
}
|
|
return Promise.reject(new Error(res.data.message));
|
|
}
|
|
|
|
/**
|
|
* 删除限制高消费
|
|
*/
|
|
export async function removeCreditXgxf(id?: number) {
|
|
const res = await request.delete<ApiResult<unknown>>(
|
|
'/credit/credit-xgxf/' + id
|
|
);
|
|
if (res.data.code === 0) {
|
|
return res.data.message;
|
|
}
|
|
return Promise.reject(new Error(res.data.message));
|
|
}
|
|
|
|
/**
|
|
* 批量删除限制高消费
|
|
*/
|
|
export async function removeBatchCreditXgxf(data: (number | undefined)[]) {
|
|
const res = await request.delete<ApiResult<unknown>>(
|
|
'/credit/credit-xgxf/batch',
|
|
{
|
|
data
|
|
}
|
|
);
|
|
if (res.data.code === 0) {
|
|
return res.data.message;
|
|
}
|
|
return Promise.reject(new Error(res.data.message));
|
|
}
|
|
|
|
/**
|
|
* 根据id查询限制高消费
|
|
*/
|
|
export async function getCreditXgxf(id: number) {
|
|
const res = await request.get<ApiResult<CreditXgxf>>(
|
|
'/credit/credit-xgxf/' + id
|
|
);
|
|
if (res.data.code === 0 && res.data.data) {
|
|
return res.data.data;
|
|
}
|
|
return Promise.reject(new Error(res.data.message));
|
|
}
|
|
|
|
/**
|
|
* 导入限制高消费
|
|
*/
|
|
export async function importCreditXgxf(file: File, companyId?: number) {
|
|
const formData = new FormData();
|
|
formData.append('file', file);
|
|
if (companyId != null) {
|
|
formData.append('companyId', String(companyId));
|
|
}
|
|
const res = await request.post<ApiResult<unknown>>(
|
|
'/credit/credit-xgxf/import',
|
|
formData,
|
|
{
|
|
headers: {
|
|
'Content-Type': 'multipart/form-data'
|
|
}
|
|
}
|
|
);
|
|
if (res.data.code === 0) {
|
|
return res.data.message;
|
|
}
|
|
return Promise.reject(new Error(res.data.message));
|
|
}
|
|
|
|
/**
|
|
* 导入历史限制高消费
|
|
*/
|
|
export async function importCreditXgxfHistory(file: File, companyId?: number) {
|
|
const formData = new FormData();
|
|
formData.append('file', file);
|
|
if (companyId != null) {
|
|
formData.append('companyId', String(companyId));
|
|
}
|
|
const res = await request.post<ApiResult<unknown>>(
|
|
'/credit/credit-xgxf/import/history',
|
|
formData,
|
|
{
|
|
headers: {
|
|
'Content-Type': 'multipart/form-data'
|
|
}
|
|
}
|
|
);
|
|
if (res.data.code === 0) {
|
|
return res.data.message;
|
|
}
|
|
return Promise.reject(new Error(res.data.message));
|
|
}
|