yak_handcuffs/src/api/index.ts

326 lines
7.5 KiB
TypeScript
Raw Normal View History

2025-03-31 18:24:37 +08:00
import request from '../utils/request';
2025-04-10 19:00:17 +08:00
import { TLogin, TAccount, IpagingRes, TDevice, TOrg, TRoleList, TStatisticsDevice, statisticsContentReq, statisticsContentRes, TStatisticsCount, TWarnRecord, TWarningDetail, TWarningConfirm, TDeviceConfigModify, TDeviceConfig, THealthLatestData, TLocateRecord, TSetUseStatus, TRoleMenuList, TRoleModify } from "./index.d";
2025-04-03 18:21:17 +08:00
export const fetchLogin = (p: TLogin.Ireq): Promise<TLogin.IRes> => {
return request({
url: '/v1/web/login',
method: 'post',
data: p
});
};
2025-04-07 18:35:54 +08:00
// 批量导入账号样例
export const exportDemoAccount = (): Promise<any> => {
return request({
url: '/v1/web/upload/exportDemo/account',
method: 'get',
responseType: 'blob'
});
};
2025-03-31 18:24:37 +08:00
export const fetchData = () => {
2025-04-03 18:21:17 +08:00
return request({
url: './mock/table.json',
method: 'get'
});
2025-03-31 18:24:37 +08:00
};
2025-04-03 18:21:17 +08:00
2025-03-31 18:24:37 +08:00
export const fetchUserData = () => {
2025-04-03 18:21:17 +08:00
return request({
url: './mock/user.json',
method: 'get'
});
2025-03-31 18:24:37 +08:00
};
export const fetchRoleData = () => {
2025-04-03 18:21:17 +08:00
return request({
url: './mock/role.json',
method: 'get'
});
};
// -------------------------------------------------------------------------------------------------------------------
// 添加用户
export const accountAdd = (p: TAccount.IAdd): Promise<null> => {
return request({
url: '/v1/web/account/add',
method: 'post',
data: p
});
};
// 删除用户
export const accountDeletet = (p: TAccount.Idel): Promise<null> => {
return request({
url: '/v1/web/account/delete',
method: 'post',
data: p
});
};
// 修改用户
export const accountModify = (p: TAccount.IAdd): Promise<null> => {
return request({
url: '/v1/web/account/modify',
method: 'post',
data: p
});
};
// 获取用户列表
export const accountList = (p: TAccount.IListReq): Promise<IpagingRes<TAccount.IListRes>> => {
return request({
url: '/v1/web/account/list',
method: 'get',
params: p
});
};
// 重置密码
export const passwordReset = (p: TAccount.IResetPwd): Promise<null> => {
return request({
url: '/v1/web/account/password/reset',
method: 'post',
data: p
});
};
// 获取设备列表
export const deviceList = (p: TDevice.IListReq): Promise<IpagingRes<TDevice.IListRes>> => {
return request({
url: '/v1/web/device/list',
method: 'get',
params: p
});
};
// 设置监测模式
export const setMonitor = (p: TDevice.ISetMonitor): Promise<null> => {
return request({
url: '/v1/web/device/set/monitor',
method: 'post',
data: p
});
};
// 设置模式
export const setMode = (p: TDevice.ISetMonitor): Promise<null> => {
return request({
url: '/v1/web/device/set/mode',
method: 'post',
data: p
});
};
// 获取定位
export const deviceGetLocation = (p: TDevice.ISetMonitor): Promise<null> => {
return request({
2025-04-09 18:45:44 +08:00
url: '/v1/web/device/getLocate',
2025-04-03 18:21:17 +08:00
method: 'post',
data: p
});
};
// 设备控制
export const deviceControl = (p: TDevice.ISetMonitor): Promise<null> => {
return request({
url: '/v1/web/device/control',
method: 'post',
data: p
});
};
// 设备使用记录
export const deviceUseRecord = (p: TDevice.IRecordReq): Promise<IpagingRes<TDevice.IUseRecordRes>> => {
return request({
url: '/v1/web/device/use/record',
method: 'get',
params: p
});
};
// 预警记录
export const warningRecord = (p: TDevice.IRecordReq): Promise<IpagingRes<TDevice.IWarningRecordRes>> => {
return request({
2025-04-09 18:45:44 +08:00
url: '/v1/web/warning/record',
2025-04-03 18:21:17 +08:00
method: 'get',
params: p
});
2025-03-31 18:24:37 +08:00
};
2025-04-07 18:35:54 +08:00
// 新增机构
export const orgAdd = (p: TOrg.IAdd): Promise<null> => {
return request({
url: '/v1/web/org/add',
method: 'post',
data: p
});
};
// 修改机构
export const orgModify = (p: TOrg.IAdd): Promise<null> => {
return request({
url: '/v1/web/org/modify',
method: 'post',
data: p
});
};
// 机构列表
export const orgList = (p?: TOrg.IListReq): Promise<IpagingRes<TOrg.IOrgRecordRes>> => {
return request({
url: '/v1/web/org/list',
method: 'get',
params: p
});
};
// 删除机构
export const orgDelete = (p?: TOrg.Idel): Promise<null> => {
return request({
url: '/v1/web/org/delete',
method: 'post',
data: p
});
};
// 获取角色列表
export const roleList = (): Promise<TRoleList[]> => {
return request({
2025-04-09 18:45:44 +08:00
url: '/v1/web/role/list',
2025-04-07 18:35:54 +08:00
method: 'get',
});
};
2025-04-10 19:00:17 +08:00
// 修改角色信息
export const roleModify = (p: TRoleModify.Ireq): Promise<null> => {
return request({
url: '/v1/web/role/modify',
method: 'post',
data: p
});
};
2025-04-07 18:35:54 +08:00
// 设备在线统计
export const statisticsDevice = (): Promise<TStatisticsDevice> => {
return request({
url: '/v1/web/statistics/device',
method: 'get',
});
};
// 内容数据
export const statisticsContent = (p: statisticsContentReq): Promise<statisticsContentRes> => {
return request({
url: '/v1/web/statistics/content',
method: 'post',
data: p
});
};
2025-04-08 18:31:37 +08:00
// 获取统计数据
export const statisticsCount = (): Promise<TStatisticsCount> => {
return request({
url: '/v1/web/statistics/count',
method: 'get',
});
};
// 告警统计
export const statisticsWarningapi = (): Promise<statisticsContentRes> => {
return request({
url: '/v1/web/statistics/warning',
method: 'get',
});
};
// 预警记录
export const warnRecord = (p: TWarnRecord.IListReq): Promise<IpagingRes<TWarnRecord.IListRes>> => {
return request({
2025-04-09 18:45:44 +08:00
url: '/v1/web/warning/record',
2025-04-08 18:31:37 +08:00
method: 'get',
params: p
});
};
2025-04-09 18:45:44 +08:00
// 预警记录
export const warningDetail = (p: TWarningDetail.TParams): Promise<TWarningDetail.TRes> => {
return request({
url: '/v1/web/warning/detail',
method: 'get',
params: p
});
};
// 预警记录
export const warningConfirm = (p: TWarningConfirm): Promise<null> => {
return request({
url: '/v1/web/warning/confirm',
method: 'post',
data: p
});
};
// 获取专项配置
export const deviceConfig = (p: TDeviceConfig.Treq): Promise<TDeviceConfig.Tres> => {
return request({
url: '/v1/web/device/deviceConfig',
method: 'get',
params: p
});
};
// 修改专项配置
export const deviceConfigModify = (p: TDeviceConfigModify): Promise<null> => {
return request({
url: '/v1/web/device/deviceConfig/modify',
method: 'post',
data: p
});
};
2025-04-10 13:33:38 +08:00
// 获取最新健康数据
export const healthLatestData = (p: THealthLatestData.TReq): Promise<THealthLatestData.TRes> => {
return request({
url: '/v1/web/health/latestData',
method: 'get',
params: p
});
};
2025-04-10 19:00:17 +08:00
// 设备定位记录
export const locateRecord = (p: TLocateRecord.TReq): Promise<TLocateRecord.TRes[]> => {
return request({
url: '/v1/web/device/locate/record',
method: 'get',
params: p
});
};
// 设置使用状态
export const setUseStatus = (p: TSetUseStatus.TReq): Promise<null> => {
return request({
url: '/v1/web/device/set/useStatus',
method: 'post',
data: p
});
};
// 设置禁用状态
export const setStatus = (p: TSetUseStatus.TReq): Promise<null> => {
return request({
url: '/v1/web/device/set/status',
method: 'post',
data: p
});
};
// 获取菜单列表
export const roleMenuList = (): Promise<TRoleMenuList.TRes[]> => {
return request({
url: '/v1/web/role/menu/list',
method: 'get',
});
};
2025-04-08 18:31:37 +08:00