forked from b2894lxlx/tuanwei-admin
260720
This commit is contained in:
@@ -0,0 +1,88 @@
|
||||
import request from '@/utils/request';
|
||||
import type { ApiResult, PageResult } from '@/api';
|
||||
import type { FileRecord } from '@/api/system/file/model';
|
||||
import type {
|
||||
TzbcyMaterial,
|
||||
TzbcyMaterialAuditParam,
|
||||
TzbcyMaterialParam
|
||||
} from './model';
|
||||
|
||||
export async function pageTzbcyMaterial(params: TzbcyMaterialParam) {
|
||||
const res = await request.get<ApiResult<PageResult<TzbcyMaterial>>>(
|
||||
'/gxmu/tzbcy-material/page',
|
||||
{
|
||||
params: { ...params, backendAccess: true }
|
||||
}
|
||||
);
|
||||
if (res.data.code === 0 && res.data.data) {
|
||||
return res.data.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
export async function listTzbcyMaterial(params?: TzbcyMaterialParam) {
|
||||
const res = await request.get<ApiResult<TzbcyMaterial[]>>(
|
||||
'/gxmu/tzbcy-material',
|
||||
{
|
||||
params: { ...params, backendAccess: true }
|
||||
}
|
||||
);
|
||||
if (res.data.code === 0 && res.data.data) {
|
||||
return res.data.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
export async function addTzbcyMaterial(data: TzbcyMaterial) {
|
||||
const res = await request.post<ApiResult<unknown>>(
|
||||
'/gxmu/tzbcy-material',
|
||||
data
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
export async function updateTzbcyMaterial(data: TzbcyMaterial) {
|
||||
const res = await request.put<ApiResult<unknown>>(
|
||||
'/gxmu/tzbcy-material',
|
||||
data
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
export async function auditTzbcyMaterial(data: TzbcyMaterialAuditParam) {
|
||||
const res = await request.put<ApiResult<unknown>>(
|
||||
'/gxmu/tzbcy-material/audit',
|
||||
data
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
export async function removeTzbcyMaterial(id?: number) {
|
||||
const res = await request.delete<ApiResult<unknown>>(
|
||||
'/gxmu/tzbcy-material/' + id
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
export async function exportTzbcyMaterial(params?: TzbcyMaterialParam) {
|
||||
const res = await request.post<ApiResult<FileRecord>>(
|
||||
'/gxmu/tzbcy-material/export',
|
||||
{ ...params, backendAccess: true }
|
||||
);
|
||||
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