优化网站导航模块
This commit is contained in:
106
src/api/think/thinkGate/index.ts
Normal file
106
src/api/think/thinkGate/index.ts
Normal file
@@ -0,0 +1,106 @@
|
||||
import request from '@/utils/request';
|
||||
import type { ApiResult, PageResult } from '@/api';
|
||||
import type { ThinkGate, ThinkGateParam } from './model';
|
||||
import { THINK_API_URL } from '@/config/setting';
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*/
|
||||
export async function pageThinkGate(params: ThinkGateParam) {
|
||||
const res = await request.get<ApiResult<PageResult<ThinkGate>>>(
|
||||
THINK_API_URL + '/think/think-gate/page',
|
||||
{
|
||||
params
|
||||
}
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询列表
|
||||
*/
|
||||
export async function listThinkGate(params?: ThinkGateParam) {
|
||||
const res = await request.get<ApiResult<ThinkGate[]>>(
|
||||
THINK_API_URL + '/think/think-gate',
|
||||
{
|
||||
params
|
||||
}
|
||||
);
|
||||
if (res.data.code === 0 && res.data.data) {
|
||||
return res.data.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*/
|
||||
export async function addThinkGate(data: ThinkGate) {
|
||||
const res = await request.post<ApiResult<unknown>>(
|
||||
THINK_API_URL + '/think/think-gate',
|
||||
data
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改
|
||||
*/
|
||||
export async function updateThinkGate(data: ThinkGate) {
|
||||
const res = await request.put<ApiResult<unknown>>(
|
||||
THINK_API_URL + '/think/think-gate',
|
||||
data
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
export async function removeThinkGate(id?: number) {
|
||||
const res = await request.delete<ApiResult<unknown>>(
|
||||
THINK_API_URL + '/think/think-gate/' + id
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*/
|
||||
export async function removeBatchThinkGate(data: (number | undefined)[]) {
|
||||
const res = await request.delete<ApiResult<unknown>>(
|
||||
THINK_API_URL + '/think/think-gate/batch',
|
||||
{
|
||||
data
|
||||
}
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据id查询
|
||||
*/
|
||||
export async function getThinkGate(id: number) {
|
||||
const res = await request.get<ApiResult<ThinkGate>>(
|
||||
THINK_API_URL + '/think/think-gate/' + id
|
||||
);
|
||||
if (res.data.code === 0 && res.data.data) {
|
||||
return res.data.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
43
src/api/think/thinkGate/model/index.ts
Normal file
43
src/api/think/thinkGate/model/index.ts
Normal file
@@ -0,0 +1,43 @@
|
||||
import type { PageParam } from '@/api';
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
export interface ThinkGate {
|
||||
//
|
||||
id?: string;
|
||||
// 闸机名称
|
||||
gateName?: string;
|
||||
// 闸机被使用的展馆
|
||||
siteId?: number;
|
||||
// 闸机编码
|
||||
gateCode?: string;
|
||||
// 闸机序列码
|
||||
gateMac?: string;
|
||||
// 闸机 IP
|
||||
gateIp?: string;
|
||||
// 闸机状态(1=正常 2=模块异常)
|
||||
gateState?: string;
|
||||
// 闸机通心跳次数
|
||||
liveNumber?: number;
|
||||
// 创建时间
|
||||
crateTime?: string;
|
||||
// 创建人id
|
||||
createUser?: string;
|
||||
// 更新次数
|
||||
updateNumber?: number;
|
||||
// 最近更新时间,作为系统设计预留字段
|
||||
updateTime?: string;
|
||||
// 最近更新数据id 系统设计使用
|
||||
updateUser?: string;
|
||||
// 数据逻辑删除状态 0:未删除 1 :已删除; 物理删除不用考虑该字段 作为系统设计预留字段
|
||||
deleteStatus?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* 搜索条件
|
||||
*/
|
||||
export interface ThinkGateParam extends PageParam {
|
||||
id?: number;
|
||||
keywords?: string;
|
||||
}
|
||||
Reference in New Issue
Block a user