添加对ele的支持,目前vben支持还不是特别完善
This commit is contained in:
@@ -22,14 +22,14 @@ export namespace AuthApi {
|
||||
* 登录
|
||||
*/
|
||||
export async function loginApi(data: AuthApi.LoginParams) {
|
||||
return requestClient.post<AuthApi.LoginResult>('/auth/login', data);
|
||||
return requestClient.post<AuthApi.LoginResult>('/system/login/', data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 刷新accessToken
|
||||
*/
|
||||
export async function refreshTokenApi() {
|
||||
return baseRequestClient.post<AuthApi.RefreshTokenResult>('/auth/refresh', {
|
||||
return baseRequestClient.post<AuthApi.RefreshTokenResult>('/system/refresh/', {
|
||||
withCredentials: true,
|
||||
});
|
||||
}
|
||||
@@ -38,7 +38,7 @@ export async function refreshTokenApi() {
|
||||
* 退出登录
|
||||
*/
|
||||
export async function logoutApi() {
|
||||
return baseRequestClient.post('/auth/logout', {
|
||||
return baseRequestClient.post('/system/logout/', {
|
||||
withCredentials: true,
|
||||
});
|
||||
}
|
||||
@@ -47,5 +47,5 @@ export async function logoutApi() {
|
||||
* 获取用户权限码
|
||||
*/
|
||||
export async function getAccessCodesApi() {
|
||||
return requestClient.get<string[]>('/auth/codes');
|
||||
return requestClient.get<string[]>('/system/codes/');
|
||||
}
|
||||
|
||||
@@ -6,5 +6,7 @@ import { requestClient } from '#/api/request';
|
||||
* 获取用户所有菜单
|
||||
*/
|
||||
export async function getAllMenusApi() {
|
||||
return requestClient.get<RouteRecordStringComponent[]>('/menu/all');
|
||||
return requestClient.get<RouteRecordStringComponent[]>(
|
||||
'/system/menu/user_menu',
|
||||
);
|
||||
}
|
||||
|
||||
@@ -6,5 +6,5 @@ import { requestClient } from '#/api/request';
|
||||
* 获取用户信息
|
||||
*/
|
||||
export async function getUserInfoApi() {
|
||||
return requestClient.get<UserInfo>('/user/info');
|
||||
return requestClient.get<UserInfo>('/system/info/');
|
||||
}
|
||||
|
||||
56
web/apps/web-ele/src/api/system/dept.ts
Normal file
56
web/apps/web-ele/src/api/system/dept.ts
Normal file
@@ -0,0 +1,56 @@
|
||||
import type { Recordable } from '@vben/types';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace SystemDeptApi {
|
||||
export interface SystemDept {
|
||||
[key: string]: any;
|
||||
children?: SystemDept[];
|
||||
id: string;
|
||||
name: string;
|
||||
remark?: string;
|
||||
status: 0 | 1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取部门列表数据
|
||||
*/
|
||||
async function getDeptList(params?: Recordable<any>) {
|
||||
return requestClient.get<Array<SystemDeptApi.SystemDept>>('/system/dept/', {
|
||||
params,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建部门
|
||||
* @param data 部门数据
|
||||
*/
|
||||
async function createDept(
|
||||
data: Omit<SystemDeptApi.SystemDept, 'children' | 'id'>,
|
||||
) {
|
||||
return requestClient.post('/system/dept/', data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新部门
|
||||
*
|
||||
* @param id 部门 ID
|
||||
* @param data 部门数据
|
||||
*/
|
||||
async function updateDept(
|
||||
id: string,
|
||||
data: Omit<SystemDeptApi.SystemDept, 'children' | 'id'>,
|
||||
) {
|
||||
return requestClient.put(`/system/dept/${id}/`, data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除部门
|
||||
* @param id 部门 ID
|
||||
*/
|
||||
async function deleteDept(id: string) {
|
||||
return requestClient.delete(`/system/dept/${id}/`);
|
||||
}
|
||||
|
||||
export { createDept, deleteDept, getDeptList, updateDept };
|
||||
74
web/apps/web-ele/src/api/system/dict_data.ts
Normal file
74
web/apps/web-ele/src/api/system/dict_data.ts
Normal file
@@ -0,0 +1,74 @@
|
||||
import type { Recordable } from '@vben/types';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace SystemDictDataApi {
|
||||
export interface SystemDictData {
|
||||
[key: string]: any;
|
||||
id: string;
|
||||
name: string;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取字典数据列表数据
|
||||
*/
|
||||
async function getDictDataList(params: Recordable<any>) {
|
||||
return requestClient.get<Array<SystemDictDataApi.SystemDictData>>(
|
||||
'/system/dict_data/',
|
||||
{
|
||||
params,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建字典数据
|
||||
* @param data 字典数据数据
|
||||
*/
|
||||
async function createDictData(
|
||||
data: Omit<SystemDictDataApi.SystemDictData, 'id'>,
|
||||
) {
|
||||
return requestClient.post('/system/dict_data/', data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新字典数据
|
||||
*
|
||||
* @param id 字典数据 ID
|
||||
* @param data 字典数据数据
|
||||
*/
|
||||
async function updateDictData(
|
||||
id: string,
|
||||
data: Omit<SystemDictDataApi.SystemDictData, 'id'>,
|
||||
) {
|
||||
return requestClient.put(`/system/dict_data/${id}/`, data);
|
||||
}
|
||||
/**
|
||||
* 更新字典数据
|
||||
*
|
||||
* @param id 字典数据 ID
|
||||
* @param data 字典数据数据
|
||||
*/
|
||||
async function patchDictData(
|
||||
id: string,
|
||||
data: Omit<SystemDictDataApi.SystemDictData, 'id'>,
|
||||
) {
|
||||
return requestClient.patch(`/system/dict_data/${id}/`, data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除字典数据
|
||||
* @param id 字典数据 ID
|
||||
*/
|
||||
async function deleteDictData(id: string) {
|
||||
return requestClient.delete(`/system/dict_data/${id}/`);
|
||||
}
|
||||
|
||||
export {
|
||||
createDictData,
|
||||
deleteDictData,
|
||||
getDictDataList,
|
||||
patchDictData,
|
||||
updateDictData,
|
||||
};
|
||||
75
web/apps/web-ele/src/api/system/dict_type.ts
Normal file
75
web/apps/web-ele/src/api/system/dict_type.ts
Normal file
@@ -0,0 +1,75 @@
|
||||
import type { Recordable } from '@vben/types';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace SystemDictTypeApi {
|
||||
export interface SystemDictType {
|
||||
[key: string]: any;
|
||||
id: string;
|
||||
name: string;
|
||||
type: string;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取字典类型列表数据
|
||||
*/
|
||||
async function getDictTypeList(params: Recordable<any>) {
|
||||
return requestClient.get<Array<SystemDictTypeApi.SystemDictType>>(
|
||||
'/system/dict_type/',
|
||||
{
|
||||
params,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建字典类型
|
||||
* @param data 字典类型数据
|
||||
*/
|
||||
async function createDictType(
|
||||
data: Omit<SystemDictTypeApi.SystemDictType, 'id'>,
|
||||
) {
|
||||
return requestClient.post('/system/dict_type/', data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新字典类型
|
||||
*
|
||||
* @param id 字典类型 ID
|
||||
* @param data 字典类型数据
|
||||
*/
|
||||
async function updateDictType(
|
||||
id: string,
|
||||
data: Omit<SystemDictTypeApi.SystemDictType, 'id'>,
|
||||
) {
|
||||
return requestClient.put(`/system/dict_type/${id}/`, data);
|
||||
}
|
||||
/**
|
||||
* 更新字典类型
|
||||
*
|
||||
* @param id 字典类型 ID
|
||||
* @param data 字典类型数据
|
||||
*/
|
||||
async function patchDictType(
|
||||
id: string,
|
||||
data: Omit<SystemDictTypeApi.SystemDictType, 'id'>,
|
||||
) {
|
||||
return requestClient.patch(`/system/dict_type/${id}/`, data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除字典类型
|
||||
* @param id 字典类型 ID
|
||||
*/
|
||||
async function deleteDictType(id: string) {
|
||||
return requestClient.delete(`/system/dict_type/${id}/`);
|
||||
}
|
||||
|
||||
export {
|
||||
createDictType,
|
||||
deleteDictType,
|
||||
getDictTypeList,
|
||||
patchDictType,
|
||||
updateDictType,
|
||||
};
|
||||
3
web/apps/web-ele/src/api/system/index.ts
Normal file
3
web/apps/web-ele/src/api/system/index.ts
Normal file
@@ -0,0 +1,3 @@
|
||||
export * from './dept';
|
||||
export * from './menu';
|
||||
export * from './role';
|
||||
168
web/apps/web-ele/src/api/system/menu.ts
Normal file
168
web/apps/web-ele/src/api/system/menu.ts
Normal file
@@ -0,0 +1,168 @@
|
||||
import type { Recordable } from '@vben/types';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace SystemMenuApi {
|
||||
/** 徽标颜色集合 */
|
||||
export const BadgeVariants = [
|
||||
'default',
|
||||
'destructive',
|
||||
'primary',
|
||||
'success',
|
||||
'warning',
|
||||
] as const;
|
||||
/** 徽标类型集合 */
|
||||
export const BadgeTypes = ['dot', 'normal'] as const;
|
||||
/** 菜单类型集合 */
|
||||
export const MenuTypes = [
|
||||
'catalog',
|
||||
'menu',
|
||||
'embedded',
|
||||
'link',
|
||||
'button',
|
||||
] as const;
|
||||
/** 系统菜单 */
|
||||
export interface SystemMenu {
|
||||
[key: string]: any;
|
||||
/** 后端权限标识 */
|
||||
auth_code: string;
|
||||
/** 子级 */
|
||||
children?: SystemMenu[];
|
||||
/** 组件 */
|
||||
component?: string;
|
||||
/** 菜单ID */
|
||||
id: string;
|
||||
/** 菜单元数据 */
|
||||
meta?: {
|
||||
/** 激活时显示的图标 */
|
||||
activeIcon?: string;
|
||||
/** 作为路由时,需要激活的菜单的Path */
|
||||
activePath?: string;
|
||||
/** 固定在标签栏 */
|
||||
affixTab?: boolean;
|
||||
/** 在标签栏固定的顺序 */
|
||||
affixTabOrder?: number;
|
||||
/** 徽标内容(当徽标类型为normal时有效) */
|
||||
badge?: string;
|
||||
/** 徽标类型 */
|
||||
badgeType?: (typeof BadgeTypes)[number];
|
||||
/** 徽标颜色 */
|
||||
badgeVariants?: (typeof BadgeVariants)[number];
|
||||
/** 在菜单中隐藏下级 */
|
||||
hideChildrenInMenu?: boolean;
|
||||
/** 在面包屑中隐藏 */
|
||||
hideInBreadcrumb?: boolean;
|
||||
/** 在菜单中隐藏 */
|
||||
hideInMenu?: boolean;
|
||||
/** 在标签栏中隐藏 */
|
||||
hideInTab?: boolean;
|
||||
/** 菜单图标 */
|
||||
icon?: string;
|
||||
/** 内嵌Iframe的URL */
|
||||
iframeSrc?: string;
|
||||
/** 是否缓存页面 */
|
||||
keepAlive?: boolean;
|
||||
/** 外链页面的URL */
|
||||
link?: string;
|
||||
/** 同一个路由最大打开的标签数 */
|
||||
maxNumOfOpenTab?: number;
|
||||
/** 无需基础布局 */
|
||||
noBasicLayout?: boolean;
|
||||
/** 是否在新窗口打开 */
|
||||
openInNewWindow?: boolean;
|
||||
/** 菜单排序 */
|
||||
order?: number;
|
||||
/** 额外的路由参数 */
|
||||
query?: Recordable<any>;
|
||||
/** 菜单标题 */
|
||||
title?: string;
|
||||
};
|
||||
/** 菜单名称 */
|
||||
name: string;
|
||||
/** 路由路径 */
|
||||
path: string;
|
||||
/** 父级ID */
|
||||
pid: string;
|
||||
/** 重定向 */
|
||||
redirect?: string;
|
||||
/** 菜单类型 */
|
||||
type: (typeof MenuTypes)[number];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取菜单数据列表
|
||||
*/
|
||||
async function getMenuList() {
|
||||
return requestClient.get<Array<SystemMenuApi.SystemMenu>>('/system/menu/');
|
||||
}
|
||||
|
||||
async function isMenuNameExists(
|
||||
name: string,
|
||||
id?: SystemMenuApi.SystemMenu['id'],
|
||||
) {
|
||||
const url = id ? `/system/menu/${id}/` : `/system/menu/`;
|
||||
return requestClient.get<boolean>(url, {
|
||||
params: { id, name },
|
||||
});
|
||||
}
|
||||
|
||||
async function isMenuSearchExists(
|
||||
name: string,
|
||||
id?: SystemMenuApi.SystemMenu['id'],
|
||||
pid?: SystemMenuApi.SystemMenu['pid'],
|
||||
) {
|
||||
return requestClient.get<boolean>('/system/menu/name-search', {
|
||||
params: { name, id, pid },
|
||||
});
|
||||
}
|
||||
|
||||
async function isMenuPathExists(
|
||||
path: string,
|
||||
id?: SystemMenuApi.SystemMenu['id'],
|
||||
) {
|
||||
return requestClient.get<boolean>('/system/menu/path-exists', {
|
||||
params: { id, path },
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建菜单
|
||||
* @param data 菜单数据
|
||||
*/
|
||||
async function createMenu(
|
||||
data: Omit<SystemMenuApi.SystemMenu, 'children' | 'id'>,
|
||||
) {
|
||||
return requestClient.post('/system/menu/', data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新菜单
|
||||
*
|
||||
* @param id 菜单 ID
|
||||
* @param data 菜单数据
|
||||
*/
|
||||
async function updateMenu(
|
||||
id: string,
|
||||
data: Omit<SystemMenuApi.SystemMenu, 'children' | 'id'>,
|
||||
) {
|
||||
return requestClient.put(`/system/menu/${id}/`, data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除菜单
|
||||
* @param id 菜单 ID
|
||||
*/
|
||||
async function deleteMenu(id: string) {
|
||||
return requestClient.delete(`/system/menu/${id}/`);
|
||||
}
|
||||
|
||||
export {
|
||||
createMenu,
|
||||
deleteMenu,
|
||||
getMenuList,
|
||||
isMenuNameExists,
|
||||
isMenuPathExists,
|
||||
isMenuSearchExists,
|
||||
updateMenu,
|
||||
};
|
||||
70
web/apps/web-ele/src/api/system/role.ts
Normal file
70
web/apps/web-ele/src/api/system/role.ts
Normal file
@@ -0,0 +1,70 @@
|
||||
import type { Recordable } from '@vben/types';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace SystemRoleApi {
|
||||
export interface SystemRole {
|
||||
[key: string]: any;
|
||||
id: string;
|
||||
name: string;
|
||||
permissions: [];
|
||||
profile: {
|
||||
create_time: string;
|
||||
permissions: [];
|
||||
remark?: string;
|
||||
status: 0 | 1;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取角色列表数据
|
||||
*/
|
||||
async function getRoleList(params: Recordable<any>) {
|
||||
return requestClient.get<Array<SystemRoleApi.SystemRole>>('/system/role/', {
|
||||
params,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建角色
|
||||
* @param data 角色数据
|
||||
*/
|
||||
async function createRole(data: Omit<SystemRoleApi.SystemRole, 'id'>) {
|
||||
return requestClient.post('/system/role/', data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新角色
|
||||
*
|
||||
* @param id 角色 ID
|
||||
* @param data 角色数据
|
||||
*/
|
||||
async function updateRole(
|
||||
id: string,
|
||||
data: Omit<SystemRoleApi.SystemRole, 'id'>,
|
||||
) {
|
||||
return requestClient.put(`/system/role/${id}/`, data);
|
||||
}
|
||||
/**
|
||||
* 更新角色
|
||||
*
|
||||
* @param id 角色 ID
|
||||
* @param data 角色数据
|
||||
*/
|
||||
async function patchRole(
|
||||
id: string,
|
||||
data: Omit<SystemRoleApi.SystemRole, 'id'>,
|
||||
) {
|
||||
return requestClient.patch(`/system/role/${id}/`, data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除角色
|
||||
* @param id 角色 ID
|
||||
*/
|
||||
async function deleteRole(id: string) {
|
||||
return requestClient.delete(`/system/role/${id}/`);
|
||||
}
|
||||
|
||||
export { createRole, deleteRole, getRoleList, patchRole, updateRole };
|
||||
74
web/apps/web-ele/src/api/system/tenant_package.ts
Normal file
74
web/apps/web-ele/src/api/system/tenant_package.ts
Normal file
@@ -0,0 +1,74 @@
|
||||
import type { Recordable } from '@vben/types';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace SystemTenantPackageApi {
|
||||
export interface SystemTenantPackage {
|
||||
[key: string]: any;
|
||||
id: string;
|
||||
name: string;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取租户列表数据
|
||||
*/
|
||||
async function getTenantPackageList(params: Recordable<any>) {
|
||||
return requestClient.get<Array<SystemTenantPackageApi.SystemTenantPackage>>(
|
||||
'/system/tenant_package/',
|
||||
{
|
||||
params,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建租户
|
||||
* @param data 租户数据
|
||||
*/
|
||||
async function createTenantPackage(
|
||||
data: Omit<SystemTenantPackageApi.SystemTenantPackage, 'id'>,
|
||||
) {
|
||||
return requestClient.post('/system/tenant_package/', data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新租户
|
||||
*
|
||||
* @param id 租户 ID
|
||||
* @param data 租户数据
|
||||
*/
|
||||
async function updateTenantPackage(
|
||||
id: string,
|
||||
data: Omit<SystemTenantPackageApi.SystemTenantPackage, 'id'>,
|
||||
) {
|
||||
return requestClient.put(`/system/tenant_package/${id}/`, data);
|
||||
}
|
||||
/**
|
||||
* 更新租户
|
||||
*
|
||||
* @param id 租户 ID
|
||||
* @param data 租户数据
|
||||
*/
|
||||
async function patchTenantPackage(
|
||||
id: string,
|
||||
data: Omit<SystemTenantPackageApi.SystemTenantPackage, 'id'>,
|
||||
) {
|
||||
return requestClient.patch(`/system/tenant_package/${id}/`, data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除租户
|
||||
* @param id 租户 ID
|
||||
*/
|
||||
async function deleteTenantPackage(id: string) {
|
||||
return requestClient.delete(`/system/tenant_package/${id}/`);
|
||||
}
|
||||
|
||||
export {
|
||||
createTenantPackage,
|
||||
deleteTenantPackage,
|
||||
getTenantPackageList,
|
||||
patchTenantPackage,
|
||||
updateTenantPackage,
|
||||
};
|
||||
71
web/apps/web-ele/src/api/system/tenants.ts
Normal file
71
web/apps/web-ele/src/api/system/tenants.ts
Normal file
@@ -0,0 +1,71 @@
|
||||
import type { Recordable } from '@vben/types';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace SystemTenantsApi {
|
||||
export interface SystemTenants {
|
||||
[key: string]: any;
|
||||
id: string;
|
||||
name: string;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取租户列表数据
|
||||
*/
|
||||
async function getTenantsList(params: Recordable<any>) {
|
||||
return requestClient.get<Array<SystemTenantsApi.SystemTenants>>(
|
||||
'/system/tenants/',
|
||||
{
|
||||
params,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建租户
|
||||
* @param data 租户数据
|
||||
*/
|
||||
async function createTenants(data: Omit<SystemTenantsApi.SystemTenants, 'id'>) {
|
||||
return requestClient.post('/system/tenants/', data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新租户
|
||||
*
|
||||
* @param id 租户 ID
|
||||
* @param data 租户数据
|
||||
*/
|
||||
async function updateTenants(
|
||||
id: string,
|
||||
data: Omit<SystemTenantsApi.SystemTenants, 'id'>,
|
||||
) {
|
||||
return requestClient.put(`/system/tenants/${id}/`, data);
|
||||
}
|
||||
/**
|
||||
* 更新租户
|
||||
*
|
||||
* @param id 租户 ID
|
||||
* @param data 租户数据
|
||||
*/
|
||||
async function patchTenants(
|
||||
id: string,
|
||||
data: Omit<SystemTenantsApi.SystemTenants, 'id'>,
|
||||
) {
|
||||
return requestClient.patch(`/system/tenants/${id}/`, data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除租户
|
||||
* @param id 租户 ID
|
||||
*/
|
||||
async function deleteTenants(id: string) {
|
||||
return requestClient.delete(`/system/tenants/${id}/`);
|
||||
}
|
||||
|
||||
export {
|
||||
createTenants,
|
||||
deleteTenants,
|
||||
getTenantsList,
|
||||
patchTenants,
|
||||
updateTenants,
|
||||
};
|
||||
Reference in New Issue
Block a user