feat: 新增菜单管理页面

This commit is contained in:
xlsea
2024-09-03 12:19:57 +08:00
parent 89f5e8577e
commit 8ab7ee2268
130 changed files with 1797 additions and 103 deletions

View File

@ -24,13 +24,29 @@ declare namespace Api {
type CommonSearchParams = Pick<Common.PaginatingCommonParams, 'pageNum' | 'pageSize'>;
/**
* enable status
* 启用状态
*
* - "0": enabled
* - "1": disabled
* - "0": 正常
* - "1": 停用
*/
type EnableStatus = '0' | '1';
/**
* 显示状态
*
* - "0": 显示
* - "1": 隐藏
*/
type VisibleStatus = '0' | '1';
/**
* 是否状态
*
* - "0": 是
* - "1": 否
*/
type YesOrNoStatus = '0' | '1';
/** common record */
type CommonRecord<T = any> = {
/** record creator */
@ -44,6 +60,12 @@ declare namespace Api {
/** record update time */
updateTime: string;
} & T;
type CommonTenantRecord<T = any> = {
/** record tenant id */
tenantId: string;
} & CommonRecord &
T;
}
/**
@ -52,52 +74,80 @@ declare namespace Api {
* backend api module: "auth"
*/
namespace Auth {
interface LoginData {
/** base login form */
interface LoginForm {
/** 客户端 ID */
clientId?: string;
/** 授权类型 */
grantType?: string;
/** 租户ID */
tenantId?: string;
username?: string;
password?: string;
rememberMe?: boolean;
socialCode?: string;
socialState?: string;
source?: string;
/** 验证码 */
code?: string;
/** 唯一标识 */
uuid?: string;
clientId: string;
grantType: string;
}
type LoginForm = Pick<LoginData, 'tenantId' | 'username' | 'password' | 'rememberMe' | 'code' | 'uuid'>;
/** password login form */
interface PwdLoginForm extends LoginForm {
/** 用户名 */
username?: string;
/** 密码 */
password?: string;
}
/** login token data */
interface LoginToken {
access_token: string;
client_id: string;
expire_in: number;
openid: string;
refresh_expire_in: number;
refresh_token: string;
scope: string;
/** 授权令牌 */
access_token?: string;
/** 应用id */
client_id?: string;
/** 授权令牌 access_token 的有效期 */
expire_in?: number;
/** 用户 openid */
openid?: string;
/** 刷新令牌 refresh_token 的有效期 */
refresh_expire_in?: number;
/** 刷新令牌 */
refresh_token?: string;
/** 令牌权限 */
scope?: string;
}
/** userinfo */
interface UserInfo {
/** 用户信息 */
user?: Api.System.User;
/** 角色权限 */
roles: string[];
/** 菜单权限 */
permissions: string[];
}
/** tenant */
interface Tenant {
/** 企业名称 */
companyName: string;
/** 域名 */
domain: string;
/** 租户编号 */
tenantId: string;
}
interface TenantList {
/** login tenant */
interface LoginTenant {
/** 租户开关 */
tenantEnabled: boolean;
/** 租户列表 */
voList: Tenant[];
}
interface CaptchaCode {
/** 是否开启验证码 */
captchaEnabled: boolean;
/** 唯一标识 */
uuid?: string;
/** 验证码图片 */
img?: string;
}
}

View File

@ -14,7 +14,7 @@ declare namespace Api {
/** role */
type Role = Common.CommonRecord<{
roleId: string | number;
roleId: CommonType.IdType;
roleName: string;
roleKey: string;
roleSort: number;
@ -25,8 +25,8 @@ declare namespace Api {
delFlag: string;
remark?: any;
flag: boolean;
menuIds?: Array<string | number>;
deptIds?: Array<string | number>;
menuIds?: Array<CommonType.IdType>;
deptIds?: Array<CommonType.IdType>;
admin: boolean;
}>;
@ -50,27 +50,37 @@ declare namespace Api {
type UserGender = '1' | '2';
/** user */
type User = Common.CommonRecord<{
userId: string | number;
deptId: number;
userName: string;
nickName: string;
userType: string;
email: string;
phonenumber: string;
sex: string;
avatar: string;
status: string;
delFlag: string;
loginIp: string;
loginDate: string;
remark: string;
deptName: string;
roles: Role[];
roleIds: any;
postIds: any;
roleId: any;
admin: boolean;
type User = Common.CommonTenantRecord<{
/** 用户ID */
userId?: CommonType.IdType;
/** 部门ID */
deptId?: CommonType.IdType;
/** 用户账号 */
userName?: string;
/** 用户昵称 */
nickName?: string;
/** 用户类型sys_user系统用户 */
userType?: string;
/** 用户邮箱 */
email?: string;
/** 手机号码 */
phonenumber?: string;
/** 用户性别0男 1女 2未知 */
sex?: string;
/** 头像地址 */
avatar?: number;
/** 密码 */
password?: string;
/** 帐号状态0正常 1停用 */
status?: string;
/** 删除标志0代表存在 2代表删除 */
delFlag?: string;
/** 最后登录IP */
loginIp?: string;
/** 最后登录时间 */
loginDate?: Date;
/** 备注 */
remark?: string;
}>;
/** user search params */
@ -81,6 +91,48 @@ declare namespace Api {
/** user list */
type UserList = Common.PaginatingQueryRecord<User>;
/** tenant */
interface Tenant {
/** id */
id?: CommonType.IdType;
/** 租户编号 */
tenantId?: string;
/** 联系人 */
contactUserName?: string;
/** 联系电话 */
contactPhone?: string;
/** 企业名称 */
companyName?: string;
/** 统一社会信用代码 */
licenseNumber?: string;
/** 地址 */
address?: string;
/** 域名 */
domain?: string;
/** 企业简介 */
intro?: string;
/** 备注 */
remark?: string;
/** 租户套餐编号 */
packageId?: number;
/** 过期时间 */
expireTime?: Date;
/** 用户数量(-1不限制 */
accountCount?: number;
/** 租户状态0正常 1停用 */
status?: string;
/** 删除标志0代表存在 2代表删除 */
delFlag: string;
}
/**
* icon type
*
* - "1": iconify icon
* - "2": local icon
*/
type IconType = '1' | '2';
/**
* menu type
*
@ -90,34 +142,67 @@ declare namespace Api {
*/
type MenuType = 'M' | 'C' | 'F';
type Menu = Common.CommonRecord<
{
parentName: string;
parentId: string | number;
children: Menu[];
menuId: string | number;
menuName: string;
orderNum: number;
path: string;
component: string;
queryParam: string;
isFrame: string;
isCache: string;
menuType: MenuType;
visible: string;
status: Common.EnableStatus;
perms: string;
icon: string;
componentInfo: string;
remark: string;
keywords?: string;
} & Pick<import('vue-router').RouteMeta, 'i18nKey'>
>;
type Menu = Common.CommonRecord<{
/** 菜单 ID */
menuId?: CommonType.IdType;
/** 父菜单 ID */
parentId?: CommonType.IdType;
/** 菜单名称 */
menuName?: string;
/** 显示顺序 */
orderNum?: number;
/** 路由地址 */
path?: string;
/** 组件路径 */
component?: string;
/** 路由参数 */
queryParam?: string;
/** 是否为外链0是 1否 */
isFrame?: Common.YesOrNoStatus;
/** 是否缓存0缓存 1不缓存 */
isCache?: Common.YesOrNoStatus;
/** 菜单类型M目录 C菜单 F按钮 */
menuType?: MenuType;
/** 显示状态0显示 1隐藏 */
visible?: Common.VisibleStatus;
/** 菜单状态0正常 1停用 */
status?: Common.EnableStatus;
/** 权限标识 */
perms?: string;
/** 菜单图标 */
icon?: string;
/** 备注 */
remark?: string;
/** 父菜单名称 */
parentName?: string;
/** 子菜单 */
children?: Menu[];
}>;
/** menu list */
type MenuList = Common.PaginatingQueryRecord<Menu>;
type MenuList = Menu[];
type MenuSearchParams = CommonType.RecordNullable<Pick<Api.System.Menu, 'menuName' | 'status' | 'keywords'>> &
CommonSearchParams;
/** menu search params */
type MenuSearchParams = CommonType.RecordNullable<Pick<Menu, 'menuName' | 'status' | 'menuType' | 'parentId'>>;
/** menu operate params */
type MenuOperateParams = Pick<
Menu,
| 'menuId'
| 'menuName'
| 'parentId'
| 'orderNum'
| 'path'
| 'component'
| 'queryParam'
| 'isFrame'
| 'isCache'
| 'menuType'
| 'visible'
| 'status'
| 'perms'
| 'icon'
| 'remark'
>;
}
}

View File

@ -300,6 +300,7 @@ declare namespace App {
columnSetting: string;
config: string;
confirm: string;
save: string;
delete: string;
deleteSuccess: string;
confirmDelete: string;

View File

@ -22,4 +22,7 @@ declare namespace CommonType {
type RecordNullable<T> = {
[K in keyof T]?: T[K] | null;
};
/** The id type */
type IdType = string | number;
}

View File

@ -9,6 +9,7 @@ declare module 'vue' {
export interface GlobalComponents {
AppProvider: typeof import('./../components/common/app-provider.vue')['default']
BetterScroll: typeof import('./../components/custom/better-scroll.vue')['default']
BooleanTag: typeof import('./../components/common/boolean-tag.vue')['default']
ButtonIcon: typeof import('./../components/custom/button-icon.vue')['default']
CountTo: typeof import('./../components/custom/count-to.vue')['default']
DarkModeContainer: typeof import('./../components/common/dark-mode-container.vue')['default']
@ -21,9 +22,11 @@ declare module 'vue' {
IconGridiconsFullscreenExit: typeof import('~icons/gridicons/fullscreen-exit')['default']
'IconIc:roundPlus': typeof import('~icons/ic/round-plus')['default']
IconIcRoundDelete: typeof import('~icons/ic/round-delete')['default']
IconIcRoundEdit: typeof import('~icons/ic/round-edit')['default']
IconIcRoundPlus: typeof import('~icons/ic/round-plus')['default']
IconIcRoundRefresh: typeof import('~icons/ic/round-refresh')['default']
IconIcRoundRemove: typeof import('~icons/ic/round-remove')['default']
IconIcRoundSave: typeof import('~icons/ic/round-save')['default']
IconIcRoundSearch: typeof import('~icons/ic/round-search')['default']
IconLocalBanner: typeof import('~icons/local/banner')['default']
IconLocalLogo: typeof import('~icons/local/logo')['default']
@ -43,6 +46,8 @@ declare module 'vue' {
NButton: typeof import('naive-ui')['NButton']
NCard: typeof import('naive-ui')['NCard']
NCheckbox: typeof import('naive-ui')['NCheckbox']
NCollapse: typeof import('naive-ui')['NCollapse']
NCollapseItem: typeof import('naive-ui')['NCollapseItem']
NColorPicker: typeof import('naive-ui')['NColorPicker']
NDataTable: typeof import('naive-ui')['NDataTable']
NDescriptions: typeof import('naive-ui')['NDescriptions']
@ -59,9 +64,14 @@ declare module 'vue' {
NFormItemGi: typeof import('naive-ui')['NFormItemGi']
NGi: typeof import('naive-ui')['NGi']
NGrid: typeof import('naive-ui')['NGrid']
NGridItem: typeof import('naive-ui')['NGridItem']
NInput: typeof import('naive-ui')['NInput']
NInputGroup: typeof import('naive-ui')['NInputGroup']
NInputGroupLabel: typeof import('naive-ui')['NInputGroupLabel']
NInputNumber: typeof import('naive-ui')['NInputNumber']
NLayout: typeof import('naive-ui')['NLayout']
NLayoutContent: typeof import('naive-ui')['NLayoutContent']
NLayoutSider: typeof import('naive-ui')['NLayoutSider']
NList: typeof import('naive-ui')['NList']
NListItem: typeof import('naive-ui')['NListItem']
NLoadingBarProvider: typeof import('naive-ui')['NLoadingBarProvider']
@ -72,6 +82,7 @@ declare module 'vue' {
NPopconfirm: typeof import('naive-ui')['NPopconfirm']
NPopover: typeof import('naive-ui')['NPopover']
NRadio: typeof import('naive-ui')['NRadio']
NRadioButton: typeof import('naive-ui')['NRadioButton']
NRadioGroup: typeof import('naive-ui')['NRadioGroup']
NScrollbar: typeof import('naive-ui')['NScrollbar']
NSelect: typeof import('naive-ui')['NSelect']
@ -85,16 +96,19 @@ declare module 'vue' {
NThing: typeof import('naive-ui')['NThing']
NTooltip: typeof import('naive-ui')['NTooltip']
NTree: typeof import('naive-ui')['NTree']
NTreeSelect: typeof import('naive-ui')['NTreeSelect']
NWatermark: typeof import('naive-ui')['NWatermark']
PinToggler: typeof import('./../components/common/pin-toggler.vue')['default']
ReloadButton: typeof import('./../components/common/reload-button.vue')['default']
RouterLink: typeof import('vue-router')['RouterLink']
RouterView: typeof import('vue-router')['RouterView']
SoybeanAvatar: typeof import('./../components/custom/soybean-avatar.vue')['default']
StatusTag: typeof import('./../components/common/status-tag.vue')['default']
SvgIcon: typeof import('./../components/custom/svg-icon.vue')['default']
SystemLogo: typeof import('./../components/common/system-logo.vue')['default']
TableColumnSetting: typeof import('./../components/advanced/table-column-setting.vue')['default']
TableHeaderOperation: typeof import('./../components/advanced/table-header-operation.vue')['default']
TableSiderLayout: typeof import('./../components/advanced/table-sider-layout.vue')['default']
ThemeSchemaSwitch: typeof import('./../components/common/theme-schema-switch.vue')['default']
WaveBg: typeof import('./../components/custom/wave-bg.vue')['default']
}

View File

@ -23,6 +23,8 @@ declare module "@elegant-router/types" {
"home": "/home";
"iframe-page": "/iframe-page/:url";
"login": "/login/:module(pwd-login|code-login|register|reset-pwd|bind-wechat)?";
"system": "/system";
"system_menu": "/system/menu";
};
/**
@ -60,6 +62,7 @@ declare module "@elegant-router/types" {
| "home"
| "iframe-page"
| "login"
| "system"
>;
/**
@ -82,6 +85,7 @@ declare module "@elegant-router/types" {
| "iframe-page"
| "login"
| "home"
| "system_menu"
>;
/**

View File

@ -30,6 +30,8 @@ declare namespace NaiveUI {
params: R
) => Promise<FlatResponseData<Api.Common.PaginatingQueryRecord<T>>>;
type TreeTableApiFn<T = any, R = Record<string, any>> = (params: R) => Promise<FlatResponseData<T[]>>;
/**
* the type of table operation
*
@ -40,6 +42,8 @@ declare namespace NaiveUI {
type GetTableData<A extends TableApiFn> = A extends TableApiFn<infer T> ? T : never;
type GetTreeTableData<A extends TreeTableApiFn> = A extends TreeTableApiFn<infer T> ? T : never;
type NaiveTableConfig<A extends TableApiFn> = Pick<
import('@sa/hooks').TableConfig<A, GetTableData<A>, TableColumn<TableDataWithIndex<GetTableData<A>>>>,
'apiFn' | 'apiParams' | 'columns' | 'immediate'
@ -51,4 +55,9 @@ declare namespace NaiveUI {
*/
showTotal?: boolean;
};
type NaiveTreeTableConfig<A extends TreeTableApiFn> = Pick<
import('@sa/hooks').TableConfig<A, GetTreeTableData<A>, TableColumn<TableDataWithIndex<GetTreeTableData<A>>>>,
'apiFn' | 'apiParams' | 'columns' | 'immediate'
>;
}