Files
hzdyjs/web/src/api/xg-xx-bak/collectionBatch.ts
T

284 lines
5.7 KiB
TypeScript

import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { CollectionBatchVO, CollectionBatchForm, CollectionBatchQuery } from './types';
/**
* 查询信息采集批次列表
*/
export const listCollectionBatch = (query?: CollectionBatchQuery): AxiosPromise<CollectionBatchVO[]> => {
return request({
url: '/xg/collectionBatch/list',
method: 'get',
params: query
});
};
/**
* 查询信息采集批次详细
*/
export const getCollectionBatch = (id: string | number): AxiosPromise<CollectionBatchVO> => {
return request({
url: `/xg/collectionBatch/${id}`,
method: 'get'
});
};
/**
* 根据批次编码查询批次信息
*/
export const getCollectionBatchByCode = (batchCode: string): AxiosPromise<CollectionBatchVO> => {
return request({
url: `/xg/collectionBatch/code/${batchCode}`,
method: 'get'
});
};
/**
* 新增信息采集批次
*/
export const addCollectionBatch = (data: CollectionBatchForm) => {
return request({
url: '/xg/collectionBatch',
method: 'post',
data: data
});
};
/**
* 修改信息采集批次
*/
export const updateCollectionBatch = (data: CollectionBatchForm) => {
return request({
url: '/xg/collectionBatch',
method: 'put',
data: data
});
};
/**
* 删除信息采集批次
*/
export const delCollectionBatch = (ids: string | number | Array<string | number>) => {
return request({
url: `/xg/collectionBatch/${ids}`,
method: 'delete'
});
};
/**
* 导出信息采集批次
*/
export const exportCollectionBatch = (query?: CollectionBatchQuery) => {
return request({
url: '/xg/collectionBatch/export',
method: 'post',
data: query
});
};
/**
* 查询用户权限内的批次列表
*/
export const getUserPermissionBatches = (): AxiosPromise<CollectionBatchVO[]> => {
return request({
url: '/xg/collectionBatch/userPermission',
method: 'get'
});
};
/**
* 查询活跃的批次列表
*/
export const getActiveBatches = (): AxiosPromise<CollectionBatchVO[]> => {
return request({
url: '/xg/collectionBatch/active',
method: 'get'
});
};
/**
* 查询即将开始的批次列表
*/
export const getUpcomingBatches = (): AxiosPromise<CollectionBatchVO[]> => {
return request({
url: '/xg/collectionBatch/upcoming',
method: 'get'
});
};
/**
* 查询即将结束的批次列表
*/
export const getEndingSoonBatches = (): AxiosPromise<CollectionBatchVO[]> => {
return request({
url: '/xg/collectionBatch/endingSoon',
method: 'get'
});
};
/**
* 开始批次
*/
export const startBatch = (batchId: string | number) => {
return request({
url: `/xg/collectionBatch/start/${batchId}`,
method: 'post'
});
};
/**
* 暂停批次
*/
export const pauseBatch = (batchId: string | number) => {
return request({
url: `/xg/collectionBatch/pause/${batchId}`,
method: 'post'
});
};
/**
* 恢复批次
*/
export const resumeBatch = (batchId: string | number) => {
return request({
url: `/xg/collectionBatch/resume/${batchId}`,
method: 'post'
});
};
/**
* 结束批次
*/
export const endBatch = (batchId: string | number) => {
return request({
url: `/xg/collectionBatch/end/${batchId}`,
method: 'post'
});
};
/**
* 复制批次
*/
export const copyBatch = (batchId: string | number, newBatchCode: string, newBatchName: string) => {
return request({
url: `/xg/collectionBatch/copy/${batchId}`,
method: 'post',
data: {
newBatchCode,
newBatchName
}
});
};
/**
* 获取批次统计信息
*/
export const getBatchStatistics = (batchId: string | number) => {
return request({
url: `/xg/collectionBatch/statistics/${batchId}`,
method: 'get'
});
};
/**
* 获取整体统计信息
*/
export const getOverallStatistics = () => {
return request({
url: '/xg/collectionBatch/statistics/overall',
method: 'get'
});
};
/**
* 获取批次完成度统计
*/
export const getBatchCompletionStatistics = (batchId: string | number) => {
return request({
url: `/xg/collectionBatch/statistics/completion/${batchId}`,
method: 'get'
});
};
/**
* 获取批次多维度统计
*/
export const getBatchDimensionStatistics = (batchId: string | number, dimension: string) => {
return request({
url: `/xg/collectionBatch/statistics/dimension/${batchId}`,
method: 'get',
params: { dimension }
});
};
/**
* 批量更新批次状态
*/
export const batchUpdateStatus = (batchIds: Array<string | number>, status: string) => {
return request({
url: '/xg/collectionBatch/batchUpdateStatus',
method: 'post',
data: {
batchIds,
status
}
});
};
/**
* 检查批次是否可编辑
*/
export const checkBatchEditable = (batchId: string | number) => {
return request({
url: `/xg/collectionBatch/checkEditable/${batchId}`,
method: 'get'
});
};
/**
* 检查批次是否可删除
*/
export const checkBatchDeletable = (batchId: string | number) => {
return request({
url: `/xg/collectionBatch/checkDeletable/${batchId}`,
method: 'get'
});
};
/**
* 获取可用批次选项
*/
export const getAvailableBatches = () => {
return request({
url: '/xg/collectionBatch/available',
method: 'get'
});
};
/**
* 导入批次数据
*/
export const importBatchData = (file: File) => {
const formData = new FormData();
formData.append('file', file);
return request({
url: '/xg/collectionBatch/import',
method: 'post',
data: formData,
headers: {
'Content-Type': 'multipart/form-data'
}
});
};
/**
* 下载批次数据导入模板
*/
export const downloadBatchTemplate = () => {
return request({
url: '/xg/collectionBatch/importTemplate',
method: 'post',
responseType: 'blob'
});
};