初始化

This commit is contained in:
2026-03-26 20:18:20 +08:00
commit 120a5b4dfd
368 changed files with 35926 additions and 0 deletions

20
src/typings/api/auth.d.ts vendored Normal file
View File

@@ -0,0 +1,20 @@
declare namespace Api {
/**
* namespace Auth
*
* backend api module: "auth"
*/
namespace Auth {
interface LoginToken {
token: string;
refreshToken: string;
}
interface UserInfo {
userId: string;
userName: string;
roles: string[];
buttons: string[];
}
}
}

50
src/typings/api/common.d.ts vendored Normal file
View File

@@ -0,0 +1,50 @@
/**
* Namespace Api
*
* All backend api type
*/
declare namespace Api {
namespace Common {
/** common params of paginating */
interface PaginatingCommonParams {
/** current page number */
current: number;
/** page size */
size: number;
/** total count */
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 | undefined;
} & T;
}
}

72
src/typings/api/dict.d.ts vendored Normal file
View File

@@ -0,0 +1,72 @@
declare namespace Api {
/**
* namespace Dict
*
* backend api module: "dict"
*/
namespace Dict {
type DictStatus = 0 | 1;
interface PageParams {
pageNo: number;
pageSize: number;
}
interface PageResult<T = any> {
total: number;
list: T[];
}
/** dict type */
interface DictType {
/** dict type id */
id: number;
/** dict name */
name: string;
/** dict type code */
type: string;
/** status: 0 enabled, 1 disabled */
status: DictStatus;
/** remark */
remark?: string | null;
/** create time */
createTime: number;
}
/** dict type search params */
type DictTypeSearchParams = CommonType.RecordNullable<Pick<DictType, 'name' | 'type' | 'status'>> & PageParams;
/** dict type save params */
type SaveDictTypeParams = Pick<DictType, 'name' | 'type' | 'status'> & {
remark?: string | null;
};
/** dict data */
interface DictData {
/** dict data id */
id: number;
/** dict label */
label: string;
/** dict value */
value: string;
/** dict type code */
dictType: string;
/** display order */
sort: number;
/** status: 0 enabled, 1 disabled */
status: DictStatus;
/** remark */
remark?: string | null;
/** create time */
createTime: number;
}
/** dict data search params */
type DictDataSearchParams = CommonType.RecordNullable<Pick<DictData, 'label' | 'dictType' | 'status'>> & PageParams;
/** dict data save params */
type SaveDictDataParams = Pick<DictData, 'label' | 'value' | 'dictType' | 'sort' | 'status'> & {
remark?: string | null;
};
}
}

20
src/typings/api/route.d.ts vendored Normal file
View File

@@ -0,0 +1,20 @@
declare namespace Api {
/**
* namespace Route
*
* backend api module: "route"
*/
namespace Route {
type ElegantConstRoute = import('@elegant-router/types').ElegantConstRoute;
interface MenuRoute extends Omit<ElegantConstRoute, 'children'> {
id: string;
children?: MenuRoute[];
}
interface UserRoute {
routes: MenuRoute[];
home: import('@elegant-router/types').LastLevelRouteKey;
}
}
}

298
src/typings/api/system-manage.d.ts vendored Normal file
View File

