调整
This commit is contained in:
129
src/api/tower/lending/index.ts
Normal file
129
src/api/tower/lending/index.ts
Normal file
@@ -0,0 +1,129 @@
|
||||
import request from '@/utils/request';
|
||||
import type {ApiResult, PageResult} from '@/api';
|
||||
import type {Lending, LendingParam} from './model';
|
||||
|
||||
/**
|
||||
* 分页查询结算
|
||||
*/
|
||||
export async function pageLending(params: LendingParam) {
|
||||
const res = await request.get<ApiResult<PageResult<Lending>>>(
|
||||
'/tower/tower-lending/page',
|
||||
{
|
||||
params
|
||||
}
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询合同列表
|
||||
*/
|
||||
export async function listLending(params?: LendingParam) {
|
||||
const res = await request.get<ApiResult<Lending[]>>(
|
||||
'/tower/tower-lending',
|
||||
{
|
||||
params
|
||||
}
|
||||
);
|
||||
if (res.data.code === 0 && res.data.data) {
|
||||
return res.data.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据id查询合同
|
||||
*/
|
||||
export async function getLending(id: number) {
|
||||
const res = await request.get<ApiResult<Lending>>(
|
||||
'/tower/tower-lending/' + id
|
||||
);
|
||||
if (res.data.code === 0 && res.data.data) {
|
||||
return res.data.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加合同
|
||||
*/
|
||||
export async function addLending(data: Lending) {
|
||||
const res = await request.post<ApiResult<unknown>>(
|
||||
'/tower/tower-lending',
|
||||
data
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改合同
|
||||
*/
|
||||
export async function updateLending(data: Lending) {
|
||||
const res = await request.put<ApiResult<unknown>>(
|
||||
'/tower/tower-lending',
|
||||
data
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量修改合同
|
||||
*/
|
||||
export async function updateBatchLending(data: Lending[]) {
|
||||
const res = await request.put<ApiResult<unknown>>(
|
||||
'/tower/tower-lending/batch',
|
||||
data
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
export async function addBatchLending(data: Lending[]) {
|
||||
const res = await request.post<ApiResult<unknown>>(
|
||||
'/tower/tower-lending/batch',
|
||||
data
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除合同
|
||||
*/
|
||||
export async function removeLending(id?: number) {
|
||||
const res = await request.delete<ApiResult<unknown>>(
|
||||
'/tower/tower-lending/' + id
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除合同
|
||||
*/
|
||||
export async function removeBatchLending(data: (number | undefined)[]) {
|
||||
const res = await request.delete<ApiResult<unknown>>(
|
||||
'/tower/tower-lending/batch',
|
||||
{
|
||||
data
|
||||
}
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
28
src/api/tower/lending/model/index.ts
Normal file
28
src/api/tower/lending/model/index.ts
Normal file
@@ -0,0 +1,28 @@
|
||||
import type { PageParam } from '@/api';
|
||||
|
||||
/**
|
||||
* 合同
|
||||
*/
|
||||
export interface Lending {
|
||||
lendingId?: any;
|
||||
contractId?: any;
|
||||
contactNumber?: any;
|
||||
signDate?: any;
|
||||
projectName?: any;
|
||||
customerName?: any;
|
||||
companyName?: any;
|
||||
propertyCompany?: any;
|
||||
settleDate?: any;
|
||||
settleAmount?: any;
|
||||
fileList?: any;
|
||||
remark?: any;
|
||||
userId?: any;
|
||||
}
|
||||
|
||||
/**
|
||||
* 合同搜索条件
|
||||
*/
|
||||
export interface LendingParam extends PageParam {
|
||||
projectName?: string;
|
||||
contractNo?: string;
|
||||
}
|
||||
Reference in New Issue
Block a user