You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
100 lines
2.5 KiB
100 lines
2.5 KiB
import request from '@/utils/request';
|
|
import type { ApiResult, PageResult } from '@/api';
|
|
import type { TaskCount, TaskCountParam } from './model/index';
|
|
import { TabsParam } from '@/api/tabs';
|
|
|
|
/**
|
|
* 分页查询统计
|
|
*/
|
|
export async function pageTaskCount(params: TaskCountParam) {
|
|
const res = await request.get<ApiResult<PageResult<TaskCount>>>(
|
|
'/oa/task-count/page',
|
|
{
|
|
params
|
|
}
|
|
);
|
|
if (res.data.code === 0) {
|
|
return res.data.data;
|
|
}
|
|
return Promise.reject(new Error(res.data.message));
|
|
}
|
|
|
|
/**
|
|
* 查询统计列表
|
|
*/
|
|
export async function listTaskCount(params?: TaskCountParam) {
|
|
const res = await request.get<ApiResult<TaskCount[]>>('/oa/task-count', {
|
|
params
|
|
});
|
|
if (res.data.code === 0 && res.data.data) {
|
|
return res.data.data;
|
|
}
|
|
return Promise.reject(new Error(res.data.message));
|
|
}
|
|
|
|
/**
|
|
* 根据id查询统计
|
|
*/
|
|
export async function getTaskCount(id: number) {
|
|
const res = await request.get<ApiResult<TaskCount>>('/oa/task-count/' + id);
|
|
if (res.data.code === 0 && res.data.data) {
|
|
return res.data.data;
|
|
}
|
|
return Promise.reject(new Error(res.data.message));
|
|
}
|
|
|
|
/**
|
|
* 添加统计
|
|
*/
|
|
export async function addTaskCount(data: TaskCount) {
|
|
const res = await request.post<ApiResult<unknown>>('/oa/task-count', data);
|
|
if (res.data.code === 0) {
|
|
return res.data.message;
|
|
}
|
|
return Promise.reject(new Error(res.data.message));
|
|
}
|
|
|
|
/**
|
|
* 修改统计
|
|
*/
|
|
export async function updateTaskCount(data: TaskCount) {
|
|
const res = await request.put<ApiResult<unknown>>('/oa/task-count', data);
|
|
if (res.data.code === 0) {
|
|
return res.data.message;
|
|
}
|
|
return Promise.reject(new Error(res.data.message));
|
|
}
|
|
|
|
/**
|
|
* 删除统计
|
|
*/
|
|
export async function removeTaskCount(id?: number) {
|
|
const res = await request.delete<ApiResult<unknown>>('/oa/task-count/' + id);
|
|
if (res.data.code === 0) {
|
|
return res.data.message;
|
|
}
|
|
return Promise.reject(new Error(res.data.message));
|
|
}
|
|
|
|
/**
|
|
* 批量删除统计
|
|
*/
|
|
export async function removeBatchTaskCount(data: (number | undefined)[]) {
|
|
const res = await request.delete<ApiResult<unknown>>('/oa/task-count/batch', {
|
|
data
|
|
});
|
|
if (res.data.code === 0) {
|
|
return res.data.message;
|
|
}
|
|
return Promise.reject(new Error(res.data.message));
|
|
}
|
|
|
|
export async function getCount(params?: TabsParam) {
|
|
const res = await request.get<ApiResult<TabsParam>>('/oa/task-count/count', {
|
|
params
|
|
});
|
|
if (res.data.code === 0 && res.data.data) {
|
|
return res.data.data;
|
|
}
|
|
return Promise.reject(new Error(res.data.message));
|
|
}
|