Initial commit
This commit is contained in:
@@ -0,0 +1,102 @@
|
||||
import request from '@/utils/request';
|
||||
import type { ApiResult, PageResult } from '@/api';
|
||||
import type { Project, ProjectParam } from '@/api/tower/project/model';
|
||||
/**
|
||||
* 分页查询仓库
|
||||
*/
|
||||
export async function pageProject(params: ProjectParam) {
|
||||
const res = await request.get<ApiResult<PageResult<Project>>>(
|
||||
'/tower/tower-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[]>>('/tower/tower-project', {
|
||||
params
|
||||
});
|
||||
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>>(
|
||||
'/tower/tower-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>>(
|
||||
'/tower/tower-project',
|
||||
data
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 绑定仓库
|
||||
*/
|
||||
export async function bindProject(data: Project) {
|
||||
const res = await request.put<ApiResult<unknown>>(
|
||||
'/tower/tower-project/bind',
|
||||
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>>(
|
||||
'/tower/tower-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>>(
|
||||
'/tower/tower-project/batch',
|
||||
{
|
||||
data
|
||||
}
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
import type { PageParam } from '@/api';
|
||||
|
||||
export interface Project {
|
||||
projectId?: number;
|
||||
projectName?: string;
|
||||
companyName?: string;
|
||||
customerName?: string;
|
||||
projectRegion?: string;
|
||||
projectAddress?: string;
|
||||
longitude?: string;
|
||||
latitude?: string;
|
||||
superviseNo?: string;
|
||||
licenceNo?: string;
|
||||
securityStatus?: string;
|
||||
competentDepartment?: string;
|
||||
dismantlingCompany?: string;
|
||||
truckCraneSpecs?: string;
|
||||
contract?: string;
|
||||
director?: string;
|
||||
projectDirector?: string;
|
||||
projectStatus?: string;
|
||||
salesman?: string;
|
||||
status?: number;
|
||||
userId?: number;
|
||||
comments?: string;
|
||||
sortNumber?: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* 搜索条件
|
||||
*/
|
||||
export interface ProjectParam extends PageParam {
|
||||
projectId?: number;
|
||||
projectName?: string;
|
||||
status?: number;
|
||||
keywords?: string;
|
||||
}
|
||||
Reference in New Issue
Block a user