yak_handcuffs/src/api/index.ts

210 lines
4.7 KiB
TypeScript
Raw Normal View History

2025-03-31 18:24:37 +08:00
import request from '../utils/request';
2025-04-07 18:35:54 +08:00
import { TLogin, TAccount, IpagingRes, TDevice, TOrg, TRoleList, TStatisticsDevice, statisticsContentReq, statisticsContentRes } 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({
url: '/v1/web/device/getLocation',
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/device/warning/record',
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({
url: '/v1/web/account/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
});
};