22 changed files with 666 additions and 621 deletions
@ -1,30 +1,27 @@ |
|||||||
// 引入基础包
|
// 引入基础包
|
||||||
import { Page, R } from '/@/api/model'; |
import { CommonEntity, Page, R } from '/@/api/model'; |
||||||
|
|
||||||
// 定义查询参数
|
// 查询参数
|
||||||
export type UserVO = Page & { |
export type UserDto = Page & User; |
||||||
name?: string; |
|
||||||
path?: string; |
|
||||||
}; |
|
||||||
|
|
||||||
// 定义用户对象
|
// 用户对象
|
||||||
export interface User { |
export interface User extends CommonEntity { |
||||||
id: string; |
id: string; |
||||||
account: string; |
userName: string; |
||||||
password?: string; |
nickName: string; |
||||||
name: string; |
password: string; |
||||||
realName: string; |
deptId: string; |
||||||
avatar: string; |
deptName: string; |
||||||
email: string; |
email: string; |
||||||
telephone: string; |
phone: string; |
||||||
birthday: string; |
sex: string; |
||||||
sex: number; |
avatar: string; |
||||||
roleId: string | number; |
loginIp: string; |
||||||
departId: string | number; |
loginTime: string; |
||||||
status: number; |
status: string; |
||||||
departName: string; |
roleIds: string[]; |
||||||
roleName: string; |
permissions: string[]; |
||||||
} |
} |
||||||
|
|
||||||
// 根据用户对象生成响应模型
|
// 响应模型
|
||||||
export type UserDTO = R<User>; |
export type UserVo = R<User[]>; |
||||||
|
@ -1,23 +1,29 @@ |
|||||||
import { User, UserVO, UserDTO } from './model/userModel'; |
import { User, UserDto } from './model/userModel'; |
||||||
import { defHttp } from '/@/utils/http/axios'; |
import { defHttp } from '/@/utils/http/axios'; |
||||||
|
|
||||||
enum Api { |
enum Api { |
||||||
Page = '/mate-system/user/page', |
list = '/system_proxy/system/user/list', |
||||||
Set = '/mate-system/user/set', |
add = '/system_proxy/system/user/save', |
||||||
Del = '/mate-system/user/del', |
get = '/system_proxy/system/user', |
||||||
SetPassword = '/mate-system/user/set-password', |
edit = '/system_proxy/system/user/update', |
||||||
|
del = '/system_proxy/system/user/remove', |
||||||
|
updatePwd = '/system_proxy/system/user/updatePwd' |
||||||
} |
} |
||||||
|
|
||||||
// 菜单树
|
// 查询用户列表
|
||||||
export const page = (params?: UserVO) => defHttp.get<UserDTO>({ url: Api.Page, params }); |
export const listUser = (params?: Partial<UserDto>) => defHttp.get({ url: Api.list, params }); |
||||||
|
|
||||||
// 保存
|
// 新增用户
|
||||||
export const set = (params: User) => defHttp.post<User>({ url: Api.Set, params }); |
export const addUser = (params: Partial<User>) => defHttp.post({ url: Api.add, data: params }); |
||||||
|
|
||||||
// 删除
|
// 修改用户
|
||||||
export const del = (params: { ids: String }) => |
export const editUser = (params: Partial<User>) => defHttp.put({ url: Api.edit, data: params }); |
||||||
defHttp.post<boolean>({ url: Api.Del + `?ids=${params.ids}` }); |
|
||||||
|
|
||||||
// 设置密码
|
// 查询用户详细
|
||||||
export const userSetPassword = (params?: User) => |
export const getUser = (id: string) => defHttp.get<User>({ url: `${Api.get}/${id}` }); |
||||||
defHttp.post<boolean>({ url: Api.SetPassword, params }); |
|
||||||
|
// 删除用户
|
||||||
|
export const delUser = (id: string) => defHttp.delete({ url: `${Api.del}/${id}` }); |
||||||
|
|
||||||
|
// 更新密码
|
||||||
|
export const updatePwd = (params: Partial<User>) => defHttp.put({ url: Api.updatePwd, params }); |
||||||
|
Loading…
Reference in new issue