gaoluyang
5 天以前 c7566bba45e6f90594d36ec4b80ac4ff89f577ee
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
/**
 * element-ui 字体图标 → @element-plus/icons-vue 组件映射。
 *
 * element-plus 不再内置图标字体,业务代码里 300+ 处 `el-icon-xxx` 因此失效。
 * 这里把用到的旧图标名统一映射到 EP 的 SVG 图标组件,供:
 *   - 模板里 `:icon="$icon('el-icon-search')"`
 *   - `<lims-icon name="el-icon-search"/>`(替换 `<i class="el-icon-search">`)
 * 两处使用。
 *
 * key 同时接受带前缀(`el-icon-plus`)与不带前缀(`plus`)两种写法。
 */
import {
  Plus, Delete, DeleteFilled, Search, Edit, FolderOpened, Folder,
  Upload, UploadFilled, Picture, Tickets, QuestionFilled, Download,
  Close, FullScreen, RefreshRight, RefreshLeft, Refresh, Loading,
  CaretRight, CaretLeft, CaretBottom, CaretTop, View, CircleClose,
  CircleCheck, CircleCheckFilled, CircleCloseFilled, CirclePlus,
  ArrowUp, ArrowDown, ArrowLeft, ArrowRight, Minus, Document,
  DocumentCopy, CopyDocument, Pointer, Sort, SortUp, SortDown,
  Paperclip, Monitor, Menu, Key, InfoFilled, WarningFilled, Warning,
  SuccessFilled, DArrowRight, DArrowLeft, User, UserFilled, Unlock,
  Lock, Clock, Timer, AlarmClock, Tools, Operation, HomeFilled, Coin,
  Flag, ChatDotRound, Goods, Shop, Promotion, Management, Select,
  Ticket, HelpFilled, List, Platform, Setting, Right, Back, Top,
  Bottom, Remove, RemoveFilled, Box, PieChart, Odometer, Cellphone,
  Link, Cpu, Collection, CollectionTag, Coffee, Bell, Message,
  Comment, Notebook, Files, FolderDelete, FolderAdd, PriceTag,
  Discount, ShoppingCart, ShoppingCartFull, ShoppingBag, Sell,
  SoldOut, Present, TakeawayBox, Refrigerator, Dish, Food, IceCream,
  Apple, Goblet, Calendar, Position, Location, Connection, Guide,
  Star, VideoCamera, Camera, DataLine, TrendCharts, Histogram, Rank,
  Film, Headset, Microphone, Printer, ScaleToOriginal, Compass,
  Coordinate, Crop, Brush, MagicStick, Stamp
} from '@element-plus/icons-vue'
 