@@ -0,0 +1,298 @@
declare namespace Api {
/**
* namespace SystemManage
*
* backend api module: "system"
*/
namespace SystemManage {
type CommonStatus = 0 | 1;
interface PageParams {
pageNo: number;
pageSize: number;
}
interface PageResult<T = any> {
total: number;
list: T[];
}
type RoleType = 1 | 2;
interface Role {
/** role id */
id: number;
/** role name */
name: string;
/** role code */
code: string;
/** display sort */
sort: number;
/** status: 0 enabled, 1 disabled */
status: CommonStatus;
/** role type */
type: RoleType;
/** remark */
remark?: string | null;
/** create time */
createTime: number;
}
type RoleSearchParams = CommonType.RecordNullable<Pick<Role, 'name' | 'code' | 'status'>> &
PageParams & {
createTime?: string[];
};
type SaveRoleParams = Pick<Role, 'name' | 'code' | 'sort' | 'status'> & {
remark?: string | null;
};
type RoleList = PageResult<Role>;
/**
* keep the legacy fields for the user page until it is migrated
*/
type AllRole = RoleSimple & {
roleName: string;
roleCode: string;
};
type DeptOrgType = 'company' | 'dept' | 'direction' | 'team';
interface Dept {
id: number;
name: string;
parentId: number;
orgType: DeptOrgType;
path?: string | null;
level?: number | null;
code?: string | null;
sort?: number | null;
status: CommonStatus;
createTime?: number | null;
children?: Dept[] | null;
}
interface DeptSimple {
id: number;
name: string;
parentId: number;
children?: DeptSimple[] | null;
}
type DeptList = Dept[];
type DeptSimpleList = DeptSimple[];
type DeptSearchParams = CommonType.RecordNullable<Pick<Dept, 'name' | 'orgType' | 'status'>>;
type SaveDeptParams = Pick<Dept, 'name' | 'parentId' | 'orgType' | 'code' | 'sort' | 'status'>;
interface OrgLeaderRelation {
id: number;
deptId: number;
userId: number;
userNickname: string;
effectiveFrom?: number | null;
effectiveUntil?: number | null;
remark?: string | null;
createTime?: number | null;
updateTime?: number | null;
}
type OrgLeaderRelationList = OrgLeaderRelation[];
interface OrgLeaderCandidateUser {
id: number;
nickname: string;
deptId: number;
deptName?: string | null;
}
type OrgLeaderCandidateUserList = OrgLeaderCandidateUser[];
type SaveOrgLeaderRelationParams = {
deptId: number;
userId: number;
effectiveFrom?: number | null;
effectiveUntil?: number | null;
remark?: string | null;
};
type UserGender = 0 | 1 | 2;
interface User {
id: number;
username: string;
nickname?: string | null;
remark?: string | null;
deptId: number;
deptName?: string | null;
positionId?: number | null;
positionName?: string | null;
email?: string | null;
mobile?: string | null;
sex?: UserGender | null;
avatar?: string | null;
status: CommonStatus;
loginIp?: string | null;
resignedAt?: number | null;
loginDate?: number | null;
createTime: number;
}
type UserSearchParams = CommonType.RecordNullable<
Pick<User, 'status'> &
Pick<PageParams, 'pageNo' | 'pageSize'> & {
username?: string;
mobile?: string;
deptId?: number;
roleId?: number;
}
>;
type UserList = PageResult<User>;
type SaveUserParams = Pick<User, 'username' | 'deptId'> & {
nickname?: string | null;
remark?: string | null;
positionId?: number | null;
resignedAt?: number | null;
email?: string | null;
mobile?: string | null;
sex?: UserGender | null;
avatar?: string | null;
password?: string;
};
interface UpdateUserStatusParams {
id: number;
status: CommonStatus;
}
interface UpdateUserPasswordParams {
id: number;
password: string;
}
type PostType = 'management' | 'technical' | 'business';
interface PostSimple {
id: number;
name: string;
code?: string | null;
postType?: PostType | null;
levelRank?: number | null;
sort?: number | null;
}
type PostSimpleList = PostSimple[];
type RoleSimple = Pick<Role, 'id' | 'name' | 'code' | 'status' | 'sort'>;
type RoleSimpleList = RoleSimple[];
interface AssignUserRoleParams {
userId: number;
roleIds: number[];
}
/**
* menu type
*
* - 1: directory
* - 2: menu
* - 3: button
*/
type MenuType = 1 | 2 | 3;
/**
* menu route kind
*
* - dir: directory route
* - view: normal page route
* - single: top level single page
* - iframe: iframe page
* - external: external link
* - redirect: redirect route
*/
type MenuRouteKind = 'dir' | 'view' | 'single' | 'iframe' | 'external' | 'redirect';
interface Menu {
/** menu id */
id: number;
/** menu name */
name: string;
/** permission code */
permission?: string | null;
/** menu type */
type: MenuType;
/** display sort */
sort: number;
/** parent menu id */
parentId: number;
/** route path */
path?: string | null;
/** menu icon */
icon?: string | null;
/** component path */
component?: string | null;
/** component name */
componentName?: string | null;
/** route kind */
routeKind?: MenuRouteKind | null;
/** route props json */
routePropsJson?: string | null;
/** status: 0 enabled, 1 disabled */
status: CommonStatus;
/** visible in menu */
visible?: boolean | null;
/** keep alive */
keepAlive?: boolean | null;
/** always show children */
alwaysShow?: boolean | null;
/** create time */
createTime: number;
/** frontend tree children */
children?: Menu[] | null;
}
type MenuSearchParams = CommonType.RecordNullable<Pick<Menu, 'name' | 'status'>>;
type SaveMenuParams = Pick<
Menu,
| 'name'
| 'permission'
| 'type'
| 'sort'
| 'parentId'
| 'path'
| 'icon'
| 'component'
| 'componentName'
| 'routeKind'
| 'routePropsJson'
| 'status'
| 'visible'
| 'keepAlive'
| 'alwaysShow'
>;
interface MenuSimple {
id: number;
name: string;
parentId: number;
type: MenuType;
children?: MenuSimple[] | null;
}
type MenuList = Menu[];
type MenuSimpleList = MenuSimple[];
interface AssignRoleMenuParams {
roleId: number;
menuIds: number[];
}
}
}