108 lines
2.4 KiB
TypeScript
108 lines
2.4 KiB
TypeScript
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));
|
|
}
|