system.ts
3.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
import {
AccountParams,
DeptListItem,
MenuParams,
RoleParams,
RolePageParams,
MenuListGetResultModel,
DeptListGetResultModel,
AccountListGetResultModel,
RolePageListGetResultModel,
RoleListGetResultModel,
RoleReqDTO,
AccountListItem,
AccountListModel,
RoleOrGroupParam,
ChangeAccountParams,
} from './model/systemModel';
import {defHttp} from '/@/utils/http/axios';
enum Api {
AccountList = '/user/page',
IsAccountExist = '/user/accountExist/',
DeptList = '/dept/all',
setRoleStatus = '/role/updateRoleStatus/',
MenuList = '/system/getMenuList',
RolePageList = '/role',
SaveOrUpdateRoleInfoWithMenu = '/role/saveOrUpdateRoleInfoWithMenu',
DeleteRole = '/role',
GetAllRoleList = '/role/find/list',
BaseUserUrl = '/user'
}
export const getAccountInfo=(userId:string)=>
defHttp.get<AccountListModel>({url: Api.BaseUserUrl+"/"+userId})
export const getAccountList = (params: AccountParams) =>
defHttp.get<AccountListGetResultModel>({url: Api.AccountList, params});
export const getDeptList = (params?: DeptListItem) =>
defHttp.get<DeptListGetResultModel>({url: Api.DeptList, params});
export const getMenuList = (params?: MenuParams) =>
defHttp.get<MenuListGetResultModel>({url: Api.MenuList, params});
export const getRoleListByPage = (params?: RolePageParams) =>
defHttp.get<RolePageListGetResultModel>({url: Api.RolePageList, params});
export const getTenantRoleListByPage= (params?: RolePageParams) =>
defHttp.get<RolePageListGetResultModel>({url: Api.RolePageList, params});
export const getAllRoleList = (params?: RoleParams) =>
defHttp.post<RoleListGetResultModel>({url: Api.GetAllRoleList, params});
export const setRoleStatus = (id: number, status: number) =>
defHttp.put({url: Api.setRoleStatus + id + "/" + status});
export const saveOrUpdateRoleInfoWithMenu = async (roleRequestDto: RoleReqDTO) => {
await defHttp.post({url: Api.SaveOrUpdateRoleInfoWithMenu, params: roleRequestDto});
}
export const isAccountExist = (account: string) =>
defHttp.get({url: Api.IsAccountExist + account}, {errorMessageMode: 'none'});
export const delRole = async (roleIds: string[]) => {
await defHttp.delete({url: Api.DeleteRole, params: roleIds});
}
/**
* 更新或添加用户信息
* @param params
* @param isUpdate
* @constructor
*/
export const SaveOrUpdateUserInfo = (params: AccountListItem, isUpdate: boolean)=>{
if (isUpdate) {
return defHttp.put<AccountListModel>({
url: Api.BaseUserUrl,
params,
})
} else {
return defHttp.post<AccountListModel>({
url: Api.BaseUserUrl,
params,
})
}
}
/**
* 删除User
* @param ids 删除id数组
*/
export const deleteUser = (ids: string[]) =>
defHttp.delete({
url: Api.BaseUserUrl,
data: {
ids: ids
},
})
/**
* 查询当前用户的关系
* @param params
*/
export const findCurrentUserRelation=(params:RoleOrGroupParam)=>
defHttp.post<Array<string>>({
url: Api.BaseUserUrl+"/relation",
params:params
});
/**
* 修改密码
* @param params
*/
export const resetPassword=(params:ChangeAccountParams)=>
defHttp.post({
url: Api.BaseUserUrl + "/reset",
params:params
});