system.ts
1.71 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
import {
AccountParams,
DeptListItem,
MenuParams,
RoleParams,
RolePageParams,
MenuListGetResultModel,
DeptListGetResultModel,
AccountListGetResultModel,
RolePageListGetResultModel,
RoleListGetResultModel,
} from './model/systemModel';
import { defHttp } from '/@/utils/http/axios';
enum Api {
AccountList = '/order/erp/users/list_by_page',
IsAccountExist = '/system/accountExist',
DeptList = '/system/getDeptList',
setRoleStatus = '/system/setRoleStatus',
MenuList = '/system/getMenuList',
RolePageList = '/order/erp/roles/list_by_page',
GetAllRoleList = '/system/getAllRoleList',
}
export const getAccountList = async (params: AccountParams) => {
const res = await defHttp.post<AccountListGetResultModel>({ url: Api.AccountList, params });
return new Promise((resolve) => {
resolve(res.records);
});
};
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 = async (params?: RolePageParams) => {
const res = await defHttp.post<RolePageListGetResultModel>({ url: Api.RolePageList, params });
return new Promise((resolve) => {
resolve(res.records);
});
};
export const getAllRoleList = (params?: RoleParams) =>
defHttp.get<RoleListGetResultModel>({ url: Api.GetAllRoleList, params });
export const setRoleStatus = (id: number, status: string) =>
defHttp.post({ url: Api.setRoleStatus, params: { id, status } });
export const isAccountExist = (account: string) =>
defHttp.post({ url: Api.IsAccountExist, params: { account } }, { errorMessageMode: 'none' });