const ICON_MAP = {
  // 基础操作
  plus: Plus,
  delete: Delete,
  'delete-solid': DeleteFilled,
  search: Search,
  edit: Edit,
  close: Close,
  minus: Minus,
  remove: RemoveFilled,
  'remove-outline': Remove,
  check: Select,
  refresh: Refresh,
  'refresh-right': RefreshRight,
  'refresh-left': RefreshLeft,
  loading: Loading,
  sort: Sort,
  'sort-up': SortUp,
  'sort-down': SortDown,
  'full-screen': FullScreen,
 
  // 文件夹 / 文档
  folder: Folder,
  'folder-opened': FolderOpened,
  'folder-add': FolderAdd,
  'folder-delete': FolderDelete,
  tickets: Tickets,
  document: Document,
  'document-copy': DocumentCopy,
  'copy-document': CopyDocument,
  notebook: Notebook,
  files: Files,
  collection: Collection,
  'collection-tag': CollectionTag,
  paperclip: Paperclip,
 
  // 上传 / 下载 / 图片
  upload: UploadFilled,
  upload2: Upload,
  download: Download,
  'picture-outline': Picture,
  picture: Picture,
  camera: Camera,
  'video-camera': VideoCamera,
  'scale-to-original': ScaleToOriginal,
 
  // 方向
  'arrow-up': ArrowUp,
  'arrow-down': ArrowDown,
  'arrow-left': ArrowLeft,
  'arrow-right': ArrowRight,
  'caret-top': CaretTop,
  'caret-bottom': CaretBottom,
  'caret-left': CaretLeft,
  'caret-right': CaretRight,
  'd-arrow-left': DArrowLeft,
  'd-arrow-right': DArrowRight,
  top: Top,
  bottom: Bottom,
  back: Back,
  right: Right,
 
  // 状态 / 提示
  info: InfoFilled,
  question: QuestionFilled,
  warning: WarningFilled,
  'warning-outline': Warning,
  success: SuccessFilled,
  'circle-check': CircleCheck,
  'circle-check-outline': CircleCheckFilled,
  'circle-close': CircleClose,
  'circle-close-outline': CircleCloseFilled,
  'circle-plus': CirclePlus,
  'circle-plus-outline': CirclePlus,
 
  // 用户 / 权限
  user: User,
  'user-solid': UserFilled,
  view: View,
  unlock: Unlock,
  lock: Lock,
  key: Key,
 
  // 时间
  time: Clock,
  clock: Clock,
  timer: Timer,
  'alarm-clock': AlarmClock,
  calendar: Calendar,
  date: Calendar,
 
  // 系统 / 工具
  setting: Setting,
  's-tools': Tools,
  's-operation': Operation,
  's-home': HomeFilled,
  's-data': Coin,
  's-flag': Flag,
  's-comment': ChatDotRound,
  's-goods': Goods,
  's-shop': Shop,
  's-marketing': Promotion,
  's-promotion': Promotion,
  's-management': Management,
  's-check': Select,
  's-claim': Ticket,
  's-help': HelpFilled,
  's-order': List,
  's-platform': Platform,
  's-release': Promotion,
  's-ticket': Ticket,
  's-custom': Setting,
  monitor: Monitor,
  menu: Menu,
  link: Link,
  cpu: Cpu,
  mobile: Cellphone,
  headset: Headset,
  microphone: Microphone,
  printer: Printer,
  bell: Bell,
  message: Message,
  comment: Comment,
  guide: Guide,
  compass: Compass,
  coordinate: Coordinate,
  crop: Crop,
  brush: Brush,
  'magic-stick': MagicStick,
  stamp: Stamp,
  connection: Connection,
  position: Position,
  location: Location,
  'map-location': Location,
 
  // 图表
  'pie-chart': PieChart,
  'data-line': DataLine,
  'trend-charts': TrendCharts,
  histogram: Histogram,
  rank: Rank,
  odometer: Odometer,
  film: Film,
 
  // 业务 / 商品
  goods: Goods,
  'shopping-cart': ShoppingCart,
  'shopping-cart-full': ShoppingCartFull,
  'shopping-bag': ShoppingBag,
  sell: Sell,
  'sold-out': SoldOut,
  present: Present,
  'price-tag': PriceTag,
  discount: Discount,
  box: Box,
  'takeaway-box': TakeawayBox,
  refrigerator: Refrigerator,
  dish: Dish,
  food: Food,
  'ice-cream': IceCream,
  apple: Apple,
  goblet: Goblet,
  coffee: Coffee,
  'coffee-cup': Coffee,
  receiving: TakeawayBox,
  thumb: Pointer,
  star: Star
}
 
/**
 * 按旧图标名取 EP 图标组件,取不到返回 null(渲染为空,不抛错)。
 * @param {string} name 例如 'el-icon-search' 或 'search'
 * @returns {Object|null} EP 图标组件
 */
export function getLimsIcon(name) {
  if (!name) return null
  const key = String(name).replace(/^el-icon-/, '')
  const icon = ICON_MAP[key]
  if (!icon && import.meta.env.DEV) {
    console.warn(`[lims-icon] 未映射的图标:${name},请在 src/utils/lims-icon.js 中补充`)
  }
  return icon || null
}
 
export { ICON_MAP }
export default getLimsIcon