PayrollManagementSystem/frontend/src/components/layout/menuIcons.ts
liuwenxin 8e8bcaa5fb feat(frontend): 视觉规范 v4 全站落地与实测修复
token 补齐与 EP 形体基准、全站版式工具类(.page-head/.card 系/.filter-bar/.ys-pill 等)、布局与登录页、工作台 Bento 与图表主题、打印稿纸、全部业务页统一到全局类;StatusTag 改 pill、AppPagination 加 background。

浏览器实测修复:表格行高收到 1.5;月结生命周期条圆点按阶段着色并加操作提示;工作台空态垂直居中;状态/结果列宽按胶囊内容给足(96/108/120),消除 Element Plus 省略号伪『小点』。设计稿反向同步圆点着色与流程条提示。
2026-10-23 09:58:48 +08:00

73 lines
2.0 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import type { Component } from 'vue'
import {
Avatar,
Box,
Briefcase,
Calendar,
DataLine,
Histogram,
House,
Management,
Money,
Notebook,
OfficeBuilding,
PieChart,
Postcard,
SetUp,
Shop,
Stamp,
Star,
Tickets,
TrendCharts,
User,
Van,
} from '@element-plus/icons-vue'
/**
* 菜单图标注册表。
*
* **路由只写语义 key(meta.icon),不直接引用图标组件**:路由表保持轻量、
* 序列化,图标实现换库或换风格时只改本文件,路由与菜单组件不动。
*
* 具名导入(不用 `import * as`)以保证摇树 —— 整包引入会把 200+ 图标打进
* 产物。注册表里多余的图标同样会被摇掉,但会让「用了哪些」难以核对,
* 只保留实际用到的。
*
* **全部取线性(outline)图标,不用 *-filled 变体**:侧栏同一层级混用实心与
* 线性图标会让菜单看着不是一套语汇(设计稿 §04 的图标族:16px 线性)。
* 首页用 House(线性房屋)而非 HomeFilled,人员管理用 Postcard(人员档案卡)
* 而非 UserFilled —— 用户管理已占 User,人员改用档案卡以免两个「人」撞形。
*/
const ICONS = {
home: House,
users: User,
roles: Avatar,
'business-roles': Management,
params: SetUp,
settings: OfficeBuilding,
approvals: Stamp,
logs: Tickets,
personnel: Postcard,
products: Box,
customers: Shop,
businesses: Briefcase,
shipments: Van,
receipts: Money,
rating: Star,
ledger: Notebook,
settlements: Calendar,
'report-personal': DataLine,
'report-department': Histogram,
'report-business': TrendCharts,
'report-payment': PieChart,
} satisfies Record<string, Component>
/** 菜单图标的语义 key(路由 meta.icon 的取值范围)。 */
export type MenuIconName = keyof typeof ICONS
/** 按语义 key 取图标;未配置时返回 undefined(菜单项只显示文字)。 */
export function menuIcon(name?: string): Component | undefined {
return name ? (ICONS[name as MenuIconName] ?? undefined) : undefined
}