107 lines
2.6 KiB
TypeScript
107 lines
2.6 KiB
TypeScript
import request from '@/utils/request';
|
|
import type { ApiResult, PageResult } from '@/api';
|
|
import type { LawLegalMediate, LawLegalMediateParam } from './model';
|
|
import { MODULES_API_URL } from '@/config/setting';
|
|
|
|
/**
|
|
* 分页查询调解申请
|
|
*/
|
|
export async function pageLawLegalMediate(params: LawLegalMediateParam) {
|
|
const res = await request.get<ApiResult<PageResult<LawLegalMediate>>>(
|
|
MODULES_API_URL + '/law/law-legal-mediate/page',
|
|
{
|
|
params
|
|
}
|
|
);
|
|
if (res.data.code === 0) {
|
|
return res.data.data;
|
|
}
|
|
return Promise.reject(new Error(res.data.message));
|
|
}
|
|
|
|
/**
|
|
* 查询调解申请列表
|
|
*/
|
|
export async function listLawLegalMediate(params?: LawLegalMediateParam) {
|
|
const res = await request.get<ApiResult<LawLegalMediate[]>>(
|
|
MODULES_API_URL + '/law/law-legal-mediate',
|
|
{
|
|
params
|
|
}
|
|
);
|
|
if (res.data.code === 0 && res.data.data) {
|
|
return res.data.data;
|
|
}
|
|
return Promise.reject(new Error(res.data.message));
|
|
}
|
|
|
|
/**
|
|
* 添加调解申请
|
|
*/
|
|
export async function addLawLegalMediate(data: LawLegalMediate) {
|
|
const res = await request.post<ApiResult<unknown>>(
|
|
MODULES_API_URL + '/law/law-legal-mediate',
|
|
data
|
|
);
|
|
if (res.data.code === 0) {
|
|
return res.data.message;
|
|
}
|
|
return Promise.reject(new Error(res.data.message));
|
|
}
|
|
|
|
/**
|
|
* 修改调解申请
|
|
*/
|
|
export async function updateLawLegalMediate(data: LawLegalMediate) {
|
|
const res = await request.put<ApiResult<unknown>>(
|
|
MODULES_API_URL + '/law/law-legal-mediate',
|
|
data
|
|
);
|
|
if (res.data.code === 0) {
|
|
return res.data.message;
|
|
}
|
|
return Promise.reject(new Error(res.data.message));
|
|
}
|
|
|
|
/**
|
|
* 删除调解申请
|
|
*/
|
|
export async function removeLawLegalMediate(id?: number) {
|
|
const res = await request.delete<ApiResult<unknown>>(
|
|
MODULES_API_URL + '/law/law-legal-mediate/' + id
|
|
);
|
|
if (res.data.code === 0) {
|
|
return res.data.message;
|
|
}
|
|
return Promise.reject(new Error(res.data.message));
|
|
}
|
|
|
|
/**
|
|
* 批量删除调解申请
|
|
*/
|
|
export async function removeBatchLawLegalMediate(data: (number | undefined)[]) {
|
|
const res = await request.delete<ApiResult<unknown>>(
|
|
MODULES_API_URL + '/law/law-legal-mediate/batch',
|
|
{
|
|
data
|
|
}
|
|
);
|
|
if (res.data.code === 0) {
|
|
return res.data.message;
|
|
}
|
|
return Promise.reject(new Error(res.data.message));
|
|
}
|
|
|
|
/**
|
|
* 根据id查询调解申请
|
|
*/
|
|
export async function getLawLegalMediate(id: number) {
|
|
const res = await request.get<ApiResult<LawLegalMediate>>(
|
|
MODULES_API_URL + '/law/law-legal-mediate/' + id
|
|
);
|
|
if (res.data.code === 0 && res.data.data) {
|
|
return res.data.data;
|
|
}
|
|
return Promise.reject(new Error(res.data.message));
|
|
}
|