refactor(projects): use new elegant-router plugin
This commit is contained in:
70
src/typings/api/common.d.ts
vendored
70
src/typings/api/common.d.ts
vendored
@ -5,46 +5,38 @@
|
||||
*/
|
||||
declare namespace Api {
|
||||
namespace Common {
|
||||
/** common params of paginating */
|
||||
interface PaginatingCommonParams {
|
||||
/** current page number */
|
||||
current: number;
|
||||
/** page size */
|
||||
size: number;
|
||||
/** total count */
|
||||
interface CreatedUpdatedDTO {
|
||||
/** 创建人 */
|
||||
createdBy: string;
|
||||
/** 创建时间 */
|
||||
createdTime: string;
|
||||
/** 更新人 */
|
||||
updatedBy: string;
|
||||
/** 更新时间 */
|
||||
updatedTime: string;
|
||||
}
|
||||
|
||||
interface CommonRecordDTO extends CreatedUpdatedDTO {
|
||||
/** 主键 */
|
||||
id: number;
|
||||
/**
|
||||
* 启用状态 Enable status
|
||||
*
|
||||
* - "1": 启用
|
||||
* - "2": 禁用
|
||||
*/
|
||||
status: Union.EnableStatus | null;
|
||||
}
|
||||
|
||||
interface PaginationQueryDTO {
|
||||
page: number;
|
||||
pageSize: number;
|
||||
sort: string;
|
||||
}
|
||||
|
||||
interface PaginationDTO extends Pick<PaginationQueryDTO, 'page' | 'pageSize'> {
|
||||
/** 总条数 */
|
||||
total: number;
|
||||
}
|
||||
|
||||
/** common params of paginating query list data */
|
||||
interface PaginatingQueryRecord<T = any> extends PaginatingCommonParams {
|
||||
records: T[];
|
||||
}
|
||||
|
||||
/** common search params of table */
|
||||
type CommonSearchParams = Pick<Common.PaginatingCommonParams, 'current' | 'size'>;
|
||||
|
||||
/**
|
||||
* enable status
|
||||
*
|
||||
* - "1": enabled
|
||||
* - "2": disabled
|
||||
*/
|
||||
type EnableStatus = '1' | '2';
|
||||
|
||||
/** common record */
|
||||
type CommonRecord<T = any> = {
|
||||
/** record id */
|
||||
id: number;
|
||||
/** record creator */
|
||||
createBy: string;
|
||||
/** record create time */
|
||||
createTime: string;
|
||||
/** record updater */
|
||||
updateBy: string;
|
||||
/** record update time */
|
||||
updateTime: string;
|
||||
/** record status */
|
||||
status: EnableStatus | null;
|
||||
} & T;
|
||||
}
|
||||
}
|
||||
|
||||
42
src/typings/api/menu.d.ts
vendored
Normal file
42
src/typings/api/menu.d.ts
vendored
Normal file
@ -0,0 +1,42 @@
|
||||
declare namespace Api {
|
||||
namespace Menu {
|
||||
type RouteKey = import('@elegant-router/types').RouteKey;
|
||||
|
||||
interface Menu extends Common.CommonRecordDTO {
|
||||
/** 菜单名称 */
|
||||
name: string;
|
||||
/** 菜单类型 */
|
||||
menuType: Union.MenuType;
|
||||
/** 菜单描述 */
|
||||
description?: string | null;
|
||||
/** 菜单图标 */
|
||||
icon?: string | null;
|
||||
/** 菜单图标类型 */
|
||||
iconType?: string | null;
|
||||
/** 父级菜单ID */
|
||||
parentId?: number | null;
|
||||
/** 菜单排序 */
|
||||
order?: number | null;
|
||||
/** 是否隐藏 */
|
||||
isHidden?: boolean | null;
|
||||
/** iframe 页面URL */
|
||||
iframeUrl?: string | null;
|
||||
/** 链接 */
|
||||
href?: string | null;
|
||||
/** 路由名称 */
|
||||
routeName?: RouteKey | null;
|
||||
/** 路由查询参数 */
|
||||
routeQueries?: Record<string, string | number | boolean> | null;
|
||||
/** 路由路径参数 */
|
||||
routeParams?: Record<string, string | number | boolean> | null;
|
||||
}
|
||||
|
||||
interface MenuListDTO extends Common.PaginationDTO {
|
||||
list: Menu[];
|
||||
}
|
||||
|
||||
interface MenuTreeDTO extends Menu {
|
||||
children?: MenuTreeDTO[];
|
||||
}
|
||||
}
|
||||
}
|
||||
39
src/typings/api/route.d.ts
vendored
39
src/typings/api/route.d.ts
vendored
@ -1,19 +1,34 @@
|
||||
declare namespace Api {
|
||||
/**
|
||||
* namespace Route
|
||||
*
|
||||
* backend api module: "route"
|
||||
*/
|
||||
namespace Route {
|
||||
type ElegantConstRoute = import('@elegant-router/types').ElegantConstRoute;
|
||||
|
||||
interface MenuRoute extends ElegantConstRoute {
|
||||
id: string;
|
||||
interface RouteDTO extends Common.CommonRecordDTO {
|
||||
/** 路由路径 */
|
||||
path: string;
|
||||
/** 路由名称 */
|
||||
name: string;
|
||||
/** 路由布局 */
|
||||
layout: string;
|
||||
/** 路由组件 */
|
||||
component: string;
|
||||
/** 重定向路径 */
|
||||
redirect?: string | null;
|
||||
/** 路由图标 */
|
||||
icon?: string | null;
|
||||
/** 路由图标类型 */
|
||||
iconType?: string | null;
|
||||
/** 是否缓存 */
|
||||
isCache?: boolean | null;
|
||||
/** 是否支持多开 */
|
||||
isMultiple?: boolean | null;
|
||||
/** 固定索引 */
|
||||
fixedIndex?: number | null;
|
||||
/** 是否需要权限 */
|
||||
requireAuth?: boolean | null;
|
||||
/** 路由属性 */
|
||||
props?: Record<string, string | number | boolean> | null;
|
||||
}
|
||||
|
||||
interface UserRoute {
|
||||
routes: MenuRoute[];
|
||||
home: import('@elegant-router/types').LastLevelRouteKey;
|
||||
interface RouteListDTO extends Common.PaginationDTO {
|
||||
list: RouteDTO[];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
31
src/typings/api/union.d.ts
vendored
Normal file
31
src/typings/api/union.d.ts
vendored
Normal file
@ -0,0 +1,31 @@
|
||||
declare namespace Api {
|
||||
namespace Union {
|
||||
/**
|
||||
* 是否 Yes or No
|
||||
*
|
||||
* - "Y": yes
|
||||
* - "N": no
|
||||
*/
|
||||
type YesOrNo = 'Y' | 'N';
|
||||
|
||||
/**
|
||||
* 启用状态 Enable status
|
||||
*
|
||||
* - "1": 启用
|
||||
* - "2": 禁用
|
||||
*/
|
||||
type EnableStatus = '1' | '2';
|
||||
|
||||
/**
|
||||
* 菜单类型
|
||||
*
|
||||
* - "directory": 目录
|
||||
* - "menu": 菜单
|
||||
* - "iframe": iframe 页面(iframe 嵌入页面)
|
||||
* - "link": 链接(跳转外部链接)
|
||||
* - "page": 页面(不展示在菜单中,可用于作为菜单类型的子菜单展示在面包屑中)
|
||||
* - "other": 其他(作用自行定义)
|
||||
*/
|
||||
type MenuType = 'page' | 'directory' | 'menu' | 'iframe' | 'link' | 'other';
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user