Initial commit
This commit is contained in:
106
src/api/oa/project/index.ts
Normal file
106
src/api/oa/project/index.ts
Normal file
@@ -0,0 +1,106 @@
|
||||
import request from '@/utils/request';
|
||||
import type { ApiResult, PageResult } from '@/api';
|
||||
import type { Project, ProjectParam } from './model';
|
||||
|
||||
/**
|
||||
* 分页查询项目
|
||||
*/
|
||||
export async function pageProject(params: ProjectParam) {
|
||||
const res = await request.get<ApiResult<PageResult<Project>>>(
|
||||
'/oa/project/page',
|
||||
{
|
||||
params
|
||||
}
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询项目列表
|
||||
*/
|
||||
export async function listProject(params?: ProjectParam) {
|
||||
const res = await request.get<ApiResult<Project[]>>('/oa/project', {
|
||||
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 getProject(id: number) {
|
||||
const res = await request.get<ApiResult<Project>>('/oa/project/' + id);
|
||||
if (res.data.code === 0 && res.data.data) {
|
||||
return res.data.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加项目
|
||||
*/
|
||||
export async function addProject(data: Project) {
|
||||
const res = await request.post<ApiResult<unknown>>('/oa/project', data);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改项目
|
||||
*/
|
||||
export async function updateProject(data: Project) {
|
||||
const res = await request.put<ApiResult<unknown>>('/oa/project', data);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除项目
|
||||
*/
|
||||
export async function removeProject(id?: number) {
|
||||
const res = await request.delete<ApiResult<unknown>>('/oa/project/' + id);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除项目
|
||||
*/
|
||||
export async function removeBatchProject(data: (number | undefined)[]) {
|
||||
const res = await request.delete<ApiResult<unknown>>('/oa/project/batch', {
|
||||
data
|
||||
});
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查IP是否存在
|
||||
*/
|
||||
export async function checkExistence(
|
||||
field: string,
|
||||
value: string,
|
||||
id?: number
|
||||
) {
|
||||
const res = await request.get<ApiResult<unknown>>('/oa/project/existence', {
|
||||
params: { field, value, id }
|
||||
});
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
56
src/api/oa/project/model/index.ts
Normal file
56
src/api/oa/project/model/index.ts
Normal file
@@ -0,0 +1,56 @@
|
||||
import type { PageParam } from '@/api';
|
||||
|
||||
/**
|
||||
* 项目
|
||||
*/
|
||||
export interface Project {
|
||||
// 项目id
|
||||
projectId?: number;
|
||||
// 项目类型
|
||||
projectType?: string;
|
||||
// 项目分类
|
||||
projectCategory?: string;
|
||||
// 项目标识
|
||||
projectCode: string;
|
||||
// 项目名称
|
||||
projectName?: string;
|
||||
// 项目图标
|
||||
projectAvatar?: string;
|
||||
url?: string;
|
||||
urlDev?: string;
|
||||
urlAdmin?: string;
|
||||
account?: string;
|
||||
money?: string;
|
||||
realMoney?: string;
|
||||
annualFee?: string;
|
||||
qrcode?: string;
|
||||
progress?: string;
|
||||
views?: string;
|
||||
// 项目详情
|
||||
content?: string;
|
||||
// 客户ID
|
||||
customerId?: number;
|
||||
// 客户名称
|
||||
customerName?: string;
|
||||
// 排序
|
||||
sortNumber?: number;
|
||||
// 备注
|
||||
comments?: string;
|
||||
// 创建时间
|
||||
createTime?: string;
|
||||
// 状态
|
||||
status?: string;
|
||||
// 用户ID
|
||||
userId?: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* 项目搜索条件
|
||||
*/
|
||||
export interface ProjectParam extends PageParam {
|
||||
projectName?: string;
|
||||
projectCode?: string;
|
||||
status?: string;
|
||||
// 商户编号
|
||||
merchantCode?: string;
|
||||
}
|
||||
Reference in New Issue
Block a user