feat: initial commit
This commit is contained in:
@@ -0,0 +1,76 @@
|
||||
import { http } from "@/utils/http";
|
||||
|
||||
export interface ConfigQuery extends BasePageQuery {
|
||||
/**
|
||||
* 配置key
|
||||
*/
|
||||
configKey?: string;
|
||||
/**
|
||||
* 配置名称
|
||||
*/
|
||||
configName?: string;
|
||||
/**
|
||||
* 是否允许更改配置
|
||||
*/
|
||||
isAllowChange?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* ConfigDTO, 配置信息
|
||||
*/
|
||||
export interface ConfigDTO {
|
||||
configId?: string;
|
||||
configKey?: string;
|
||||
configName?: string;
|
||||
configOptions?: string[];
|
||||
configValue?: string;
|
||||
createTime?: Date;
|
||||
isAllowChange?: string;
|
||||
isAllowChangeStr?: string;
|
||||
remark?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* ConfigUpdateCommand
|
||||
*/
|
||||
export interface UpdateConfigRequest {
|
||||
configValue: string;
|
||||
}
|
||||
|
||||
/** 获取配置列表 */
|
||||
export const getConfigListApi = (params?: ConfigQuery) => {
|
||||
return http.request<ResponseData<PageDTO<ConfigDTO>>>(
|
||||
"get",
|
||||
"/system/configs",
|
||||
{
|
||||
params
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
/** 获取配置信息 */
|
||||
export const getConfigInfoApi = (configId: string) => {
|
||||
return http.request<ResponseData<ConfigDTO>>(
|
||||
"get",
|
||||
`/system/config/${configId}`
|
||||
);
|
||||
};
|
||||
|
||||
/** 刷新配置缓存 */
|
||||
export const updateConfigApi = (
|
||||
configId: number,
|
||||
data: UpdateConfigRequest
|
||||
) => {
|
||||
return http.request<ResponseData<PageDTO<ConfigDTO>>>(
|
||||
"put",
|
||||
`/system/config/${configId}`,
|
||||
{
|
||||
data
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
/** 刷新配置缓存 */
|
||||
export const refreshConfigCacheApi = () => {
|
||||
return http.request<ResponseData<void>>("delete", "/system/configs/cache");
|
||||
};
|
||||
@@ -0,0 +1,83 @@
|
||||
import { http } from "@/utils/http";
|
||||
|
||||
export interface DeptQuery extends BaseQuery {
|
||||
// TODO 目前不需要这个参数
|
||||
deptId?: number;
|
||||
parentId?: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* DeptDTO
|
||||
*/
|
||||
export interface DeptDTO {
|
||||
createTime?: Date;
|
||||
id?: number;
|
||||
deptName?: string;
|
||||
email?: string;
|
||||
leaderName?: string;
|
||||
orderNum?: number;
|
||||
parentId?: number;
|
||||
phone?: string;
|
||||
status?: number;
|
||||
statusStr?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* AddDeptCommand
|
||||
*/
|
||||
export interface DeptRequest {
|
||||
deptName: string;
|
||||
email?: string;
|
||||
leaderName?: string;
|
||||
orderNum: number;
|
||||
parentId: number;
|
||||
phone?: string;
|
||||
status: number;
|
||||
}
|
||||
|
||||
export interface DeptTreeDTO {
|
||||
id: number;
|
||||
parentId: number;
|
||||
label: string;
|
||||
children: [DeptTreeDTO];
|
||||
}
|
||||
|
||||
/** 获取部门列表 */
|
||||
export const getDeptListApi = (params?: DeptQuery) => {
|
||||
return http.request<ResponseData<Array<DeptDTO>>>("get", "/system/depts", {
|
||||
params
|
||||
});
|
||||
};
|
||||
|
||||
/** 新增部门 */
|
||||
export const addDeptApi = (data: DeptRequest) => {
|
||||
console.log(data);
|
||||
return http.request<ResponseData<void>>("post", "/system/dept", {
|
||||
data
|
||||
});
|
||||
};
|
||||
|
||||
/** 部门详情 */
|
||||
export const getDeptInfoApi = (deptId: string) => {
|
||||
return http.request<ResponseData<DeptDTO>>("get", `/system/dept/${deptId}`);
|
||||
};
|
||||
|
||||
/** 修改部门 */
|
||||
export const updateDeptApi = (deptId: string, data: DeptRequest) => {
|
||||
return http.request<ResponseData<void>>("put", `/system/dept/${deptId}`, {
|
||||
data
|
||||
});
|
||||
};
|
||||
|
||||
/** 删除部门 */
|
||||
export const deleteDeptApi = (deptId: string) => {
|
||||
return http.request<ResponseData<void>>("delete", `/system/dept/${deptId}`);
|
||||
};
|
||||
|
||||
/** 获取部门树级结构 */
|
||||
export const getDeptTree = () => {
|
||||
return http.request<ResponseData<DeptTreeDTO>>(
|
||||
"get",
|
||||
"/system/depts/dropdown"
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,116 @@
|
||||
import { http } from "@/utils/http";
|
||||
|
||||
export interface OperationLogsQuery extends BasePageQuery {
|
||||
businessType?: string;
|
||||
requestModule?: string;
|
||||
status?: string;
|
||||
username?: string;
|
||||
}
|
||||
|
||||
export interface OperationLogDTO {
|
||||
businessType?: number;
|
||||
businessTypeStr?: string;
|
||||
calledMethod?: string;
|
||||
deptId?: number;
|
||||
deptName?: string;
|
||||
errorStack?: string;
|
||||
operationId?: number;
|
||||
operationParam?: string;
|
||||
operationResult?: string;
|
||||
operationTime?: Date;
|
||||
operatorIp?: string;
|
||||
operatorLocation?: string;
|
||||
operatorType?: number;
|
||||
operatorTypeStr?: string;
|
||||
requestMethod?: string;
|
||||
requestModule?: string;
|
||||
requestUrl?: string;
|
||||
status?: number;
|
||||
statusStr?: string;
|
||||
userId?: number;
|
||||
username?: string;
|
||||
}
|
||||
|
||||
/** 获取操作日志列表 */
|
||||
export const getOperationLogListApi = (params?: OperationLogsQuery) => {
|
||||
return http.request<ResponseData<PageDTO<OperationLogDTO>>>(
|
||||
"get",
|
||||
"/logs/operationLogs",
|
||||
{
|
||||
params
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
export const exportOperationLogExcelApi = (
|
||||
params: OperationLogsQuery,
|
||||
fileName: string
|
||||
) => {
|
||||
return http.download("/logs/operationLogs/excel", fileName, {
|
||||
params
|
||||
});
|
||||
};
|
||||
|
||||
export const deleteOperationLogApi = (data: Array<number>) => {
|
||||
return http.request<ResponseData<void>>("delete", "/logs/operationLogs", {
|
||||
params: {
|
||||
// 需要将数组转换为字符串 否则Axios会将参数变成 noticeIds[0]:1 noticeIds[1]:2 这种格式,后端接收参数不成功
|
||||
operationIds: data.toString()
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/** 登录日志查询类 */
|
||||
export interface LoginLogQuery extends BasePageQuery {
|
||||
beginTime?: string;
|
||||
endTime?: string;
|
||||
ipAddress?: string;
|
||||
status?: string;
|
||||
username?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* 登录日志信息
|
||||
*/
|
||||
export interface LoginLogsDTO {
|
||||
browser?: string;
|
||||
infoId?: string;
|
||||
ipAddress?: string;
|
||||
loginLocation?: string;
|
||||
loginTime?: Date;
|
||||
msg?: string;
|
||||
operationSystem?: string;
|
||||
/** TODO 这个登录状态的设计很奇怪 需要重构掉 */
|
||||
status?: number;
|
||||
statusStr?: string;
|
||||
username?: string;
|
||||
}
|
||||
|
||||
/** 获取操作日志列表 */
|
||||
export const getLoginLogListApi = (params?: LoginLogQuery) => {
|
||||
return http.request<ResponseData<PageDTO<LoginLogsDTO>>>(
|
||||
"get",
|
||||
"/logs/loginLogs",
|
||||
{
|
||||
params
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
export const exportLoginLogExcelApi = (
|
||||
params: LoginLogQuery,
|
||||
fileName: string
|
||||
) => {
|
||||
return http.download("/logs/loginLogs/excel", fileName, {
|
||||
params
|
||||
});
|
||||
};
|
||||
|
||||
export const deleteLoginLogApi = (data: Array<number>) => {
|
||||
return http.request<ResponseData<void>>("delete", "/logs/loginLogs", {
|
||||
params: {
|
||||
// 需要将数组转换为字符串 否则Axios会将参数变成 noticeIds[0]:1 noticeIds[1]:2 这种格式,后端接收参数不成功
|
||||
ids: data.toString()
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -0,0 +1,118 @@
|
||||
import { http } from "@/utils/http";
|
||||
import { Tree } from "@/utils/tree";
|
||||
|
||||
export interface MenuQuery {
|
||||
isButton: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* MenuDTO
|
||||
*/
|
||||
export interface MenuDTO extends Tree {
|
||||
createTime?: Date;
|
||||
isButton?: number;
|
||||
id?: number;
|
||||
menuName?: string;
|
||||
parentId?: number;
|
||||
menuType: number;
|
||||
menuTypeStr: string;
|
||||
path?: string;
|
||||
permission?: string;
|
||||
routerName?: string;
|
||||
status?: number;
|
||||
statusStr?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* MenuDetailDTO
|
||||
*/
|
||||
export interface MenuDetailDTO extends MenuDTO {
|
||||
meta: MetaDTO;
|
||||
permission?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* AddMenuCommand
|
||||
*/
|
||||
export interface MenuRequest {
|
||||
id: number;
|
||||
parentId: number;
|
||||
menuName: string;
|
||||
routerName?: string;
|
||||
path?: string;
|
||||
permission?: string;
|
||||
status: number;
|
||||
isButton: boolean;
|
||||
menuType: number;
|
||||
meta: MetaDTO;
|
||||
}
|
||||
|
||||
/**
|
||||
* MetaDTO
|
||||
*/
|
||||
export interface MetaDTO {
|
||||
auths?: string[];
|
||||
dynamicLevel?: number;
|
||||
extraIcon?: ExtraIconDTO;
|
||||
frameLoading?: boolean;
|
||||
frameSrc?: string;
|
||||
hiddenTag?: boolean;
|
||||
icon?: string;
|
||||
isFrameSrcInternal?: boolean;
|
||||
keepAlive?: boolean;
|
||||
rank?: number;
|
||||
roles?: string[];
|
||||
showLink?: boolean;
|
||||
showParent?: boolean;
|
||||
title?: string;
|
||||
transition?: TransitionDTO;
|
||||
}
|
||||
|
||||
/**
|
||||
* ExtraIconDTO
|
||||
*/
|
||||
export interface ExtraIconDTO {
|
||||
name?: string;
|
||||
svg?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* TransitionDTO
|
||||
*/
|
||||
export interface TransitionDTO {
|
||||
enterTransition?: string;
|
||||
leaveTransition?: string;
|
||||
name?: string;
|
||||
}
|
||||
|
||||
/** 获取菜单列表 */
|
||||
export const getMenuListApi = (params: MenuQuery) => {
|
||||
return http.request<ResponseData<Array<MenuDTO>>>("get", "/system/menus", {
|
||||
params
|
||||
});
|
||||
};
|
||||
|
||||
/** 添加菜单 */
|
||||
export const addMenuApi = (data: MenuRequest) => {
|
||||
return http.request<ResponseData<void>>("post", "/system/menus", { data });
|
||||
};
|
||||
|
||||
/** 修改菜单 */
|
||||
export const updateMenuApi = (menuId: string, data: MenuRequest) => {
|
||||
return http.request<ResponseData<void>>("put", `/system/menus/${menuId}`, {
|
||||
data
|
||||
});
|
||||
};
|
||||
|
||||
/** 删除菜单 */
|
||||
export const deleteMenuApi = (menuId: string) => {
|
||||
return http.request<ResponseData<void>>("delete", `/system/menus/${menuId}`);
|
||||
};
|
||||
|
||||
/** 菜单详情 */
|
||||
export const getMenuInfoApi = (menuId: string) => {
|
||||
return http.request<ResponseData<MenuDetailDTO>>(
|
||||
"get",
|
||||
`/system/menus/${menuId}`
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,137 @@
|
||||
import { http } from "@/utils/http";
|
||||
|
||||
export interface OnlineUserQuery {
|
||||
ipAddress: string;
|
||||
username: string;
|
||||
}
|
||||
|
||||
export interface OnlineUserInfo {
|
||||
browser?: string;
|
||||
deptName?: string;
|
||||
ipAddress?: string;
|
||||
loginLocation?: string;
|
||||
loginTime?: number;
|
||||
operationSystem?: string;
|
||||
tokenId?: string;
|
||||
username?: string;
|
||||
}
|
||||
|
||||
/** 获取操作日志列表 */
|
||||
export const getOnlineUserListApi = (params?: OnlineUserQuery) => {
|
||||
return http.request<ResponseData<PageDTO<OnlineUserInfo>>>(
|
||||
"get",
|
||||
"/monitor/onlineUsers",
|
||||
{
|
||||
params
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
/** 强制登出用户 */
|
||||
export const logoutOnlineUserApi = (tokenId: string) => {
|
||||
return http.request<ResponseData<void>>(
|
||||
"delete",
|
||||
`/monitor/onlineUser/${tokenId}`
|
||||
);
|
||||
};
|
||||
|
||||
/**
|
||||
* ServerInfo
|
||||
*/
|
||||
export interface ServerInfo {
|
||||
cpuInfo?: CpuInfo;
|
||||
diskInfos?: DiskInfo[];
|
||||
jvmInfo?: JvmInfo;
|
||||
memoryInfo?: MemoryInfo;
|
||||
systemInfo?: SystemInfo;
|
||||
}
|
||||
|
||||
/**
|
||||
* CpuInfo
|
||||
*/
|
||||
export interface CpuInfo {
|
||||
cpuNum?: number;
|
||||
free?: number;
|
||||
sys?: number;
|
||||
total?: number;
|
||||
used?: number;
|
||||
wait?: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* DiskInfo
|
||||
*/
|
||||
export interface DiskInfo {
|
||||
dirName?: string;
|
||||
free?: string;
|
||||
sysTypeName?: string;
|
||||
total?: string;
|
||||
typeName?: string;
|
||||
usage?: number;
|
||||
used?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* JvmInfo
|
||||
*/
|
||||
export interface JvmInfo {
|
||||
free?: number;
|
||||
home?: string;
|
||||
inputArgs?: string;
|
||||
max?: number;
|
||||
name?: string;
|
||||
runTime?: string;
|
||||
startTime?: string;
|
||||
total?: number;
|
||||
usage?: number;
|
||||
used?: number;
|
||||
version?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* MemoryInfo
|
||||
*/
|
||||
export interface MemoryInfo {
|
||||
free?: number;
|
||||
total?: number;
|
||||
usage?: number;
|
||||
used?: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* SystemInfo
|
||||
*/
|
||||
export interface SystemInfo {
|
||||
computerIp?: string;
|
||||
computerName?: string;
|
||||
osArch?: string;
|
||||
osName?: string;
|
||||
userDir?: string;
|
||||
}
|
||||
|
||||
/** 获取服务器信息 */
|
||||
export const getServerInfoApi = () => {
|
||||
return http.request<ResponseData<ServerInfo>>("get", "/monitor/serverInfo");
|
||||
};
|
||||
|
||||
/**
|
||||
* RedisCacheInfoDTO
|
||||
*/
|
||||
export interface RedisCacheInfoDTO {
|
||||
commandStats?: CommandStatusDTO[];
|
||||
dbSize?: number;
|
||||
info?: { [key: string]: string };
|
||||
}
|
||||
|
||||
/**
|
||||
* CommandStatusDTO
|
||||
*/
|
||||
export interface CommandStatusDTO {
|
||||
name?: string;
|
||||
value?: string;
|
||||
}
|
||||
|
||||
/** 获取Redis信息 */
|
||||
export const getCacheInfoApi = () => {
|
||||
return http.request<ResponseData<ServerInfo>>("get", "/monitor/cacheInfo");
|
||||
};
|
||||
@@ -0,0 +1,64 @@
|
||||
import { http } from "@/utils/http";
|
||||
|
||||
export interface SystemNoticeQuery extends BasePageQuery {
|
||||
noticeType: string;
|
||||
noticeTitle: string;
|
||||
creatorName: string;
|
||||
}
|
||||
|
||||
type SystemNoticeDTO = {
|
||||
noticeId: string;
|
||||
noticeTitle: string;
|
||||
noticeType: number;
|
||||
noticeContent: string;
|
||||
status: number;
|
||||
createTime: Date;
|
||||
creatorName: string;
|
||||
};
|
||||
|
||||
export type SystemNoticeRequest = {
|
||||
noticeId?: number;
|
||||
noticeTitle: string;
|
||||
noticeType: number;
|
||||
noticeContent: string;
|
||||
status: number;
|
||||
};
|
||||
|
||||
/** 获取系统通知列表 */
|
||||
export const getSystemNoticeListApi = (params?: SystemNoticeQuery) => {
|
||||
return http.request<ResponseData<PageDTO<SystemNoticeDTO>>>(
|
||||
"get",
|
||||
"/system/notices",
|
||||
{
|
||||
params
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
/** 添加系统通知 */
|
||||
export const addSystemNoticeApi = (data: SystemNoticeRequest) => {
|
||||
return http.request<ResponseData<void>>("post", "/system/notices", {
|
||||
data
|
||||
});
|
||||
};
|
||||
|
||||
/** 修改系统通知 */
|
||||
export const updateSystemNoticeApi = (data: SystemNoticeRequest) => {
|
||||
return http.request<ResponseData<void>>(
|
||||
"put",
|
||||
`/system/notices/${data.noticeId}`,
|
||||
{
|
||||
data
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
/** 删除系统通知 */
|
||||
export const deleteSystemNoticeApi = (data: Array<number>) => {
|
||||
return http.request<ResponseData<void>>("delete", "/system/notices", {
|
||||
params: {
|
||||
// 需要将数组转换为字符串 否则Axios会将参数变成 noticeIds[0]:1 noticeIds[1]:2 这种格式,后端接收参数不成功
|
||||
noticeIds: data.toString()
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -0,0 +1,70 @@
|
||||
import { http } from "@/utils/http";
|
||||
|
||||
export interface PostListCommand extends BasePageQuery {
|
||||
postCode?: string;
|
||||
postName?: string;
|
||||
status?: number;
|
||||
}
|
||||
|
||||
export interface PostPageResponse {
|
||||
createTime: string;
|
||||
postCode: string;
|
||||
postId: number;
|
||||
postName: string;
|
||||
postSort: number;
|
||||
remark: string;
|
||||
status: number;
|
||||
statusStr: string;
|
||||
}
|
||||
|
||||
export function getPostListApi(params: PostListCommand) {
|
||||
return http.request<ResponseData<PageDTO<PostPageResponse>>>(
|
||||
"get",
|
||||
"/system/post/list",
|
||||
{
|
||||
params
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
export const exportPostExcelApi = (
|
||||
params: PostListCommand,
|
||||
fileName: string
|
||||
) => {
|
||||
return http.download("/system/post/excel", fileName, {
|
||||
params
|
||||
});
|
||||
};
|
||||
|
||||
export const deletePostApi = (data: Array<number>) => {
|
||||
return http.request<ResponseData<void>>("delete", "/system/post", {
|
||||
params: {
|
||||
// 需要将数组转换为字符串 否则Axios会将参数变成 noticeIds[0]:1 noticeIds[1]:2 这种格式,后端接收参数不成功
|
||||
ids: data.toString()
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
export interface AddPostCommand {
|
||||
postCode: string;
|
||||
postName: string;
|
||||
postSort: number;
|
||||
remark?: string;
|
||||
status?: string;
|
||||
}
|
||||
|
||||
export const addPostApi = (data: AddPostCommand) => {
|
||||
return http.request<ResponseData<void>>("post", "/system/post", {
|
||||
data
|
||||
});
|
||||
};
|
||||
|
||||
export interface UpdatePostCommand extends AddPostCommand {
|
||||
postId: number;
|
||||
}
|
||||
|
||||
export const updatePostApi = (data: UpdatePostCommand) => {
|
||||
return http.request<ResponseData<void>>("put", "/system/post", {
|
||||
data
|
||||
});
|
||||
};
|
||||
@@ -0,0 +1,65 @@
|
||||
import { http } from "@/utils/http";
|
||||
|
||||
export interface RoleQuery extends BasePageQuery {
|
||||
roleKey?: string;
|
||||
roleName?: string;
|
||||
status?: string;
|
||||
timeRangeColumn?: string;
|
||||
}
|
||||
|
||||
export interface RoleDTO {
|
||||
createTime: Date;
|
||||
dataScope: number;
|
||||
remark: string;
|
||||
roleId: number;
|
||||
roleKey: string;
|
||||
roleName: string;
|
||||
roleSort: number;
|
||||
selectedDeptList: number[];
|
||||
selectedMenuList: number[];
|
||||
status: number;
|
||||
}
|
||||
|
||||
export function getRoleListApi(params: RoleQuery) {
|
||||
return http.request<ResponseData<PageDTO<RoleDTO>>>(
|
||||
"get",
|
||||
"/system/role/list",
|
||||
{
|
||||
params
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
export function getRoleInfoApi(roleId: number) {
|
||||
return http.request<ResponseData<RoleDTO>>("get", "/system/role/" + roleId);
|
||||
}
|
||||
|
||||
export interface AddRoleCommand {
|
||||
dataScope?: string;
|
||||
menuIds: number[];
|
||||
remark?: string;
|
||||
roleKey: string;
|
||||
roleName: string;
|
||||
roleSort: number;
|
||||
status?: string;
|
||||
}
|
||||
|
||||
export function addRoleApi(data: AddRoleCommand) {
|
||||
return http.request<void>("post", "/system/role", {
|
||||
data
|
||||
});
|
||||
}
|
||||
|
||||
export interface UpdateRoleCommand extends AddRoleCommand {
|
||||
roleId: number;
|
||||
}
|
||||
|
||||
export function updateRoleApi(data: UpdateRoleCommand) {
|
||||
return http.request<void>("put", "/system/role", {
|
||||
data
|
||||
});
|
||||
}
|
||||
|
||||
export function deleteRoleApi(roleId: number) {
|
||||
return http.request<void>("delete", "/system/role/" + roleId);
|
||||
}
|
||||
@@ -0,0 +1,176 @@
|
||||
import { http } from "@/utils/http";
|
||||
|
||||
export interface UserQuery extends BasePageQuery {
|
||||
deptId?: number;
|
||||
phoneNumber?: string;
|
||||
status?: number;
|
||||
userId?: number;
|
||||
username?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* UserDTO
|
||||
*/
|
||||
export interface UserDTO {
|
||||
avatar?: string;
|
||||
createTime?: Date;
|
||||
creatorId?: number;
|
||||
creatorName?: string;
|
||||
deptId?: number;
|
||||
deptName?: string;
|
||||
email?: string;
|
||||
loginDate?: Date;
|
||||
loginIp?: string;
|
||||
nickname?: string;
|
||||
phoneNumber?: string;
|
||||
postId?: number;
|
||||
remark?: string;
|
||||
roleId?: number;
|
||||
roleName?: string;
|
||||
sex?: number;
|
||||
status?: number;
|
||||
updaterId?: number;
|
||||
updaterName?: string;
|
||||
updateTime?: Date;
|
||||
userId?: number;
|
||||
username?: string;
|
||||
userType?: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* AddUserCommand
|
||||
*/
|
||||
export interface UserRequest {
|
||||
userId: number;
|
||||
avatar?: string;
|
||||
deptId?: number;
|
||||
email?: string;
|
||||
nickname?: string;
|
||||
phoneNumber?: string;
|
||||
password: string;
|
||||
postId?: number;
|
||||
remark?: string;
|
||||
roleId?: number;
|
||||
sex?: number;
|
||||
status?: number;
|
||||
username?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* UpdateProfileCommand
|
||||
*/
|
||||
export interface UserProfileRequest {
|
||||
email?: string;
|
||||
nickName?: string;
|
||||
phoneNumber?: string;
|
||||
sex?: number;
|
||||
userId?: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* ResetPasswordCommand
|
||||
*/
|
||||
export interface ResetPasswordRequest {
|
||||
newPassword?: string;
|
||||
oldPassword?: string;
|
||||
userId?: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改密码
|
||||
*/
|
||||
export interface PasswordRequest {
|
||||
userId: number;
|
||||
password: string;
|
||||
}
|
||||
|
||||
/** 获取用户列表 */
|
||||
export const getUserListApi = (params?: UserQuery) => {
|
||||
return http.request<ResponseData<PageDTO<UserDTO>>>("get", "/system/users", {
|
||||
params
|
||||
});
|
||||
};
|
||||
|
||||
/** 新增用户 */
|
||||
export const addUserApi = (data?: UserRequest) => {
|
||||
return http.request<ResponseData<void>>("post", "/system/users", {
|
||||
data
|
||||
});
|
||||
};
|
||||
|
||||
/** 编辑用户 */
|
||||
export const updateUserApi = (userId: number, data?: UserRequest) => {
|
||||
return http.request<ResponseData<void>>("put", `/system/users/${userId}`, {
|
||||
data
|
||||
});
|
||||
};
|
||||
|
||||
/** 更改用户密码 */
|
||||
export const updateUserPasswordApi = (data?: PasswordRequest) => {
|
||||
return http.request<ResponseData<void>>(
|
||||
"put",
|
||||
`/system/users/${data.userId}/password`,
|
||||
{
|
||||
data
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
/** 删除用户 */
|
||||
export const deleteUserApi = (userId: number) => {
|
||||
return http.request<ResponseData<void>>("delete", `/system/users/${userId}`);
|
||||
};
|
||||
|
||||
/** 修改用户状态 */
|
||||
export const updateUserStatusApi = (userId: number, status: number) => {
|
||||
return http.request<ResponseData<PageDTO<UserDTO>>>(
|
||||
"put",
|
||||
`/system/users/${userId}/status`,
|
||||
{
|
||||
data: {
|
||||
status: status
|
||||
}
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
/** 批量导出用户 */
|
||||
export const exportUserExcelApi = (params: UserQuery, fileName: string) => {
|
||||
return http.download("/system/users/excel", fileName, {
|
||||
params
|
||||
});
|
||||
};
|
||||
|
||||
/** 用户头像上传 */
|
||||
export const uploadUserAvatarApi = data => {
|
||||
return http.request<ResponseData<void>>(
|
||||
"post",
|
||||
"/system/user/profile/avatar",
|
||||
{
|
||||
data
|
||||
},
|
||||
{
|
||||
headers: {
|
||||
"Content-Type": "multipart/form-data"
|
||||
}
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
/** 更改用户资料 */
|
||||
export const updateUserProfileApi = (data?: UserProfileRequest) => {
|
||||
return http.request<ResponseData<void>>("put", "/system/user/profile", {
|
||||
data
|
||||
});
|
||||
};
|
||||
|
||||
/** 更改当前用户密码 */
|
||||
export const updateCurrentUserPasswordApi = (data?: ResetPasswordRequest) => {
|
||||
return http.request<ResponseData<void>>(
|
||||
"put",
|
||||
"/system/user/profile/password",
|
||||
{
|
||||
data
|
||||
}
|
||||
);
|
||||
};
|
||||
Reference in New Issue
Block a user