yak_handcuffs/src/api/index.ts

273 lines
6.2 KiB
TypeScript

import request from '../utils/request';
import { TLogin, TAccount, IpagingRes, TDevice, TOrg, TRoleList, TStatisticsDevice, statisticsContentReq, statisticsContentRes, TStatisticsCount, TWarnRecord, TWarningDetail, TWarningConfirm, TDeviceConfigModify, TDeviceConfig } from "./index.d";
export const fetchLogin = (p: TLogin.Ireq): Promise<TLogin.IRes> => {
return request({
url: '/v1/web/login',
method: 'post',
data: p
});
};
// 批量导入账号样例
export const exportDemoAccount = (): Promise<any> => {
return request({
url: '/v1/web/upload/exportDemo/account',
method: 'get',
responseType: 'blob'
});
};
export const fetchData = () => {
return request({
url: './mock/table.json',
method: 'get'
});
};
export const fetchUserData = () => {
return request({
url: './mock/user.json',
method: 'get'
});
};
export const fetchRoleData = () => {
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({
url: '/v1/web/device/getLocate',
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({
url: '/v1/web/warning/record',
method: 'get',
params: p
});
};
// 新增机构
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({
url: '/v1/web/role/list',
method: 'get',
});
};
// 设备在线统计
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
});
};
// 获取统计数据
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({
url: '/v1/web/warning/record',
method: 'get',
params: p
});
};
// 预警记录
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
});
};