新增:每月1日自动生成保养计划
This commit is contained in:
108
src/api/tower/security-record/index.ts
Normal file
108
src/api/tower/security-record/index.ts
Normal file
@@ -0,0 +1,108 @@
|
||||
import request from '@/utils/request';
|
||||
import type { ApiResult, PageResult } from '@/api';
|
||||
import type {
|
||||
SecurityRecord,
|
||||
SecurityRecordParam
|
||||
} from '@/api/tower/security-record/model';
|
||||
/**
|
||||
* 分页查询仓库
|
||||
*/
|
||||
export async function pageSecurityRecord(params: SecurityRecordParam) {
|
||||
const res = await request.get<ApiResult<PageResult<SecurityRecord>>>(
|
||||
'/tower/tower-security-record/page',
|
||||
{
|
||||
params
|
||||
}
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询仓库列表
|
||||
*/
|
||||
export async function listSecurityRecord(params?: SecurityRecordParam) {
|
||||
const res = await request.get<ApiResult<SecurityRecord[]>>(
|
||||
'/tower/tower-security-record',
|
||||
{
|
||||
params
|
||||
}
|
||||
);
|
||||
if (res.data.code === 0 && res.data.data) {
|
||||
return res.data.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加仓库
|
||||
*/
|
||||
export async function addSecurityRecord(data: SecurityRecord) {
|
||||
const res = await request.post<ApiResult<unknown>>(
|
||||
'/tower/tower-security-record',
|
||||
data
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改仓库
|
||||
*/
|
||||
export async function updateSecurityRecord(data: SecurityRecord) {
|
||||
const res = await request.put<ApiResult<unknown>>(
|
||||
'/tower/tower-security-record',
|
||||
data
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 绑定仓库
|
||||
*/
|
||||
export async function bindSecurityRecord(data: SecurityRecord) {
|
||||
const res = await request.put<ApiResult<unknown>>(
|
||||
'/tower/tower-security-record/bind',
|
||||
data
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除仓库
|
||||
*/
|
||||
export async function removeSecurityRecord(id?: number) {
|
||||
const res = await request.delete<ApiResult<unknown>>(
|
||||
'/tower/tower-security-record/' + id
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除仓库
|
||||
*/
|
||||
export async function removeBatchSecurityRecord(data: (number | undefined)[]) {
|
||||
const res = await request.delete<ApiResult<unknown>>(
|
||||
'/tower/tower-security-record/batch',
|
||||
{
|
||||
data
|
||||
}
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
31
src/api/tower/security-record/model/index.ts
Normal file
31
src/api/tower/security-record/model/index.ts
Normal file
@@ -0,0 +1,31 @@
|
||||
import type { PageParam } from '@/api';
|
||||
|
||||
export interface SecurityRecord {
|
||||
securityRecordId?: number;
|
||||
projectName?: string;
|
||||
projectId?: number;
|
||||
securityCode?: string;
|
||||
regionName?: string;
|
||||
longitude?: string;
|
||||
latitude?: string;
|
||||
country?: string;
|
||||
province?: string;
|
||||
city?: string;
|
||||
region?: string;
|
||||
address?: string;
|
||||
status?: number;
|
||||
userId?: number;
|
||||
comments?: string;
|
||||
sortNumber?: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* 搜索条件
|
||||
*/
|
||||
export interface SecurityRecordParam extends PageParam {
|
||||
securityId?: number;
|
||||
projectId?: number;
|
||||
projectName?: string;
|
||||
status?: number;
|
||||
keywords?: string;
|
||||
}
|
||||
105
src/api/tower/security/index.ts
Normal file
105
src/api/tower/security/index.ts
Normal file
@@ -0,0 +1,105 @@
|
||||
import request from '@/utils/request';
|
||||
import type { ApiResult, PageResult } from '@/api';
|
||||
import type { Security, SecurityParam } from '@/api/tower/security/model';
|
||||
/**
|
||||
* 分页查询仓库
|
||||
*/
|
||||
export async function pageSecurity(params: SecurityParam) {
|
||||
const res = await request.get<ApiResult<PageResult<Security>>>(
|
||||
'/tower/tower-security/page',
|
||||
{
|
||||
params
|
||||
}
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询仓库列表
|
||||
*/
|
||||
export async function listSecurity(params?: SecurityParam) {
|
||||
const res = await request.get<ApiResult<Security[]>>(
|
||||
'/tower/tower-security',
|
||||
{
|
||||
params
|
||||
}
|
||||
);
|
||||
if (res.data.code === 0 && res.data.data) {
|
||||
return res.data.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加仓库
|
||||
*/
|
||||
export async function addSecurity(data: Security) {
|
||||
const res = await request.post<ApiResult<unknown>>(
|
||||
'/tower/tower-security',
|
||||
data
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改仓库
|
||||
*/
|
||||
export async function updateSecurity(data: Security) {
|
||||
const res = await request.put<ApiResult<unknown>>(
|
||||
'/tower/tower-security',
|
||||
data
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 绑定仓库
|
||||
*/
|
||||
export async function bindSecurity(data: Security) {
|
||||
const res = await request.put<ApiResult<unknown>>(
|
||||
'/tower/tower-security/bind',
|
||||
data
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除仓库
|
||||
*/
|
||||
export async function removeSecurity(id?: number) {
|
||||
const res = await request.delete<ApiResult<unknown>>(
|
||||
'/tower/tower-security/' + id
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除仓库
|
||||
*/
|
||||
export async function removeBatchSecurity(data: (number | undefined)[]) {
|
||||
const res = await request.delete<ApiResult<unknown>>(
|
||||
'/tower/tower-security/batch',
|
||||
{
|
||||
data
|
||||
}
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
31
src/api/tower/security/model/index.ts
Normal file
31
src/api/tower/security/model/index.ts
Normal file
@@ -0,0 +1,31 @@
|
||||
import type { PageParam } from '@/api';
|
||||
|
||||
export interface Security {
|
||||
securityId?: number;
|
||||
projectName?: string;
|
||||
projectId?: number;
|
||||
securityCode?: string;
|
||||
regionName?: string;
|
||||
longitude?: string;
|
||||
latitude?: string;
|
||||
country?: string;
|
||||
province?: string;
|
||||
city?: string;
|
||||
region?: string;
|
||||
address?: string;
|
||||
status?: number;
|
||||
userId?: number;
|
||||
comments?: string;
|
||||
sortNumber?: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* 搜索条件
|
||||
*/
|
||||
export interface SecurityParam extends PageParam {
|
||||
securityId?: number;
|
||||
projectId?: number;
|
||||
projectName?: string;
|
||||
status?: number;
|
||||
keywords?: string;
|
||||
}
|
||||
Reference in New Issue
Block a user