Initial commit
This commit is contained in:
107
src/api/apps/bc/export/index.ts
Normal file
107
src/api/apps/bc/export/index.ts
Normal file
@@ -0,0 +1,107 @@
|
||||
import request from '@/utils/request';
|
||||
import type { ApiResult, PageResult } from '@/api';
|
||||
import type { BcExport, BcExportParam } from '@/api/apps/bc/export/model';
|
||||
import { OPEN_API_URL } from '@/config/setting';
|
||||
|
||||
/**
|
||||
* 分页查询计划
|
||||
*/
|
||||
export async function pageBcExport(params: BcExportParam) {
|
||||
const res = await request.get<ApiResult<PageResult<BcExport>>>(
|
||||
OPEN_API_URL + '/apps/bc-export/page',
|
||||
{
|
||||
params
|
||||
}
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询计划列表
|
||||
*/
|
||||
export async function listBcExport(params?: BcExportParam) {
|
||||
const res = await request.get<ApiResult<BcExport[]>>(
|
||||
OPEN_API_URL + '/apps/bc-export',
|
||||
{
|
||||
params
|
||||
}
|
||||
);
|
||||
if (res.data.code === 0 && res.data.data) {
|
||||
return res.data.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加计划
|
||||
*/
|
||||
export async function addBcExport(data: BcExport) {
|
||||
const res = await request.post<ApiResult<unknown>>(
|
||||
OPEN_API_URL + '/apps/bc-export',
|
||||
data
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改计划
|
||||
*/
|
||||
export async function updateBcExport(data: BcExport) {
|
||||
const res = await request.put<ApiResult<unknown>>(
|
||||
OPEN_API_URL + '/apps/bc-export',
|
||||
data
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 绑定计划
|
||||
*/
|
||||
export async function bindBcExport(data: BcExport) {
|
||||
const res = await request.put<ApiResult<unknown>>(
|
||||
OPEN_API_URL + '/apps/bc-export/bind',
|
||||
data
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除计划
|
||||
*/
|
||||
export async function removeBcExport(id?: number) {
|
||||
const res = await request.delete<ApiResult<unknown>>(
|
||||
OPEN_API_URL + '/apps/bc-export/' + id
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除计划
|
||||
*/
|
||||
export async function removeBatchBcExport(data: (number | undefined)[]) {
|
||||
const res = await request.delete<ApiResult<unknown>>(
|
||||
OPEN_API_URL + '/apps/bc-export/batch',
|
||||
{
|
||||
data
|
||||
}
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
Reference in New Issue
Block a user