初始化
This commit is contained in:
@@ -0,0 +1,100 @@
|
||||
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));
|
||||
}
|
||||
Reference in New Issue
Block a user