refactor(projects): refactor page: user-management [重构用户管理页面]

This commit is contained in:
Soybean
2022-09-29 00:24:59 +08:00
parent 88e535f63c
commit 468b4bb0e1
26 changed files with 340 additions and 351 deletions

31
src/typings/api.d.ts vendored
View File

@ -22,34 +22,31 @@ declare namespace ApiRoute {
}
}
declare namespace ApiDemo {
interface DataWithAdapter {
dataId: string;
dataName: string;
}
}
declare namespace ApiUserManagement {
interface UserTable {
interface User {
/** 用户id */
id: string;
/** 用户名 */
name: string;
userName: string | null;
/** 用户年龄 */
age: number;
age: number | null;
/**
* 用户性别
* - 男 1
* - 女 0
* - 0: 女
* - 1: 男
*/
gender: '0' | '1' | null;
/** 用户手机号码 */
phone: string;
/** 用户邮箱 */
email: string;
/** 用户角色 */
role: Auth.RoleType;
/** 是否禁用用户 */
disabled: boolean;
email: string | null;
/**
* 用户状态
* - 1: 启用
* - 2: 禁用
* - 3: 冻结
* - 4: 软删除
*/
userStatus: '1' | '2' | '3' | '4' | null;
}
}

View File

@ -20,77 +20,27 @@ declare namespace Auth {
}
}
declare namespace Demo {
interface DataWithAdapter {
id: string;
name: string;
}
}
/** 系统消息 */
declare namespace Message {
interface Tab {
/** tab的key */
key: number;
/** tab名称 */
name: string;
/** badge类型 */
badgeProps?: import('naive-ui').BadgeProps;
/** 消息数据 */
list: List[];
}
interface List {
/** 数据唯一值 */
id: number;
/** 头像 */
avatar?: string;
/** 消息icon */
icon?: string;
svgIcon?: string;
/** 消息标题 */
title: string;
/** 消息发送时间 */
date?: string;
/** 消息是否已读 */
isRead?: boolean;
/** 消息描述 */
description?: string;
/** 标签名称 */
tagTitle?: string;
/** 标签props */
tagProps?: import('naive-ui').TagProps;
}
}
/** 用户管理 */
declare namespace UserManagement {
/** 用户表格 */
interface UserTable {
interface User extends ApiUserManagement.User {
/** 序号 */
index: number;
/** 数据的key(id) */
/** 表格的keyid */
key: string;
/** 用户id */
id: string;
/** 用户名 */
userName: string;
/** 用户年龄 */
userAge: string;
/**
* 用户性别
* - male 男
* - female 女
*/
userGender: keyof typeof import('@/enum').EnumGender;
userGenderLabel: import('@/enum').EnumGender;
/** 用户手机号 */
userPhone: string;
/** 用户邮箱 */
userEmail: string;
/** 用户角色 */
userRole: Auth.RoleType;
/** 是否禁用用户 */
disabled: boolean;
}
/**
* 用户性别
* - 0: 女
* - 1: 男
*/
type GenderKey = NonNullable<User['gender']>;
/**
* 用户状态
* - 1: 启用
* - 2: 禁用
* - 3: 冻结
* - 4: 软删除
*/
type UserStatusKey = NonNullable<User['userStatus']>;
}

3
src/typings/naive-ui.d.ts vendored Normal file
View File

@ -0,0 +1,3 @@
declare namespace NaiveUI {
type ThemeColor = 'default' | 'error' | 'primary' | 'info' | 'success' | 'warning';
}

View File

@ -72,7 +72,7 @@ declare namespace Service {
/** 多个请求数据结果 */
type MultiRequestResult<T extends any[]> = T extends [infer First, ...infer Rest]
? First extends any
? [First] extends [any]
? Rest extends any[]
? [Service.RequestResult<First>, ...MultiRequestResult<Rest>]
: [Service.RequestResult<First>]
@ -293,3 +293,39 @@ interface GlobalTabRoute
top: number;
};
}
/** 系统消息 */
declare namespace Message {
interface Tab {
/** tab的key */
key: number;
/** tab名称 */
name: string;
/** badge类型 */
badgeProps?: import('naive-ui').BadgeProps;
/** 消息数据 */
list: List[];
}
interface List {
/** 数据唯一值 */
id: number;
/** 头像 */
avatar?: string;
/** 消息icon */
icon?: string;
svgIcon?: string;
/** 消息标题 */
title: string;
/** 消息发送时间 */
date?: string;
/** 消息是否已读 */
isRead?: boolean;
/** 消息描述 */
description?: string;
/** 标签名称 */
tagTitle?: string;
/** 标签props */
tagProps?: import('naive-ui').TagProps;
}
}