mirror of
https://github.com/soybeanjs/soybean-admin.git
synced 2025-09-17 17:26:38 +08:00
refactor(types): improve namespace migration.
This commit is contained in:
parent
bf9baf0d14
commit
643ccec544
175
src/typings/api.d.ts
vendored
175
src/typings/api.d.ts
vendored
@ -47,179 +47,4 @@ declare namespace Api {
|
|||||||
status: EnableStatus | null;
|
status: EnableStatus | null;
|
||||||
} & T;
|
} & T;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* namespace Auth
|
|
||||||
*
|
|
||||||
* backend api module: "auth"
|
|
||||||
*/
|
|
||||||
namespace Auth {
|
|
||||||
interface LoginToken {
|
|
||||||
token: string;
|
|
||||||
refreshToken: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface UserInfo {
|
|
||||||
userId: string;
|
|
||||||
userName: string;
|
|
||||||
roles: string[];
|
|
||||||
buttons: string[];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* namespace Route
|
|
||||||
*
|
|
||||||
* backend api module: "route"
|
|
||||||
*/
|
|
||||||
namespace Route {
|
|
||||||
type ElegantConstRoute = import('@elegant-router/types').ElegantConstRoute;
|
|
||||||
|
|
||||||
interface MenuRoute extends ElegantConstRoute {
|
|
||||||
id: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface UserRoute {
|
|
||||||
routes: MenuRoute[];
|
|
||||||
home: import('@elegant-router/types').LastLevelRouteKey;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* namespace SystemManage
|
|
||||||
*
|
|
||||||
* backend api module: "systemManage"
|
|
||||||
*/
|
|
||||||
namespace SystemManage {
|
|
||||||
type CommonSearchParams = Pick<Common.PaginatingCommonParams, 'current' | 'size'>;
|
|
||||||
|
|
||||||
/** role */
|
|
||||||
type Role = Common.CommonRecord<{
|
|
||||||
/** role name */
|
|
||||||
roleName: string;
|
|
||||||
/** role code */
|
|
||||||
roleCode: string;
|
|
||||||
/** role description */
|
|
||||||
roleDesc: string;
|
|
||||||
}>;
|
|
||||||
|
|
||||||
/** role search params */
|
|
||||||
type RoleSearchParams = CommonType.RecordNullable<
|
|
||||||
Pick<Api.SystemManage.Role, 'roleName' | 'roleCode' | 'status'> & CommonSearchParams
|
|
||||||
>;
|
|
||||||
|
|
||||||
/** role list */
|
|
||||||
type RoleList = Common.PaginatingQueryRecord<Role>;
|
|
||||||
|
|
||||||
/** all role */
|
|
||||||
type AllRole = Pick<Role, 'id' | 'roleName' | 'roleCode'>;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* user gender
|
|
||||||
*
|
|
||||||
* - "1": "male"
|
|
||||||
* - "2": "female"
|
|
||||||
*/
|
|
||||||
type UserGender = '1' | '2';
|
|
||||||
|
|
||||||
/** user */
|
|
||||||
type User = Common.CommonRecord<{
|
|
||||||
/** user name */
|
|
||||||
userName: string;
|
|
||||||
/** user gender */
|
|
||||||
userGender: UserGender | null;
|
|
||||||
/** user nick name */
|
|
||||||
nickName: string;
|
|
||||||
/** user phone */
|
|
||||||
userPhone: string;
|
|
||||||
/** user email */
|
|
||||||
userEmail: string;
|
|
||||||
/** user role code collection */
|
|
||||||
userRoles: string[];
|
|
||||||
}>;
|
|
||||||
|
|
||||||
/** user search params */
|
|
||||||
type UserSearchParams = CommonType.RecordNullable<
|
|
||||||
Pick<Api.SystemManage.User, 'userName' | 'userGender' | 'nickName' | 'userPhone' | 'userEmail' | 'status'> &
|
|
||||||
CommonSearchParams
|
|
||||||
>;
|
|
||||||
|
|
||||||
/** user list */
|
|
||||||
type UserList = Common.PaginatingQueryRecord<User>;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* menu type
|
|
||||||
*
|
|
||||||
* - "1": directory
|
|
||||||
* - "2": menu
|
|
||||||
*/
|
|
||||||
type MenuType = '1' | '2';
|
|
||||||
|
|
||||||
type MenuButton = {
|
|
||||||
/**
|
|
||||||
* button code
|
|
||||||
*
|
|
||||||
* it can be used to control the button permission
|
|
||||||
*/
|
|
||||||
code: string;
|
|
||||||
/** button description */
|
|
||||||
desc: string;
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* icon type
|
|
||||||
*
|
|
||||||
* - "1": iconify icon
|
|
||||||
* - "2": local icon
|
|
||||||
*/
|
|
||||||
type IconType = '1' | '2';
|
|
||||||
|
|
||||||
type MenuPropsOfRoute = Pick<
|
|
||||||
import('vue-router').RouteMeta,
|
|
||||||
| 'i18nKey'
|
|
||||||
| 'keepAlive'
|
|
||||||
| 'constant'
|
|
||||||
| 'order'
|
|
||||||
| 'href'
|
|
||||||
| 'hideInMenu'
|
|
||||||
| 'activeMenu'
|
|
||||||
| 'multiTab'
|
|
||||||
| 'fixedIndexInTab'
|
|
||||||
| 'query'
|
|
||||||
>;
|
|
||||||
|
|
||||||
type Menu = Common.CommonRecord<{
|
|
||||||
/** parent menu id */
|
|
||||||
parentId: number;
|
|
||||||
/** menu type */
|
|
||||||
menuType: MenuType;
|
|
||||||
/** menu name */
|
|
||||||
menuName: string;
|
|
||||||
/** route name */
|
|
||||||
routeName: string;
|
|
||||||
/** route path */
|
|
||||||
routePath: string;
|
|
||||||
/** component */
|
|
||||||
component?: string;
|
|
||||||
/** iconify icon name or local icon name */
|
|
||||||
icon: string;
|
|
||||||
/** icon type */
|
|
||||||
iconType: IconType;
|
|
||||||
/** buttons */
|
|
||||||
buttons?: MenuButton[] | null;
|
|
||||||
/** children menu */
|
|
||||||
children?: Menu[] | null;
|
|
||||||
}> &
|
|
||||||
MenuPropsOfRoute;
|
|
||||||
|
|
||||||
/** menu list */
|
|
||||||
type MenuList = Common.PaginatingQueryRecord<Menu>;
|
|
||||||
|
|
||||||
type MenuTree = {
|
|
||||||
id: number;
|
|
||||||
label: string;
|
|
||||||
pId: number;
|
|
||||||
children?: MenuTree[];
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
139
src/typings/api/system-manage.d.ts
vendored
Normal file
139
src/typings/api/system-manage.d.ts
vendored
Normal file
@ -0,0 +1,139 @@
|
|||||||
|
declare namespace Api {
|
||||||
|
/**
|
||||||
|
* namespace SystemManage
|
||||||
|
*
|
||||||
|
* backend api module: "systemManage"
|
||||||
|
*/
|
||||||
|
namespace SystemManage {
|
||||||
|
type CommonSearchParams = Pick<Common.PaginatingCommonParams, 'current' | 'size'>;
|
||||||
|
|
||||||
|
/** role */
|
||||||
|
type Role = Common.CommonRecord<{
|
||||||
|
/** role name */
|
||||||
|
roleName: string;
|
||||||
|
/** role code */
|
||||||
|
roleCode: string;
|
||||||
|
/** role description */
|
||||||
|
roleDesc: string;
|
||||||
|
}>;
|
||||||
|
|
||||||
|
/** role search params */
|
||||||
|
type RoleSearchParams = CommonType.RecordNullable<
|
||||||
|
Pick<Api.SystemManage.Role, 'roleName' | 'roleCode' | 'status'> & CommonSearchParams
|
||||||
|
>;
|
||||||
|
|
||||||
|
/** role list */
|
||||||
|
type RoleList = Common.PaginatingQueryRecord<Role>;
|
||||||
|
|
||||||
|
/** all role */
|
||||||
|
type AllRole = Pick<Role, 'id' | 'roleName' | 'roleCode'>;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* user gender
|
||||||
|
*
|
||||||
|
* - "1": "male"
|
||||||
|
* - "2": "female"
|
||||||
|
*/
|
||||||
|
type UserGender = '1' | '2';
|
||||||
|
|
||||||
|
/** user */
|
||||||
|
type User = Common.CommonRecord<{
|
||||||
|
/** user name */
|
||||||
|
userName: string;
|
||||||
|
/** user gender */
|
||||||
|
userGender: UserGender | null;
|
||||||
|
/** user nick name */
|
||||||
|
nickName: string;
|
||||||
|
/** user phone */
|
||||||
|
userPhone: string;
|
||||||
|
/** user email */
|
||||||
|
userEmail: string;
|
||||||
|
/** user role code collection */
|
||||||
|
userRoles: string[];
|
||||||
|
}>;
|
||||||
|
|
||||||
|
/** user search params */
|
||||||
|
type UserSearchParams = CommonType.RecordNullable<
|
||||||
|
Pick<Api.SystemManage.User, 'userName' | 'userGender' | 'nickName' | 'userPhone' | 'userEmail' | 'status'> &
|
||||||
|
CommonSearchParams
|
||||||
|
>;
|
||||||
|
|
||||||
|
/** user list */
|
||||||
|
type UserList = Common.PaginatingQueryRecord<User>;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* menu type
|
||||||
|
*
|
||||||
|
* - "1": directory
|
||||||
|
* - "2": menu
|
||||||
|
*/
|
||||||
|
type MenuType = '1' | '2';
|
||||||
|
|
||||||
|
type MenuButton = {
|
||||||
|
/**
|
||||||
|
* button code
|
||||||
|
*
|
||||||
|
* it can be used to control the button permission
|
||||||
|
*/
|
||||||
|
code: string;
|
||||||
|
/** button description */
|
||||||
|
desc: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* icon type
|
||||||
|
*
|
||||||
|
* - "1": iconify icon
|
||||||
|
* - "2": local icon
|
||||||
|
*/
|
||||||
|
type IconType = '1' | '2';
|
||||||
|
|
||||||
|
type MenuPropsOfRoute = Pick<
|
||||||
|
import('vue-router').RouteMeta,
|
||||||
|
| 'i18nKey'
|
||||||
|
| 'keepAlive'
|
||||||
|
| 'constant'
|
||||||
|
| 'order'
|
||||||
|
| 'href'
|
||||||
|
| 'hideInMenu'
|
||||||
|
| 'activeMenu'
|
||||||
|
| 'multiTab'
|
||||||
|
| 'fixedIndexInTab'
|
||||||
|
| 'query'
|
||||||
|
>;
|
||||||
|
|
||||||
|
type Menu = Common.CommonRecord<{
|
||||||
|
/** parent menu id */
|
||||||
|
parentId: number;
|
||||||
|
/** menu type */
|
||||||
|
menuType: MenuType;
|
||||||
|
/** menu name */
|
||||||
|
menuName: string;
|
||||||
|
/** route name */
|
||||||
|
routeName: string;
|
||||||
|
/** route path */
|
||||||
|
routePath: string;
|
||||||
|
/** component */
|
||||||
|
component?: string;
|
||||||
|
/** iconify icon name or local icon name */
|
||||||
|
icon: string;
|
||||||
|
/** icon type */
|
||||||
|
iconType: IconType;
|
||||||
|
/** buttons */
|
||||||
|
buttons?: MenuButton[] | null;
|
||||||
|
/** children menu */
|
||||||
|
children?: Menu[] | null;
|
||||||
|
}> &
|
||||||
|
MenuPropsOfRoute;
|
||||||
|
|
||||||
|
/** menu list */
|
||||||
|
type MenuList = Common.PaginatingQueryRecord<Menu>;
|
||||||
|
|
||||||
|
type MenuTree = {
|
||||||
|
id: number;
|
||||||
|
label: string;
|
||||||
|
pId: number;
|
||||||
|
children?: MenuTree[];
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user