system.ts
3.83 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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
import {
AccountParams,
OrganizationListItem,
MenuParams,
RoleParams,
RolePageParams,
MenuListGetResultModel,
OrganizationListGetResultModel,
AccountListGetResultModel,
RolePageListGetResultModel,
RoleListGetResultModel,
RoleReqDTO,
AccountListItem,
AccountListModel,
RoleOrOrganizationParam,
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',
BaseOrganization = '/organization'
}
export const getAccountInfo=(userId:string)=>
defHttp.get<AccountListModel>({url: Api.BaseUserUrl+"/"+userId})
export const getAccountList = (params: AccountParams) =>
defHttp.get<AccountListGetResultModel>({url: Api.AccountList, params});
/**
* 获取组织列表
* @param params 请求参数
*/
export const getOrganizationList = (params?: OrganizationListItem) =>
defHttp.get<OrganizationListGetResultModel>({url: Api.BaseOrganization+'/me/organizations', params});
/**
* 更新或者保存组织
* @param params
* @param isUpdate
*/
export const saveOrUpdateOrganization = (params?:OrganizationListItem,isUpdate?:boolean) =>
{
if(isUpdate){
return defHttp.put<OrganizationListGetResultModel>({url: Api.BaseOrganization, params});
}else{
return defHttp.post<OrganizationListGetResultModel>({url: Api.BaseOrganization, params});
}
};
/**
* 删除组织
* @param ids 删除的ID
*/
export const delOrganization = (ids: string[]) =>
defHttp.delete({url: Api.BaseOrganization, data: ids})
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:RoleOrOrganizationParam)=>
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
});