xto-fronted 0.4.52 → 0.4.53

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,2834 @@
1
+ import { ref as k, computed as w, watch as Ae, defineComponent as ee, openBlock as i, createElementBlock as d, normalizeClass as B, createElementVNode as e, withDirectives as et, toDisplayString as C, unref as a, vShow as mt, createCommentVNode as P, createVNode as g, withCtx as S, Fragment as K, renderList as H, createBlock as F, createTextVNode as de, onMounted as Pe, onUnmounted as Oe, vModelText as pt, Transition as Le, withModifiers as Te, normalizeStyle as ke, resolveComponent as vt, reactive as Ve, withKeys as _t } from "vue";
2
+ import { defineStore as Ne } from "pinia";
3
+ import { useRoute as me, useRouter as ne, createRouter as Fe, createWebHistory as Be } from "vue-router";
4
+ import { Menu as Ke, SubMenu as tt, MenuItem as we, Tabs as ht, TabPane as ft } from "@xto/navigation";
5
+ import { Icon as L, Button as Ee } from "@xto/base";
6
+ import { Drawer as je, Message as oe } from "@xto/feedback";
7
+ import { Form as gt, FormItem as xe, Input as Qe, Checkbox as yt } from "@xto/form";
8
+ import kt from "axios";
9
+ const ge = "xto_", st = (t) => ({
10
+ get(s) {
11
+ const n = t.getItem(ge + s);
12
+ if (!n) return null;
13
+ try {
14
+ return JSON.parse(n);
15
+ } catch {
16
+ return n;
17
+ }
18
+ },
19
+ set(s, n) {
20
+ if (n == null) {
21
+ t.removeItem(ge + s);
22
+ return;
23
+ }
24
+ const r = typeof n == "string" ? n : JSON.stringify(n);
25
+ t.setItem(ge + s, r);
26
+ },
27
+ remove(s) {
28
+ t.removeItem(ge + s);
29
+ },
30
+ clear() {
31
+ Object.keys(t).forEach((n) => {
32
+ n.startsWith(ge) && t.removeItem(n);
33
+ });
34
+ }
35
+ }), Ce = st(window.localStorage), $e = st(window.sessionStorage), x = {
36
+ get: Ce.get,
37
+ set: Ce.set,
38
+ remove: Ce.remove,
39
+ clear: Ce.clear
40
+ }, la = {
41
+ get: $e.get,
42
+ set: $e.set,
43
+ remove: $e.remove,
44
+ clear: $e.clear
45
+ }, ae = Ne("app", () => {
46
+ const t = k(x.get("appName") || "XTO App"), s = k(x.get("indexPath") || "/dashboard"), n = k(x.get("isDark") || !1), r = k(x.get("theme") || "light"), l = k(x.get("layout") || "sidebar"), c = k(x.get("isCollapsed") || !1), $ = k(x.get("showTabs") ?? !0), m = k(x.get("showFooter") ?? !0), y = k(x.get("showBreadcrumb") ?? !0), p = k(x.get("primaryColor") || "#409eff"), f = k([]), _ = k([]), b = w(() => n.value ? "dark" : "light"), j = (M) => {
47
+ t.value = M, x.set("appName", M);
48
+ }, T = (M) => {
49
+ s.value = M, x.set("indexPath", M);
50
+ }, z = () => {
51
+ n.value = !n.value, r.value = n.value ? "dark" : "light", R();
52
+ }, O = (M) => {
53
+ r.value = M, n.value = M === "dark", R();
54
+ }, R = () => {
55
+ const M = document.documentElement;
56
+ n.value ? M.classList.add("dark") : M.classList.remove("dark"), x.set("isDark", n.value), x.set("theme", r.value);
57
+ }, D = () => {
58
+ c.value = !c.value, x.set("isCollapsed", c.value);
59
+ }, V = (M) => {
60
+ l.value = M, x.set("layout", M);
61
+ }, U = () => {
62
+ $.value = !$.value, x.set("showTabs", $.value);
63
+ }, W = () => {
64
+ m.value = !m.value, x.set("showFooter", m.value);
65
+ }, N = () => {
66
+ y.value = !y.value, x.set("showBreadcrumb", y.value);
67
+ }, q = (M) => {
68
+ p.value = M, document.documentElement.style.setProperty("--color-primary", M), x.set("primaryColor", M);
69
+ }, le = (M) => {
70
+ f.value.includes(M) || f.value.push(M);
71
+ }, X = (M) => {
72
+ const se = f.value.indexOf(M);
73
+ se > -1 && f.value.splice(se, 1);
74
+ }, te = () => {
75
+ f.value = [];
76
+ }, re = (M) => {
77
+ _.value = M;
78
+ }, J = () => {
79
+ R(), p.value !== "#409eff" && document.documentElement.style.setProperty("--color-primary", p.value);
80
+ };
81
+ return Ae(n, R), {
82
+ appName: t,
83
+ indexPath: s,
84
+ isDark: n,
85
+ theme: r,
86
+ layout: l,
87
+ isCollapsed: c,
88
+ showTabs: $,
89
+ showFooter: m,
90
+ showBreadcrumb: y,
91
+ primaryColor: p,
92
+ cachedViews: f,
93
+ mixSubMenus: _,
94
+ themeClass: b,
95
+ setAppName: j,
96
+ setIndexPath: T,
97
+ toggleTheme: z,
98
+ toggleCollapse: D,
99
+ setTheme: O,
100
+ setLayout: V,
101
+ toggleTabs: U,
102
+ toggleFooter: W,
103
+ toggleBreadcrumb: N,
104
+ setPrimaryColor: q,
105
+ addCachedView: le,
106
+ removeCachedView: X,
107
+ clearCachedViews: te,
108
+ setMixSubMenus: re,
109
+ initTheme: J
110
+ };
111
+ }), ze = "menu_list", wt = {
112
+ menuCode: "home",
113
+ menuName: "首页",
114
+ menuUrl: "/dashboard",
115
+ icon: "home",
116
+ closable: !1,
117
+ isDefault: !1,
118
+ isOut: !1
119
+ }, ce = Ne("menu", () => {
120
+ const t = k(x.get(ze) || []), s = w(() => t.value.length > 0);
121
+ return {
122
+ menuList: t,
123
+ hasMenu: s,
124
+ setMenuList: (l) => {
125
+ t.value = [wt, ...l], x.set(ze, t.value);
126
+ },
127
+ clearMenu: () => {
128
+ t.value = [], x.remove(ze);
129
+ }
130
+ };
131
+ }), Ue = "/vite.svg", Re = "user_info", G = Ne("user", () => {
132
+ const t = k(x.get(Re)), s = w(() => !!t.value), n = w(() => {
133
+ var _;
134
+ return ((_ = t.value) == null ? void 0 : _.userId) || "";
135
+ }), r = w(() => {
136
+ var _;
137
+ return ((_ = t.value) == null ? void 0 : _.userName) || "";
138
+ }), l = w(() => {
139
+ var _;
140
+ return ((_ = t.value) == null ? void 0 : _.departmentName) || "";
141
+ }), c = w(() => {
142
+ var _;
143
+ return ((_ = t.value) == null ? void 0 : _.email) || "";
144
+ }), $ = w(() => {
145
+ var _;
146
+ return ((_ = t.value) == null ? void 0 : _.mobilePhone) || "";
147
+ }), m = w(() => {
148
+ var _;
149
+ return ((_ = t.value) == null ? void 0 : _.positionName) || "";
150
+ }), y = w(() => {
151
+ var _;
152
+ return ((_ = t.value) == null ? void 0 : _.avatar) || "";
153
+ });
154
+ return {
155
+ userInfo: t,
156
+ isLoggedIn: s,
157
+ userId: n,
158
+ userName: r,
159
+ departmentName: l,
160
+ email: c,
161
+ mobilePhone: $,
162
+ positionName: m,
163
+ avatar: y,
164
+ setUserInfo: (_) => {
165
+ t.value = _, x.set(Re, _);
166
+ },
167
+ clearUserInfo: () => {
168
+ t.value = null, x.remove(Re);
169
+ }
170
+ };
171
+ }), qe = "token", Ye = "token_type", We = "refresh_token", He = "expires_time", Ge = "refresh_time", Xe = "code", De = () => x.get(qe), bt = (t) => {
172
+ x.set(qe, t);
173
+ }, xt = () => x.get(Ye), Ct = (t) => {
174
+ x.set(Ye, t);
175
+ }, ra = () => x.get(We), $t = (t) => {
176
+ x.set(We, t);
177
+ }, Lt = () => x.get(He), St = (t) => {
178
+ x.set(He, t);
179
+ }, ia = () => x.get(Ge), Mt = (t) => {
180
+ x.set(Ge, t);
181
+ }, ua = () => x.get(Xe), It = (t) => {
182
+ x.set(Xe, t);
183
+ }, ot = (t) => {
184
+ bt(t.access_token), Ct(t.token_type || "Bearer"), $t(t.refresh_token), St(t.expires_time), Mt(t.refresh_time), t.code && It(t.code);
185
+ }, nt = () => {
186
+ x.remove(qe), x.remove(Ye), x.remove(We), x.remove(He), x.remove(Ge), x.remove(Xe);
187
+ }, Tt = () => {
188
+ const t = Lt();
189
+ return t ? Date.now() > t : !0;
190
+ }, at = () => !!De() && !Tt(), be = Ne("auth", () => {
191
+ const t = k(De()), s = w(() => at()), n = k(""), r = k(""), l = k(""), c = k("/login");
192
+ return {
193
+ token: t,
194
+ isLoggedIn: s,
195
+ baseUrl: n,
196
+ appId: r,
197
+ clientId: l,
198
+ loginPath: c,
199
+ login: (b) => {
200
+ t.value = b.access_token, ot(b);
201
+ },
202
+ logout: () => {
203
+ t.value = null, nt();
204
+ },
205
+ setBaseUrl: (b) => {
206
+ n.value = b;
207
+ },
208
+ setAppId: (b) => {
209
+ r.value = b;
210
+ },
211
+ setClientId: (b) => {
212
+ l.value = b;
213
+ },
214
+ setLoginPath: (b) => {
215
+ c.value = b;
216
+ }
217
+ };
218
+ }), Nt = {
219
+ key: 0,
220
+ class: "sidebar__logo"
221
+ }, Et = { class: "sidebar__menu-content" }, Ut = {
222
+ key: 0,
223
+ class: "sidebar__menu-icon"
224
+ }, Dt = {
225
+ key: 1,
226
+ class: "sidebar__menu-char"
227
+ }, zt = { class: "sidebar__menu-text" }, Rt = { class: "sidebar__menu-content" }, At = { class: "sidebar__menu-icon" }, Pt = {
228
+ key: 1,
229
+ class: "sidebar__menu-char"
230
+ }, Ot = { class: "sidebar__menu-text" }, Vt = { class: "sidebar__menu-content" }, Ft = {
231
+ key: 0,
232
+ class: "sidebar__menu-icon"
233
+ }, Bt = {
234
+ key: 1,
235
+ class: "sidebar__menu-char"
236
+ }, Kt = { class: "sidebar__menu-text" }, jt = {
237
+ key: 1,
238
+ class: "sidebar__user"
239
+ }, qt = { class: "sidebar__user-info" }, Yt = { class: "sidebar__user-name" }, Wt = { class: "sidebar__user-role" }, Ht = /* @__PURE__ */ ee({
240
+ __name: "Sidebar",
241
+ props: {
242
+ menuList: { default: () => [] },
243
+ showLogo: { type: Boolean, default: !0 },
244
+ showUser: { type: Boolean, default: !0 }
245
+ },
246
+ setup(t) {
247
+ const s = t, n = me(), r = ne(), l = ce(), c = G(), $ = be(), m = ae(), y = w(() => s.menuList.length > 0 ? s.menuList : l.menuList), p = w(() => m.isCollapsed), f = w(() => n.path), _ = w(() => m.isDark ? "#1d1e1f" : "#fff"), b = w(() => m.isDark ? "#cfd3dc" : "#303133"), j = w(() => "#409eff"), T = (U) => {
248
+ U && U !== n.path && r.push(U);
249
+ }, z = () => {
250
+ $.logout(), c.clearUserInfo(), l.clearMenu(), r.push("/login");
251
+ }, O = /* @__PURE__ */ new Set([
252
+ "arrow-up",
253
+ "arrow-down",
254
+ "arrow-left",
255
+ "arrow-right",
256
+ "caret-down",
257
+ "caret-right",
258
+ "plus",
259
+ "minus",
260
+ "close",
261
+ "check",
262
+ "edit",
263
+ "delete",
264
+ "copy",
265
+ "download",
266
+ "upload",
267
+ "refresh",
268
+ "search",
269
+ "filter",
270
+ "more",
271
+ "setting",
272
+ "share",
273
+ "loading",
274
+ "info",
275
+ "success",
276
+ "warning",
277
+ "error",
278
+ "question",
279
+ "user",
280
+ "user-add",
281
+ "user-group",
282
+ "logout",
283
+ "login",
284
+ "file",
285
+ "folder",
286
+ "folder-open",
287
+ "document",
288
+ "image",
289
+ "video",
290
+ "music",
291
+ "camera",
292
+ "mail",
293
+ "phone",
294
+ "chat",
295
+ "bell",
296
+ "message",
297
+ "eye",
298
+ "eye-off",
299
+ "calendar",
300
+ "clock",
301
+ "history",
302
+ "timer",
303
+ "location",
304
+ "map",
305
+ "globe",
306
+ "star",
307
+ "heart",
308
+ "thumb-up",
309
+ "link",
310
+ "external-link",
311
+ "lock",
312
+ "unlock",
313
+ "key",
314
+ "home",
315
+ "menu",
316
+ "menu-fold",
317
+ "menu-unfold",
318
+ "sidebar-fold",
319
+ "sidebar-expand",
320
+ "sidebar-left",
321
+ "dashboard",
322
+ "chart",
323
+ "chart-pie",
324
+ "chart-line",
325
+ "report",
326
+ "analytics",
327
+ "system",
328
+ "permission",
329
+ "role",
330
+ "user-manage",
331
+ "log",
332
+ "notification",
333
+ "app",
334
+ "list",
335
+ "grid",
336
+ "fullscreen",
337
+ "fullscreen-exit",
338
+ "zoom-in",
339
+ "zoom-out",
340
+ "print",
341
+ "bookmark",
342
+ "tag",
343
+ "code",
344
+ "terminal",
345
+ "database",
346
+ "server",
347
+ "cloud",
348
+ "gift",
349
+ "moon",
350
+ "sun",
351
+ "theme",
352
+ "skin"
353
+ ]), R = (U) => {
354
+ if (!U || U === "") return "";
355
+ if (U.startsWith("tineco-icon-")) {
356
+ const N = U.replace("tineco-icon-", "");
357
+ return {
358
+ home: "home",
359
+ dashboard: "dashboard",
360
+ system: "system",
361
+ user: "user",
362
+ role: "role",
363
+ menu: "list",
364
+ setting: "setting",
365
+ file: "file",
366
+ folder: "folder",
367
+ chart: "chart",
368
+ report: "report",
369
+ analytics: "analytics"
370
+ }[N] || N;
371
+ }
372
+ return {
373
+ dashboard: "dashboard",
374
+ system: "system",
375
+ user: "user",
376
+ role: "role",
377
+ menu: "list",
378
+ setting: "setting",
379
+ home: "home",
380
+ chart: "chart",
381
+ report: "report",
382
+ analytics: "analytics",
383
+ permission: "permission",
384
+ log: "log",
385
+ notification: "notification",
386
+ app: "app",
387
+ list: "list",
388
+ grid: "grid"
389
+ }[U] || U;
390
+ }, D = (U) => U ? U.charAt(0) : "", V = (U) => O.has(U);
391
+ return (U, W) => (i(), d("div", {
392
+ class: B(["sidebar", { "sidebar--collapsed": p.value }])
393
+ }, [
394
+ s.showLogo ? (i(), d("div", Nt, [
395
+ W[0] || (W[0] = e("img", {
396
+ src: Ue,
397
+ alt: "Logo",
398
+ class: "sidebar__logo-img"
399
+ }, null, -1)),
400
+ et(e("span", { class: "sidebar__logo-text" }, C(a(m).appName), 513), [
401
+ [mt, !p.value]
402
+ ])
403
+ ])) : P("", !0),
404
+ g(a(Ke), {
405
+ "default-active": f.value,
406
+ mode: "vertical",
407
+ collapse: p.value,
408
+ "collapse-transition": !1,
409
+ "background-color": _.value,
410
+ "text-color": b.value,
411
+ "active-text-color": j.value,
412
+ class: "sidebar__menu",
413
+ onSelect: T
414
+ }, {
415
+ default: S(() => [
416
+ (i(!0), d(K, null, H(y.value, (N) => (i(), d(K, {
417
+ key: N.menuUrl
418
+ }, [
419
+ N.children && N.children.length > 0 ? (i(), F(a(tt), {
420
+ key: 0,
421
+ index: N.menuUrl
422
+ }, {
423
+ title: S(() => [
424
+ e("span", Et, [
425
+ N.menuName !== "首页" ? (i(), d("span", Ut, [
426
+ V(R(N.icon)) ? (i(), F(a(L), {
427
+ key: 0,
428
+ name: R(N.icon),
429
+ size: 16
430
+ }, null, 8, ["name"])) : (i(), d("span", Dt, C(D(N.menuName)), 1))
431
+ ])) : P("", !0),
432
+ e("span", zt, C(N.menuName), 1)
433
+ ])
434
+ ]),
435
+ default: S(() => [
436
+ (i(!0), d(K, null, H(N.children, (q) => (i(), F(a(we), {
437
+ key: q.menuUrl,
438
+ index: q.menuUrl
439
+ }, {
440
+ default: S(() => [
441
+ e("span", Rt, [
442
+ e("span", At, [
443
+ V(R(q.icon)) ? (i(), F(a(L), {
444
+ key: 0,
445
+ name: R(q.icon),
446
+ size: 16
447
+ }, null, 8, ["name"])) : (i(), d("span", Pt, C(D(q.menuName)), 1))
448
+ ]),
449
+ e("span", Ot, C(q.menuName), 1)
450
+ ])
451
+ ]),
452
+ _: 2
453
+ }, 1032, ["index"]))), 128))
454
+ ]),
455
+ _: 2
456
+ }, 1032, ["index"])) : (i(), F(a(we), {
457
+ key: 1,
458
+ index: N.menuUrl
459
+ }, {
460
+ default: S(() => [
461
+ e("span", Vt, [
462
+ N.menuName !== "首页" ? (i(), d("span", Ft, [
463
+ V(R(N.icon)) ? (i(), F(a(L), {
464
+ key: 0,
465
+ name: R(N.icon),
466
+ size: 16
467
+ }, null, 8, ["name"])) : (i(), d("span", Bt, C(D(N.menuName)), 1))
468
+ ])) : P("", !0),
469
+ e("span", Kt, C(N.menuName), 1)
470
+ ])
471
+ ]),
472
+ _: 2
473
+ }, 1032, ["index"]))
474
+ ], 64))), 128))
475
+ ]),
476
+ _: 1
477
+ }, 8, ["default-active", "collapse", "background-color", "text-color", "active-text-color"]),
478
+ s.showUser && !p.value ? (i(), d("div", jt, [
479
+ e("div", qt, [
480
+ e("span", Yt, C(a(c).userName), 1),
481
+ e("span", Wt, C(a(c).departmentName), 1)
482
+ ]),
483
+ g(a(Ee), {
484
+ type: "text",
485
+ size: "small",
486
+ onClick: z
487
+ }, {
488
+ default: S(() => [...W[1] || (W[1] = [
489
+ de("退出", -1)
490
+ ])]),
491
+ _: 1
492
+ })
493
+ ])) : P("", !0)
494
+ ], 2));
495
+ }
496
+ }), Q = (t, s) => {
497
+ const n = t.__vccOpts || t;
498
+ for (const [r, l] of s)
499
+ n[r] = l;
500
+ return n;
501
+ }, Ze = /* @__PURE__ */ Q(Ht, [["__scopeId", "data-v-356129ba"]]), Gt = { class: "header" }, Xt = { class: "header__left" }, Jt = {
502
+ key: 0,
503
+ class: "header__breadcrumb"
504
+ }, Qt = {
505
+ key: 0,
506
+ class: "breadcrumb-separator"
507
+ }, Zt = { class: "header__right" }, es = {
508
+ key: 0,
509
+ class: "header__search-dropdown"
510
+ }, ts = {
511
+ key: 0,
512
+ class: "header__search-results"
513
+ }, ss = ["onClick"], os = { class: "header__search-item-title" }, ns = {
514
+ key: 0,
515
+ class: "header__search-item-parent"
516
+ }, as = {
517
+ key: 1,
518
+ class: "header__search-empty"
519
+ }, ls = ["title"], rs = { class: "header__avatar" }, is = { class: "header__user-name" }, us = {
520
+ key: 0,
521
+ class: "header__dropdown"
522
+ }, cs = { class: "header__dropdown-header" }, ds = { class: "header__dropdown-avatar" }, ms = { class: "header__dropdown-info" }, ps = { class: "header__dropdown-name" }, vs = { class: "header__dropdown-role" }, _s = { class: "header__dropdown-menu" }, hs = { class: "settings-drawer" }, fs = { class: "settings-section" }, gs = { class: "settings-layout-options" }, ys = ["onClick"], ks = { class: "layout-option__preview" }, ws = {
523
+ key: 0,
524
+ class: "layout-preview-sidebar"
525
+ }, bs = {
526
+ key: 1,
527
+ class: "layout-preview-top"
528
+ }, xs = {
529
+ key: 2,
530
+ class: "layout-preview-mix"
531
+ }, Cs = { class: "layout-option__label" }, $s = { class: "settings-section" }, Ls = { class: "settings-color-options" }, Ss = ["title", "onClick"], Ms = { class: "settings-section" }, Is = { class: "settings-switch-list" }, Ts = { class: "settings-switch-item" }, Ns = { class: "settings-switch-item" }, Es = /* @__PURE__ */ ee({
532
+ __name: "Header",
533
+ setup(t) {
534
+ const s = me(), n = ne(), r = ae(), l = G(), c = be(), $ = ce(), m = k(!1), y = k(!1), p = k(null), f = k(!1), _ = k(!1), b = k(""), j = k(null), T = k(!1), z = [
535
+ { value: "sidebar", label: "左侧菜单", icon: "sidebar-left" },
536
+ { value: "top", label: "顶部菜单", icon: "menu" },
537
+ { value: "mix", label: "混合菜单", icon: "grid" }
538
+ ], O = [
539
+ { value: "#409eff", label: "默认蓝" },
540
+ { value: "#1890ff", label: "科技蓝" },
541
+ { value: "#52c41a", label: "极光绿" },
542
+ { value: "#faad14", label: "日落橙" },
543
+ { value: "#f5222d", label: "薄暮红" },
544
+ { value: "#722ed1", label: "酱紫" }
545
+ ], R = w(() => s.matched.filter((h) => h.meta && h.meta.title).map((h) => ({
546
+ title: h.meta.title,
547
+ path: h.path
548
+ }))), D = (v, h = "") => {
549
+ const u = [];
550
+ return v.forEach((o) => {
551
+ o.children && o.children.length > 0 ? u.push(...D(o.children, o.menuName)) : u.push({ ...o, parentTitle: h, title: o.menuName, path: o.menuUrl });
552
+ }), u;
553
+ }, V = w(() => b.value.trim() ? D($.menuList).filter(
554
+ (h) => h.title.toLowerCase().includes(b.value.toLowerCase())
555
+ ) : []), U = w(() => r.layout), W = () => {
556
+ r.toggleCollapse();
557
+ }, N = () => {
558
+ r.toggleTheme();
559
+ }, q = () => {
560
+ y.value = !0;
561
+ }, le = (v) => {
562
+ r.setLayout(v), y.value = !1;
563
+ }, X = (v) => {
564
+ T.value = v;
565
+ const h = document.documentElement;
566
+ v ? h.classList.add("grey-mode") : h.classList.remove("grey-mode");
567
+ }, te = () => {
568
+ X(!T.value), y.value = !1;
569
+ }, re = () => {
570
+ r.toggleTheme(), y.value = !1;
571
+ }, J = () => {
572
+ document.fullscreenElement ? document.exitFullscreen() : document.documentElement.requestFullscreen();
573
+ }, M = () => {
574
+ f.value = !!document.fullscreenElement;
575
+ }, se = () => {
576
+ m.value = !m.value;
577
+ }, Z = () => {
578
+ m.value = !1;
579
+ }, ie = () => {
580
+ _.value = !1, b.value = "";
581
+ }, pe = (v) => {
582
+ n.push(v), ie();
583
+ }, ve = (v) => {
584
+ r.setPrimaryColor(v), y.value = !1;
585
+ }, _e = () => {
586
+ Z(), n.push("/profile");
587
+ }, he = () => {
588
+ Z(), n.push("/change-password");
589
+ }, fe = () => {
590
+ Z(), c.logout(), l.clearUserInfo(), $.clearMenu(), n.push("/login");
591
+ }, ue = (v) => {
592
+ p.value && !p.value.contains(v.target) && Z(), j.value && !j.value.contains(v.target) && ie();
593
+ }, I = (v) => {
594
+ v.key === "Escape" && (ie(), Z());
595
+ };
596
+ return Pe(() => {
597
+ document.addEventListener("click", ue), document.addEventListener("fullscreenchange", M), document.addEventListener("keydown", I), r.initTheme(), T.value = document.documentElement.classList.contains("grey-mode");
598
+ }), Oe(() => {
599
+ document.removeEventListener("click", ue), document.removeEventListener("fullscreenchange", M), document.removeEventListener("keydown", I);
600
+ }), (v, h) => {
601
+ var u;
602
+ return i(), d("div", Gt, [
603
+ e("div", Xt, [
604
+ e("div", {
605
+ class: "header__collapse",
606
+ onClick: W
607
+ }, [
608
+ g(a(L), {
609
+ name: a(r).isCollapsed ? "menu-unfold" : "menu-fold",
610
+ size: 18
611
+ }, null, 8, ["name"])
612
+ ]),
613
+ a(r).showBreadcrumb ? (i(), d("div", Jt, [
614
+ (i(!0), d(K, null, H(R.value, (o, Y) => (i(), d("span", {
615
+ key: o.path
616
+ }, [
617
+ Y > 0 ? (i(), d("span", Qt, "/")) : P("", !0),
618
+ e("span", {
619
+ class: B({ "is-current": Y === R.value.length - 1 })
620
+ }, C(o.title), 3)
621
+ ]))), 128))
622
+ ])) : P("", !0)
623
+ ]),
624
+ e("div", Zt, [
625
+ e("div", {
626
+ class: "header__search",
627
+ ref_key: "searchRef",
628
+ ref: j
629
+ }, [
630
+ g(a(L), {
631
+ name: "search",
632
+ size: 14,
633
+ class: "header__search-icon"
634
+ }),
635
+ et(e("input", {
636
+ "onUpdate:modelValue": h[0] || (h[0] = (o) => b.value = o),
637
+ type: "text",
638
+ class: "header__search-input",
639
+ placeholder: "搜索菜单...",
640
+ onFocus: h[1] || (h[1] = (o) => _.value = !0)
641
+ }, null, 544), [
642
+ [pt, b.value]
643
+ ]),
644
+ g(Le, { name: "search-dropdown" }, {
645
+ default: S(() => [
646
+ _.value && (V.value.length > 0 || b.value) ? (i(), d("div", es, [
647
+ V.value.length > 0 ? (i(), d("div", ts, [
648
+ (i(!0), d(K, null, H(V.value, (o) => (i(), d("div", {
649
+ key: o.path,
650
+ class: "header__search-item",
651
+ onClick: (Y) => pe(o.path)
652
+ }, [
653
+ g(a(L), {
654
+ name: o.icon || "file",
655
+ size: 16
656
+ }, null, 8, ["name"]),
657
+ e("span", os, C(o.title), 1),
658
+ o.parentTitle ? (i(), d("span", ns, C(o.parentTitle), 1)) : P("", !0)
659
+ ], 8, ss))), 128))
660
+ ])) : (i(), d("div", as, " 未找到匹配的菜单 "))
661
+ ])) : P("", !0)
662
+ ]),
663
+ _: 1
664
+ })
665
+ ], 512),
666
+ e("div", {
667
+ class: "header__action",
668
+ onClick: J,
669
+ title: f.value ? "退出全屏" : "全屏"
670
+ }, [
671
+ g(a(L), {
672
+ name: f.value ? "fullscreen-exit" : "fullscreen",
673
+ size: 16
674
+ }, null, 8, ["name"])
675
+ ], 8, ls),
676
+ e("div", {
677
+ class: "header__action",
678
+ onClick: q,
679
+ title: "换肤设置"
680
+ }, [
681
+ g(a(L), {
682
+ name: "skin",
683
+ size: 16
684
+ })
685
+ ]),
686
+ e("div", {
687
+ class: "header__action",
688
+ onClick: N,
689
+ title: "切换主题"
690
+ }, [
691
+ g(a(L), {
692
+ name: a(r).isDark ? "sun" : "moon",
693
+ size: 16
694
+ }, null, 8, ["name"])
695
+ ]),
696
+ e("div", {
697
+ class: "header__user",
698
+ ref_key: "dropdownRef",
699
+ ref: p
700
+ }, [
701
+ e("div", {
702
+ class: "header__user-trigger",
703
+ onClick: Te(se, ["stop"])
704
+ }, [
705
+ e("div", rs, [
706
+ e("span", null, C(((u = a(l).userName) == null ? void 0 : u.charAt(0)) || "U"), 1)
707
+ ]),
708
+ e("span", is, C(a(l).userName), 1),
709
+ e("span", {
710
+ class: B(["header__user-arrow", { "is-active": m.value }])
711
+ }, "▼", 2)
712
+ ]),
713
+ g(Le, { name: "dropdown" }, {
714
+ default: S(() => {
715
+ var o;
716
+ return [
717
+ m.value ? (i(), d("div", us, [
718
+ e("div", cs, [
719
+ e("div", ds, [
720
+ e("span", null, C(((o = a(l).userName) == null ? void 0 : o.charAt(0)) || "U"), 1)
721
+ ]),
722
+ e("div", ms, [
723
+ e("div", ps, C(a(l).userName), 1),
724
+ e("div", vs, C(a(l).departmentName), 1)
725
+ ])
726
+ ]),
727
+ h[7] || (h[7] = e("div", { class: "header__dropdown-divider" }, null, -1)),
728
+ e("div", _s, [
729
+ e("div", {
730
+ class: "header__dropdown-item",
731
+ onClick: _e
732
+ }, [
733
+ g(a(L), {
734
+ name: "user",
735
+ size: 16
736
+ }),
737
+ h[3] || (h[3] = e("span", null, "个人信息", -1))
738
+ ]),
739
+ e("div", {
740
+ class: "header__dropdown-item",
741
+ onClick: he
742
+ }, [
743
+ g(a(L), {
744
+ name: "lock",
745
+ size: 16
746
+ }),
747
+ h[4] || (h[4] = e("span", null, "修改密码", -1))
748
+ ]),
749
+ h[6] || (h[6] = e("div", { class: "header__dropdown-divider" }, null, -1)),
750
+ e("div", {
751
+ class: "header__dropdown-item header__dropdown-item--danger",
752
+ onClick: fe
753
+ }, [
754
+ g(a(L), {
755
+ name: "logout",
756
+ size: 16
757
+ }),
758
+ h[5] || (h[5] = e("span", null, "退出登录", -1))
759
+ ])
760
+ ])
761
+ ])) : P("", !0)
762
+ ];
763
+ }),
764
+ _: 1
765
+ })
766
+ ], 512)
767
+ ]),
768
+ g(a(je), {
769
+ modelValue: y.value,
770
+ "onUpdate:modelValue": h[2] || (h[2] = (o) => y.value = o),
771
+ title: "换肤设置",
772
+ direction: "rtl",
773
+ size: "320px"
774
+ }, {
775
+ default: S(() => [
776
+ e("div", hs, [
777
+ e("div", fs, [
778
+ h[11] || (h[11] = e("div", { class: "settings-title" }, "布局模式", -1)),
779
+ e("div", gs, [
780
+ (i(), d(K, null, H(z, (o) => e("div", {
781
+ key: o.value,
782
+ class: B(["layout-option", { "is-active": U.value === o.value }]),
783
+ onClick: (Y) => le(o.value)
784
+ }, [
785
+ e("div", ks, [
786
+ o.value === "sidebar" ? (i(), d("div", ws, [...h[8] || (h[8] = [
787
+ e("div", { class: "preview-aside" }, null, -1),
788
+ e("div", { class: "preview-main" }, [
789
+ e("div", { class: "preview-header" }),
790
+ e("div", { class: "preview-content" })
791
+ ], -1)
792
+ ])])) : o.value === "top" ? (i(), d("div", bs, [...h[9] || (h[9] = [
793
+ e("div", { class: "preview-header-full" }, null, -1),
794
+ e("div", { class: "preview-content-full" }, null, -1)
795
+ ])])) : (i(), d("div", xs, [...h[10] || (h[10] = [
796
+ e("div", { class: "preview-header-mix" }, [
797
+ e("div", { class: "preview-mix-left" })
798
+ ], -1),
799
+ e("div", { class: "preview-mix-body" }, [
800
+ e("div", { class: "preview-mix-aside" }),
801
+ e("div", { class: "preview-mix-content" })
802
+ ], -1)
803
+ ])]))
804
+ ]),
805
+ e("span", Cs, C(o.label), 1)
806
+ ], 10, ys)), 64))
807
+ ])
808
+ ]),
809
+ e("div", $s, [
810
+ h[12] || (h[12] = e("div", { class: "settings-title" }, "主题色", -1)),
811
+ e("div", Ls, [
812
+ (i(), d(K, null, H(O, (o) => e("div", {
813
+ key: o.value,
814
+ class: B(["color-option", { "is-active": a(r).primaryColor === o.value }]),
815
+ style: ke({ backgroundColor: o.value }),
816
+ title: o.label,
817
+ onClick: (Y) => ve(o.value)
818
+ }, [
819
+ a(r).primaryColor === o.value ? (i(), F(a(L), {
820
+ key: 0,
821
+ name: "check",
822
+ size: 12,
823
+ color: "#fff"
824
+ })) : P("", !0)
825
+ ], 14, Ss)), 64))
826
+ ])
827
+ ]),
828
+ e("div", Ms, [
829
+ h[17] || (h[17] = e("div", { class: "settings-title" }, "功能设置", -1)),
830
+ e("div", Is, [
831
+ e("div", Ts, [
832
+ h[14] || (h[14] = e("span", null, "灰色模式", -1)),
833
+ e("div", {
834
+ class: B(["switch-wrapper", { "is-checked": T.value }]),
835
+ onClick: te
836
+ }, [...h[13] || (h[13] = [
837
+ e("span", { class: "switch-core" }, null, -1)
838
+ ])], 2)
839
+ ]),
840
+ e("div", Ns, [
841
+ h[16] || (h[16] = e("span", null, "暗黑模式", -1)),
842
+ e("div", {
843
+ class: B(["switch-wrapper", { "is-checked": a(r).isDark }]),
844
+ onClick: re
845
+ }, [...h[15] || (h[15] = [
846
+ e("span", { class: "switch-core" }, null, -1)
847
+ ])], 2)
848
+ ])
849
+ ])
850
+ ])
851
+ ])
852
+ ]),
853
+ _: 1
854
+ }, 8, ["modelValue"])
855
+ ]);
856
+ };
857
+ }
858
+ }), Us = /* @__PURE__ */ Q(Es, [["__scopeId", "data-v-1c1c65e7"]]), Ds = { class: "top-menu" }, zs = { class: "top-menu__logo" }, Rs = { class: "top-menu__logo-text" }, As = { class: "top-menu__menu-content" }, Ps = {
859
+ key: 0,
860
+ class: "top-menu__menu-icon"
861
+ }, Os = {
862
+ key: 1,
863
+ class: "top-menu__menu-char"
864
+ }, Vs = { class: "top-menu__menu-text" }, Fs = { class: "top-menu__menu-content" }, Bs = { class: "top-menu__menu-icon" }, Ks = {
865
+ key: 1,
866
+ class: "top-menu__menu-char"
867
+ }, js = { class: "top-menu__menu-text" }, qs = { class: "top-menu__menu-content" }, Ys = {
868
+ key: 0,
869
+ class: "top-menu__menu-icon"
870
+ }, Ws = {
871
+ key: 1,
872
+ class: "top-menu__menu-char"
873
+ }, Hs = { class: "top-menu__menu-text" }, Gs = { class: "top-menu__actions" }, Xs = ["title"], Js = { class: "top-menu__avatar" }, Qs = { class: "top-menu__user-name" }, Zs = {
874
+ key: 0,
875
+ class: "top-menu__dropdown"
876
+ }, eo = { class: "top-menu__dropdown-header" }, to = { class: "top-menu__dropdown-avatar" }, so = { class: "top-menu__dropdown-info" }, oo = { class: "top-menu__dropdown-name" }, no = { class: "top-menu__dropdown-role" }, ao = { class: "top-menu__dropdown-menu" }, lo = { class: "settings-drawer" }, ro = { class: "settings-section" }, io = { class: "settings-layout-options" }, uo = ["onClick"], co = { class: "layout-option__preview" }, mo = {
877
+ key: 0,
878
+ class: "layout-preview-sidebar"
879
+ }, po = {
880
+ key: 1,
881
+ class: "layout-preview-top"
882
+ }, vo = {
883
+ key: 2,
884
+ class: "layout-preview-mix"
885
+ }, _o = { class: "layout-option__label" }, ho = { class: "settings-section" }, fo = { class: "settings-color-options" }, go = ["title", "onClick"], yo = { class: "settings-section" }, ko = { class: "settings-switch-list" }, wo = { class: "settings-switch-item" }, bo = { class: "settings-switch-item" }, xo = /* @__PURE__ */ ee({
886
+ __name: "TopMenu",
887
+ setup(t) {
888
+ const s = me(), n = ne(), r = ce(), l = ae(), c = G(), $ = be(), m = w(() => s.path), y = w(() => l.isDark ? "#1d1e1f" : "#fff"), p = w(() => l.isDark ? "#cfd3dc" : "#303133"), f = w(() => "#409eff"), _ = k(!1), b = k(null), j = k(!1), T = k(!1), z = k(!1), O = (I) => {
889
+ I && I !== s.path && n.push(I);
890
+ }, R = /* @__PURE__ */ new Set([
891
+ "arrow-up",
892
+ "arrow-down",
893
+ "arrow-left",
894
+ "arrow-right",
895
+ "caret-down",
896
+ "caret-right",
897
+ "plus",
898
+ "minus",
899
+ "close",
900
+ "check",
901
+ "edit",
902
+ "delete",
903
+ "copy",
904
+ "download",
905
+ "upload",
906
+ "refresh",
907
+ "search",
908
+ "filter",
909
+ "more",
910
+ "setting",
911
+ "share",
912
+ "loading",
913
+ "info",
914
+ "success",
915
+ "warning",
916
+ "error",
917
+ "question",
918
+ "user",
919
+ "user-add",
920
+ "user-group",
921
+ "logout",
922
+ "login",
923
+ "file",
924
+ "folder",
925
+ "folder-open",
926
+ "document",
927
+ "image",
928
+ "video",
929
+ "music",
930
+ "camera",
931
+ "mail",
932
+ "phone",
933
+ "chat",
934
+ "bell",
935
+ "message",
936
+ "eye",
937
+ "eye-off",
938
+ "calendar",
939
+ "clock",
940
+ "history",
941
+ "timer",
942
+ "location",
943
+ "map",
944
+ "globe",
945
+ "star",
946
+ "heart",
947
+ "thumb-up",
948
+ "link",
949
+ "external-link",
950
+ "lock",
951
+ "unlock",
952
+ "key",
953
+ "home",
954
+ "menu",
955
+ "menu-fold",
956
+ "menu-unfold",
957
+ "sidebar-fold",
958
+ "sidebar-expand",
959
+ "sidebar-left",
960
+ "dashboard",
961
+ "chart",
962
+ "chart-pie",
963
+ "chart-line",
964
+ "report",
965
+ "analytics",
966
+ "system",
967
+ "permission",
968
+ "role",
969
+ "user-manage",
970
+ "log",
971
+ "notification",
972
+ "app",
973
+ "list",
974
+ "grid",
975
+ "fullscreen",
976
+ "fullscreen-exit",
977
+ "zoom-in",
978
+ "zoom-out",
979
+ "print",
980
+ "bookmark",
981
+ "tag",
982
+ "code",
983
+ "terminal",
984
+ "database",
985
+ "server",
986
+ "cloud",
987
+ "gift",
988
+ "moon",
989
+ "sun",
990
+ "theme",
991
+ "skin"
992
+ ]), D = (I) => {
993
+ if (!I || I === "") return "";
994
+ if (I.startsWith("tineco-icon-")) {
995
+ const h = I.replace("tineco-icon-", "");
996
+ return {
997
+ home: "home",
998
+ dashboard: "dashboard",
999
+ system: "system",
1000
+ user: "user",
1001
+ role: "role",
1002
+ menu: "list",
1003
+ setting: "setting",
1004
+ file: "file",
1005
+ folder: "folder",
1006
+ chart: "chart",
1007
+ report: "report",
1008
+ analytics: "analytics"
1009
+ }[h] || h;
1010
+ }
1011
+ return {
1012
+ dashboard: "dashboard",
1013
+ system: "system",
1014
+ user: "user",
1015
+ role: "role",
1016
+ menu: "list",
1017
+ setting: "setting",
1018
+ home: "home",
1019
+ chart: "chart",
1020
+ report: "report",
1021
+ analytics: "analytics",
1022
+ permission: "permission",
1023
+ log: "log",
1024
+ notification: "notification",
1025
+ app: "app",
1026
+ list: "list",
1027
+ grid: "grid"
1028
+ }[I] || I;
1029
+ }, V = (I) => I ? I.charAt(0) : "", U = (I) => R.has(I), W = () => {
1030
+ l.toggleTheme(), T.value = !1;
1031
+ }, N = () => {
1032
+ document.fullscreenElement ? document.exitFullscreen() : document.documentElement.requestFullscreen();
1033
+ }, q = () => {
1034
+ j.value = !!document.fullscreenElement;
1035
+ }, le = () => {
1036
+ _.value = !_.value;
1037
+ }, X = () => {
1038
+ _.value = !1;
1039
+ }, te = () => {
1040
+ T.value = !0;
1041
+ }, re = (I) => {
1042
+ z.value = I;
1043
+ const v = document.documentElement;
1044
+ I ? v.classList.add("grey-mode") : v.classList.remove("grey-mode");
1045
+ }, J = () => {
1046
+ re(!z.value), T.value = !1;
1047
+ }, M = () => {
1048
+ l.toggleTheme(), T.value = !1;
1049
+ }, se = [
1050
+ { value: "sidebar", label: "左侧菜单", icon: "sidebar-left" },
1051
+ { value: "top", label: "顶部菜单", icon: "menu" },
1052
+ { value: "mix", label: "混合菜单", icon: "grid" }
1053
+ ], Z = w(() => l.layout), ie = (I) => {
1054
+ l.setLayout(I), T.value = !1;
1055
+ }, pe = [
1056
+ { value: "#409eff", label: "默认蓝" },
1057
+ { value: "#1890ff", label: "科技蓝" },
1058
+ { value: "#52c41a", label: "极光绿" },
1059
+ { value: "#faad14", label: "日落橙" },
1060
+ { value: "#f5222d", label: "薄暮红" },
1061
+ { value: "#722ed1", label: "酱紫" }
1062
+ ], ve = (I) => {
1063
+ l.setPrimaryColor(I), T.value = !1;
1064
+ }, _e = () => {
1065
+ X(), n.push("/profile");
1066
+ }, he = () => {
1067
+ X(), n.push("/change-password");
1068
+ }, fe = () => {
1069
+ X(), $.logout(), c.clearUserInfo(), r.clearMenu(), n.push("/login");
1070
+ }, ue = (I) => {
1071
+ b.value && !b.value.contains(I.target) && X();
1072
+ };
1073
+ return Pe(() => {
1074
+ document.addEventListener("click", ue), document.addEventListener("fullscreenchange", q), z.value = document.documentElement.classList.contains("grey-mode");
1075
+ }), Oe(() => {
1076
+ document.removeEventListener("click", ue), document.removeEventListener("fullscreenchange", q);
1077
+ }), (I, v) => {
1078
+ var h;
1079
+ return i(), d("div", Ds, [
1080
+ e("div", zs, [
1081
+ v[1] || (v[1] = e("img", {
1082
+ src: Ue,
1083
+ alt: "Logo",
1084
+ class: "top-menu__logo-img"
1085
+ }, null, -1)),
1086
+ e("span", Rs, C(a(l).appName), 1)
1087
+ ]),
1088
+ g(a(Ke), {
1089
+ "default-active": m.value,
1090
+ mode: "horizontal",
1091
+ "background-color": y.value,
1092
+ "text-color": p.value,
1093
+ "active-text-color": f.value,
1094
+ class: "top-menu__menu",
1095
+ onSelect: O
1096
+ }, {
1097
+ default: S(() => [
1098
+ (i(!0), d(K, null, H(a(r).menuList, (u) => (i(), d(K, {
1099
+ key: u.menuUrl
1100
+ }, [
1101
+ u.children && u.children.length > 0 ? (i(), F(a(tt), {
1102
+ key: 0,
1103
+ index: u.menuUrl
1104
+ }, {
1105
+ title: S(() => [
1106
+ e("span", As, [
1107
+ u.menuName !== "首页" ? (i(), d("span", Ps, [
1108
+ U(D(u.icon)) ? (i(), F(a(L), {
1109
+ key: 0,
1110
+ name: D(u.icon),
1111
+ size: 16
1112
+ }, null, 8, ["name"])) : (i(), d("span", Os, C(V(u.menuName)), 1))
1113
+ ])) : P("", !0),
1114
+ e("span", Vs, C(u.menuName), 1)
1115
+ ])
1116
+ ]),
1117
+ default: S(() => [
1118
+ (i(!0), d(K, null, H(u.children, (o) => (i(), F(a(we), {
1119
+ key: o.menuUrl,
1120
+ index: o.menuUrl
1121
+ }, {
1122
+ default: S(() => [
1123
+ e("span", Fs, [
1124
+ e("span", Bs, [
1125
+ U(D(o.icon)) ? (i(), F(a(L), {
1126
+ key: 0,
1127
+ name: D(o.icon),
1128
+ size: 16
1129
+ }, null, 8, ["name"])) : (i(), d("span", Ks, C(V(o.menuName)), 1))
1130
+ ]),
1131
+ e("span", js, C(o.menuName), 1)
1132
+ ])
1133
+ ]),
1134
+ _: 2
1135
+ }, 1032, ["index"]))), 128))
1136
+ ]),
1137
+ _: 2
1138
+ }, 1032, ["index"])) : (i(), F(a(we), {
1139
+ key: 1,
1140
+ index: u.menuUrl
1141
+ }, {
1142
+ default: S(() => [
1143
+ e("span", qs, [
1144
+ u.menuName !== "首页" ? (i(), d("span", Ys, [
1145
+ U(D(u.icon)) ? (i(), F(a(L), {
1146
+ key: 0,
1147
+ name: D(u.icon),
1148
+ size: 16
1149
+ }, null, 8, ["name"])) : (i(), d("span", Ws, C(V(u.menuName)), 1))
1150
+ ])) : P("", !0),
1151
+ e("span", Hs, C(u.menuName), 1)
1152
+ ])
1153
+ ]),
1154
+ _: 2
1155
+ }, 1032, ["index"]))
1156
+ ], 64))), 128))
1157
+ ]),
1158
+ _: 1
1159
+ }, 8, ["default-active", "background-color", "text-color", "active-text-color"]),
1160
+ e("div", Gs, [
1161
+ e("div", {
1162
+ class: "top-menu__action",
1163
+ onClick: N,
1164
+ title: j.value ? "退出全屏" : "全屏"
1165
+ }, [
1166
+ g(a(L), {
1167
+ name: j.value ? "fullscreen-exit" : "fullscreen",
1168
+ size: 16
1169
+ }, null, 8, ["name"])
1170
+ ], 8, Xs),
1171
+ e("div", {
1172
+ class: "top-menu__action",
1173
+ onClick: te,
1174
+ title: "换肤设置"
1175
+ }, [
1176
+ g(a(L), {
1177
+ name: "skin",
1178
+ size: 16
1179
+ })
1180
+ ]),
1181
+ e("div", {
1182
+ class: "top-menu__action",
1183
+ onClick: W,
1184
+ title: "切换主题"
1185
+ }, [
1186
+ g(a(L), {
1187
+ name: a(l).isDark ? "sun" : "moon",
1188
+ size: 16
1189
+ }, null, 8, ["name"])
1190
+ ]),
1191
+ e("div", {
1192
+ class: "top-menu__user",
1193
+ ref_key: "dropdownRef",
1194
+ ref: b
1195
+ }, [
1196
+ e("div", {
1197
+ class: "top-menu__user-trigger",
1198
+ onClick: Te(le, ["stop"])
1199
+ }, [
1200
+ e("div", Js, [
1201
+ e("span", null, C(((h = a(c).userName) == null ? void 0 : h.charAt(0)) || "U"), 1)
1202
+ ]),
1203
+ e("span", Qs, C(a(c).userName), 1),
1204
+ e("span", {
1205
+ class: B(["top-menu__user-arrow", { "is-active": _.value }])
1206
+ }, "▼", 2)
1207
+ ]),
1208
+ g(Le, { name: "dropdown" }, {
1209
+ default: S(() => {
1210
+ var u;
1211
+ return [
1212
+ _.value ? (i(), d("div", Zs, [
1213
+ e("div", eo, [
1214
+ e("div", to, [
1215
+ e("span", null, C(((u = a(c).userName) == null ? void 0 : u.charAt(0)) || "U"), 1)
1216
+ ]),
1217
+ e("div", so, [
1218
+ e("div", oo, C(a(c).userName), 1),
1219
+ e("div", no, C(a(c).departmentName), 1)
1220
+ ])
1221
+ ]),
1222
+ v[6] || (v[6] = e("div", { class: "top-menu__dropdown-divider" }, null, -1)),
1223
+ e("div", ao, [
1224
+ e("div", {
1225
+ class: "top-menu__dropdown-item",
1226
+ onClick: _e
1227
+ }, [
1228
+ g(a(L), {
1229
+ name: "user",
1230
+ size: 16
1231
+ }),
1232
+ v[2] || (v[2] = e("span", null, "个人信息", -1))
1233
+ ]),
1234
+ e("div", {
1235
+ class: "top-menu__dropdown-item",
1236
+ onClick: he
1237
+ }, [
1238
+ g(a(L), {
1239
+ name: "lock",
1240
+ size: 16
1241
+ }),
1242
+ v[3] || (v[3] = e("span", null, "修改密码", -1))
1243
+ ]),
1244
+ v[5] || (v[5] = e("div", { class: "top-menu__dropdown-divider" }, null, -1)),
1245
+ e("div", {
1246
+ class: "top-menu__dropdown-item top-menu__dropdown-item--danger",
1247
+ onClick: fe
1248
+ }, [
1249
+ g(a(L), {
1250
+ name: "logout",
1251
+ size: 16
1252
+ }),
1253
+ v[4] || (v[4] = e("span", null, "退出登录", -1))
1254
+ ])
1255
+ ])
1256
+ ])) : P("", !0)
1257
+ ];
1258
+ }),
1259
+ _: 1
1260
+ })
1261
+ ], 512)
1262
+ ]),
1263
+ g(a(je), {
1264
+ modelValue: T.value,
1265
+ "onUpdate:modelValue": v[0] || (v[0] = (u) => T.value = u),
1266
+ title: "换肤设置",
1267
+ direction: "rtl",
1268
+ size: "320px"
1269
+ }, {
1270
+ default: S(() => [
1271
+ e("div", lo, [
1272
+ e("div", ro, [
1273
+ v[10] || (v[10] = e("div", { class: "settings-title" }, "布局模式", -1)),
1274
+ e("div", io, [
1275
+ (i(), d(K, null, H(se, (u) => e("div", {
1276
+ key: u.value,
1277
+ class: B(["layout-option", { "is-active": Z.value === u.value }]),
1278
+ onClick: (o) => ie(u.value)
1279
+ }, [
1280
+ e("div", co, [
1281
+ u.value === "sidebar" ? (i(), d("div", mo, [...v[7] || (v[7] = [
1282
+ e("div", { class: "preview-aside" }, null, -1),
1283
+ e("div", { class: "preview-main" }, [
1284
+ e("div", { class: "preview-header" }),
1285
+ e("div", { class: "preview-content" })
1286
+ ], -1)
1287
+ ])])) : u.value === "top" ? (i(), d("div", po, [...v[8] || (v[8] = [
1288
+ e("div", { class: "preview-header-full" }, null, -1),
1289
+ e("div", { class: "preview-content-full" }, null, -1)
1290
+ ])])) : (i(), d("div", vo, [...v[9] || (v[9] = [
1291
+ e("div", { class: "preview-header-mix" }, [
1292
+ e("div", { class: "preview-mix-left" })
1293
+ ], -1),
1294
+ e("div", { class: "preview-mix-body" }, [
1295
+ e("div", { class: "preview-mix-aside" }),
1296
+ e("div", { class: "preview-mix-content" })
1297
+ ], -1)
1298
+ ])]))
1299
+ ]),
1300
+ e("span", _o, C(u.label), 1)
1301
+ ], 10, uo)), 64))
1302
+ ])
1303
+ ]),
1304
+ e("div", ho, [
1305
+ v[11] || (v[11] = e("div", { class: "settings-title" }, "主题色", -1)),
1306
+ e("div", fo, [
1307
+ (i(), d(K, null, H(pe, (u) => e("div", {
1308
+ key: u.value,
1309
+ class: B(["color-option", { "is-active": a(l).primaryColor === u.value }]),
1310
+ style: ke({ backgroundColor: u.value }),
1311
+ title: u.label,
1312
+ onClick: (o) => ve(u.value)
1313
+ }, [
1314
+ a(l).primaryColor === u.value ? (i(), F(a(L), {
1315
+ key: 0,
1316
+ name: "check",
1317
+ size: 12,
1318
+ color: "#fff"
1319
+ })) : P("", !0)
1320
+ ], 14, go)), 64))
1321
+ ])
1322
+ ]),
1323
+ e("div", yo, [
1324
+ v[16] || (v[16] = e("div", { class: "settings-title" }, "功能设置", -1)),
1325
+ e("div", ko, [
1326
+ e("div", wo, [
1327
+ v[13] || (v[13] = e("span", null, "灰色模式", -1)),
1328
+ e("div", {
1329
+ class: B(["switch-wrapper", { "is-checked": z.value }]),
1330
+ onClick: J
1331
+ }, [...v[12] || (v[12] = [
1332
+ e("span", { class: "switch-core" }, null, -1)
1333
+ ])], 2)
1334
+ ]),
1335
+ e("div", bo, [
1336
+ v[15] || (v[15] = e("span", null, "暗黑模式", -1)),
1337
+ e("div", {
1338
+ class: B(["switch-wrapper", { "is-checked": a(l).isDark }]),
1339
+ onClick: M
1340
+ }, [...v[14] || (v[14] = [
1341
+ e("span", { class: "switch-core" }, null, -1)
1342
+ ])], 2)
1343
+ ])
1344
+ ])
1345
+ ])
1346
+ ])
1347
+ ]),
1348
+ _: 1
1349
+ }, 8, ["modelValue"])
1350
+ ]);
1351
+ };
1352
+ }
1353
+ }), Co = /* @__PURE__ */ Q(xo, [["__scopeId", "data-v-0e7ff899"]]), $o = { class: "mix-top-menu" }, Lo = { class: "mix-top-menu__logo" }, So = { class: "mix-top-menu__logo-text" }, Mo = { class: "mix-top-menu__menu-content" }, Io = {
1354
+ key: 0,
1355
+ class: "mix-top-menu__menu-icon"
1356
+ }, To = {
1357
+ key: 1,
1358
+ class: "mix-top-menu__menu-char"
1359
+ }, No = { class: "mix-top-menu__menu-text" }, Eo = { class: "mix-top-menu__actions" }, Uo = ["title"], Do = { class: "mix-top-menu__avatar" }, zo = { class: "mix-top-menu__user-name" }, Ro = {
1360
+ key: 0,
1361
+ class: "mix-top-menu__dropdown"
1362
+ }, Ao = { class: "mix-top-menu__dropdown-header" }, Po = { class: "mix-top-menu__dropdown-avatar" }, Oo = { class: "mix-top-menu__dropdown-info" }, Vo = { class: "mix-top-menu__dropdown-name" }, Fo = { class: "mix-top-menu__dropdown-role" }, Bo = { class: "mix-top-menu__dropdown-menu" }, Ko = { class: "settings-drawer" }, jo = { class: "settings-section" }, qo = { class: "settings-layout-options" }, Yo = ["onClick"], Wo = { class: "layout-option__preview" }, Ho = {
1363
+ key: 0,
1364
+ class: "layout-preview-sidebar"
1365
+ }, Go = {
1366
+ key: 1,
1367
+ class: "layout-preview-top"
1368
+ }, Xo = {
1369
+ key: 2,
1370
+ class: "layout-preview-mix"
1371
+ }, Jo = { class: "layout-option__label" }, Qo = { class: "settings-section" }, Zo = { class: "settings-color-options" }, en = ["title", "onClick"], tn = { class: "settings-section" }, sn = { class: "settings-switch-list" }, on = { class: "settings-switch-item" }, nn = { class: "settings-switch-item" }, an = /* @__PURE__ */ ee({
1372
+ __name: "MixTopMenu",
1373
+ setup(t) {
1374
+ const s = me(), n = ne(), r = ce(), l = ae(), c = G(), $ = be(), m = k(""), y = w(() => {
1375
+ const u = r.menuList.find((o) => o.menuUrl === m.value);
1376
+ return (u == null ? void 0 : u.children) || [];
1377
+ }), p = w(() => r.menuList.find((u) => !!(s.path === u.menuUrl || u.children && u.children.some((o) => s.path.startsWith(o.menuUrl) || s.path === o.menuUrl)))), f = () => {
1378
+ p.value ? m.value = p.value.menuUrl : r.menuList.length > 0 && (m.value = r.menuList[0].menuUrl);
1379
+ }, _ = (u) => {
1380
+ m.value = u;
1381
+ const o = r.menuList.find((Y) => Y.menuUrl === u);
1382
+ if (o)
1383
+ if (o.children && o.children.length > 0) {
1384
+ const Y = o.children[0].menuUrl;
1385
+ s.path !== Y && n.push(Y);
1386
+ } else
1387
+ s.path !== u && n.push(u);
1388
+ }, b = w(() => l.isDark ? "#1d1e1f" : "#fff"), j = w(() => l.isDark ? "#cfd3dc" : "#303133"), T = w(() => "#409eff"), z = k(!1), O = k(null), R = k(!1), D = k(!1), V = k(!1);
1389
+ Ae(() => s.path, () => {
1390
+ f(), l.setMixSubMenus(y.value);
1391
+ }), Ae(() => r.menuList, (u) => {
1392
+ u && u.length > 0 && (f(), l.setMixSubMenus(y.value));
1393
+ }, { immediate: !0 });
1394
+ const U = /* @__PURE__ */ new Set([
1395
+ "arrow-up",
1396
+ "arrow-down",
1397
+ "arrow-left",
1398
+ "arrow-right",
1399
+ "caret-down",
1400
+ "caret-right",
1401
+ "plus",
1402
+ "minus",
1403
+ "close",
1404
+ "check",
1405
+ "edit",
1406
+ "delete",
1407
+ "copy",
1408
+ "download",
1409
+ "upload",
1410
+ "refresh",
1411
+ "search",
1412
+ "filter",
1413
+ "more",
1414
+ "setting",
1415
+ "share",
1416
+ "loading",
1417
+ "info",
1418
+ "success",
1419
+ "warning",
1420
+ "error",
1421
+ "question",
1422
+ "user",
1423
+ "user-add",
1424
+ "user-group",
1425
+ "logout",
1426
+ "login",
1427
+ "file",
1428
+ "folder",
1429
+ "folder-open",
1430
+ "document",
1431
+ "image",
1432
+ "video",
1433
+ "music",
1434
+ "camera",
1435
+ "mail",
1436
+ "phone",
1437
+ "chat",
1438
+ "bell",
1439
+ "message",
1440
+ "eye",
1441
+ "eye-off",
1442
+ "calendar",
1443
+ "clock",
1444
+ "history",
1445
+ "timer",
1446
+ "location",
1447
+ "map",
1448
+ "globe",
1449
+ "star",
1450
+ "heart",
1451
+ "thumb-up",
1452
+ "link",
1453
+ "external-link",
1454
+ "lock",
1455
+ "unlock",
1456
+ "key",
1457
+ "home",
1458
+ "menu",
1459
+ "menu-fold",
1460
+ "menu-unfold",
1461
+ "sidebar-fold",
1462
+ "sidebar-expand",
1463
+ "sidebar-left",
1464
+ "dashboard",
1465
+ "chart",
1466
+ "chart-pie",
1467
+ "chart-line",
1468
+ "report",
1469
+ "analytics",
1470
+ "system",
1471
+ "permission",
1472
+ "role",
1473
+ "user-manage",
1474
+ "log",
1475
+ "notification",
1476
+ "app",
1477
+ "list",
1478
+ "grid",
1479
+ "fullscreen",
1480
+ "fullscreen-exit",
1481
+ "zoom-in",
1482
+ "zoom-out",
1483
+ "print",
1484
+ "bookmark",
1485
+ "tag",
1486
+ "code",
1487
+ "terminal",
1488
+ "database",
1489
+ "server",
1490
+ "cloud",
1491
+ "gift",
1492
+ "moon",
1493
+ "sun",
1494
+ "theme",
1495
+ "skin"
1496
+ ]), W = (u) => {
1497
+ if (!u || u === "") return "";
1498
+ if (u.startsWith("tineco-icon-")) {
1499
+ const Y = u.replace("tineco-icon-", "");
1500
+ return {
1501
+ home: "home",
1502
+ dashboard: "dashboard",
1503
+ system: "system",
1504
+ user: "user",
1505
+ role: "role",
1506
+ menu: "list",
1507
+ setting: "setting",
1508
+ file: "file",
1509
+ folder: "folder",
1510
+ chart: "chart",
1511
+ report: "report",
1512
+ analytics: "analytics"
1513
+ }[Y] || Y;
1514
+ }
1515
+ return {
1516
+ dashboard: "dashboard",
1517
+ system: "system",
1518
+ user: "user",
1519
+ role: "role",
1520
+ menu: "list",
1521
+ setting: "setting",
1522
+ home: "home",
1523
+ chart: "chart",
1524
+ report: "report",
1525
+ analytics: "analytics",
1526
+ permission: "permission",
1527
+ log: "log",
1528
+ notification: "notification",
1529
+ app: "app",
1530
+ list: "list",
1531
+ grid: "grid"
1532
+ }[u] || u;
1533
+ }, N = (u) => u ? u.charAt(0) : "", q = (u) => U.has(u), le = () => {
1534
+ l.toggleTheme(), D.value = !1;
1535
+ }, X = () => {
1536
+ document.fullscreenElement ? document.exitFullscreen() : document.documentElement.requestFullscreen();
1537
+ }, te = () => {
1538
+ R.value = !!document.fullscreenElement;
1539
+ }, re = () => {
1540
+ z.value = !z.value;
1541
+ }, J = () => {
1542
+ z.value = !1;
1543
+ }, M = () => {
1544
+ D.value = !0;
1545
+ }, se = (u) => {
1546
+ V.value = u;
1547
+ const o = document.documentElement;
1548
+ u ? o.classList.add("grey-mode") : o.classList.remove("grey-mode");
1549
+ }, Z = () => {
1550
+ se(!V.value), D.value = !1;
1551
+ }, ie = () => {
1552
+ l.toggleTheme(), D.value = !1;
1553
+ }, pe = [
1554
+ { value: "sidebar", label: "左侧菜单", icon: "sidebar-left" },
1555
+ { value: "top", label: "顶部菜单", icon: "menu" },
1556
+ { value: "mix", label: "混合菜单", icon: "grid" }
1557
+ ], ve = w(() => l.layout), _e = (u) => {
1558
+ l.setLayout(u), D.value = !1;
1559
+ }, he = [
1560
+ { value: "#409eff", label: "默认蓝" },
1561
+ { value: "#1890ff", label: "科技蓝" },
1562
+ { value: "#52c41a", label: "极光绿" },
1563
+ { value: "#faad14", label: "日落橙" },
1564
+ { value: "#f5222d", label: "薄暮红" },
1565
+ { value: "#722ed1", label: "酱紫" }
1566
+ ], fe = (u) => {
1567
+ l.setPrimaryColor(u), D.value = !1;
1568
+ }, ue = () => {
1569
+ J(), n.push("/profile");
1570
+ }, I = () => {
1571
+ J(), n.push("/change-password");
1572
+ }, v = () => {
1573
+ J(), $.logout(), c.clearUserInfo(), r.clearMenu(), n.push("/login");
1574
+ }, h = (u) => {
1575
+ O.value && !O.value.contains(u.target) && J();
1576
+ };
1577
+ return Pe(() => {
1578
+ document.addEventListener("click", h), document.addEventListener("fullscreenchange", te), V.value = document.documentElement.classList.contains("grey-mode"), f();
1579
+ }), Oe(() => {
1580
+ document.removeEventListener("click", h), document.removeEventListener("fullscreenchange", te);
1581
+ }), (u, o) => {
1582
+ var Y;
1583
+ return i(), d("div", $o, [
1584
+ e("div", Lo, [
1585
+ o[1] || (o[1] = e("img", {
1586
+ src: Ue,
1587
+ alt: "Logo",
1588
+ class: "mix-top-menu__logo-img"
1589
+ }, null, -1)),
1590
+ e("span", So, C(a(l).appName), 1)
1591
+ ]),
1592
+ g(a(Ke), {
1593
+ "default-active": m.value,
1594
+ mode: "horizontal",
1595
+ "background-color": b.value,
1596
+ "text-color": j.value,
1597
+ "active-text-color": T.value,
1598
+ class: "mix-top-menu__menu",
1599
+ onSelect: _
1600
+ }, {
1601
+ default: S(() => [
1602
+ (i(!0), d(K, null, H(a(r).menuList, (E) => (i(), F(a(we), {
1603
+ key: E.menuUrl,
1604
+ index: E.menuUrl
1605
+ }, {
1606
+ default: S(() => [
1607
+ e("span", Mo, [
1608
+ E.menuName !== "首页" ? (i(), d("span", Io, [
1609
+ q(W(E.icon)) ? (i(), F(a(L), {
1610
+ key: 0,
1611
+ name: W(E.icon),
1612
+ size: 16
1613
+ }, null, 8, ["name"])) : (i(), d("span", To, C(N(E.menuName)), 1))
1614
+ ])) : P("", !0),
1615
+ e("span", No, C(E.menuName), 1)
1616
+ ])
1617
+ ]),
1618
+ _: 2
1619
+ }, 1032, ["index"]))), 128))
1620
+ ]),
1621
+ _: 1
1622
+ }, 8, ["default-active", "background-color", "text-color", "active-text-color"]),
1623
+ e("div", Eo, [
1624
+ e("div", {
1625
+ class: "mix-top-menu__action",
1626
+ onClick: X,
1627
+ title: R.value ? "退出全屏" : "全屏"
1628
+ }, [
1629
+ g(a(L), {
1630
+ name: R.value ? "fullscreen-exit" : "fullscreen",
1631
+ size: 16
1632
+ }, null, 8, ["name"])
1633
+ ], 8, Uo),
1634
+ e("div", {
1635
+ class: "mix-top-menu__action",
1636
+ onClick: M,
1637
+ title: "换肤设置"
1638
+ }, [
1639
+ g(a(L), {
1640
+ name: "skin",
1641
+ size: 16
1642
+ })
1643
+ ]),
1644
+ e("div", {
1645
+ class: "mix-top-menu__action",
1646
+ onClick: le,
1647
+ title: "切换主题"
1648
+ }, [
1649
+ g(a(L), {
1650
+ name: a(l).isDark ? "sun" : "moon",
1651
+ size: 16
1652
+ }, null, 8, ["name"])
1653
+ ]),
1654
+ e("div", {
1655
+ class: "mix-top-menu__user",
1656
+ ref_key: "dropdownRef",
1657
+ ref: O
1658
+ }, [
1659
+ e("div", {
1660
+ class: "mix-top-menu__user-trigger",
1661
+ onClick: Te(re, ["stop"])
1662
+ }, [
1663
+ e("div", Do, [
1664
+ e("span", null, C(((Y = a(c).userName) == null ? void 0 : Y.charAt(0)) || "U"), 1)
1665
+ ]),
1666
+ e("span", zo, C(a(c).userName), 1),
1667
+ e("span", {
1668
+ class: B(["mix-top-menu__user-arrow", { "is-active": z.value }])
1669
+ }, "▼", 2)
1670
+ ]),
1671
+ g(Le, { name: "dropdown" }, {
1672
+ default: S(() => {
1673
+ var E;
1674
+ return [
1675
+ z.value ? (i(), d("div", Ro, [
1676
+ e("div", Ao, [
1677
+ e("div", Po, [
1678
+ e("span", null, C(((E = a(c).userName) == null ? void 0 : E.charAt(0)) || "U"), 1)
1679
+ ]),
1680
+ e("div", Oo, [
1681
+ e("div", Vo, C(a(c).userName), 1),
1682
+ e("div", Fo, C(a(c).departmentName), 1)
1683
+ ])
1684
+ ]),
1685
+ o[6] || (o[6] = e("div", { class: "mix-top-menu__dropdown-divider" }, null, -1)),
1686
+ e("div", Bo, [
1687
+ e("div", {
1688
+ class: "mix-top-menu__dropdown-item",
1689
+ onClick: ue
1690
+ }, [
1691
+ g(a(L), {
1692
+ name: "user",
1693
+ size: 16
1694
+ }),
1695
+ o[2] || (o[2] = e("span", null, "个人信息", -1))
1696
+ ]),
1697
+ e("div", {
1698
+ class: "mix-top-menu__dropdown-item",
1699
+ onClick: I
1700
+ }, [
1701
+ g(a(L), {
1702
+ name: "lock",
1703
+ size: 16
1704
+ }),
1705
+ o[3] || (o[3] = e("span", null, "修改密码", -1))
1706
+ ]),
1707
+ o[5] || (o[5] = e("div", { class: "mix-top-menu__dropdown-divider" }, null, -1)),
1708
+ e("div", {
1709
+ class: "mix-top-menu__dropdown-item mix-top-menu__dropdown-item--danger",
1710
+ onClick: v
1711
+ }, [
1712
+ g(a(L), {
1713
+ name: "logout",
1714
+ size: 16
1715
+ }),
1716
+ o[4] || (o[4] = e("span", null, "退出登录", -1))
1717
+ ])
1718
+ ])
1719
+ ])) : P("", !0)
1720
+ ];
1721
+ }),
1722
+ _: 1
1723
+ })
1724
+ ], 512)
1725
+ ]),
1726
+ g(a(je), {
1727
+ modelValue: D.value,
1728
+ "onUpdate:modelValue": o[0] || (o[0] = (E) => D.value = E),
1729
+ title: "换肤设置",
1730
+ direction: "rtl",
1731
+ size: "320px"
1732
+ }, {
1733
+ default: S(() => [
1734
+ e("div", Ko, [
1735
+ e("div", jo, [
1736
+ o[10] || (o[10] = e("div", { class: "settings-title" }, "布局模式", -1)),
1737
+ e("div", qo, [
1738
+ (i(), d(K, null, H(pe, (E) => e("div", {
1739
+ key: E.value,
1740
+ class: B(["layout-option", { "is-active": ve.value === E.value }]),
1741
+ onClick: (dt) => _e(E.value)
1742
+ }, [
1743
+ e("div", Wo, [
1744
+ E.value === "sidebar" ? (i(), d("div", Ho, [...o[7] || (o[7] = [
1745
+ e("div", { class: "preview-aside" }, null, -1),
1746
+ e("div", { class: "preview-main" }, [
1747
+ e("div", { class: "preview-header" }),
1748
+ e("div", { class: "preview-content" })
1749
+ ], -1)
1750
+ ])])) : E.value === "top" ? (i(), d("div", Go, [...o[8] || (o[8] = [
1751
+ e("div", { class: "preview-header-full" }, null, -1),
1752
+ e("div", { class: "preview-content-full" }, null, -1)
1753
+ ])])) : (i(), d("div", Xo, [...o[9] || (o[9] = [
1754
+ e("div", { class: "preview-header-mix" }, [
1755
+ e("div", { class: "preview-mix-left" })
1756
+ ], -1),
1757
+ e("div", { class: "preview-mix-body" }, [
1758
+ e("div", { class: "preview-mix-aside" }),
1759
+ e("div", { class: "preview-mix-content" })
1760
+ ], -1)
1761
+ ])]))
1762
+ ]),
1763
+ e("span", Jo, C(E.label), 1)
1764
+ ], 10, Yo)), 64))
1765
+ ])
1766
+ ]),
1767
+ e("div", Qo, [
1768
+ o[11] || (o[11] = e("div", { class: "settings-title" }, "主题色", -1)),
1769
+ e("div", Zo, [
1770
+ (i(), d(K, null, H(he, (E) => e("div", {
1771
+ key: E.value,
1772
+ class: B(["color-option", { "is-active": a(l).primaryColor === E.value }]),
1773
+ style: ke({ backgroundColor: E.value }),
1774
+ title: E.label,
1775
+ onClick: (dt) => fe(E.value)
1776
+ }, [
1777
+ a(l).primaryColor === E.value ? (i(), F(a(L), {
1778
+ key: 0,
1779
+ name: "check",
1780
+ size: 12,
1781
+ color: "#fff"
1782
+ })) : P("", !0)
1783
+ ], 14, en)), 64))
1784
+ ])
1785
+ ]),
1786
+ e("div", tn, [
1787
+ o[16] || (o[16] = e("div", { class: "settings-title" }, "功能设置", -1)),
1788
+ e("div", sn, [
1789
+ e("div", on, [
1790
+ o[13] || (o[13] = e("span", null, "灰色模式", -1)),
1791
+ e("div", {
1792
+ class: B(["switch-wrapper", { "is-checked": V.value }]),
1793
+ onClick: Z
1794
+ }, [...o[12] || (o[12] = [
1795
+ e("span", { class: "switch-core" }, null, -1)
1796
+ ])], 2)
1797
+ ]),
1798
+ e("div", nn, [
1799
+ o[15] || (o[15] = e("span", null, "暗黑模式", -1)),
1800
+ e("div", {
1801
+ class: B(["switch-wrapper", { "is-checked": a(l).isDark }]),
1802
+ onClick: ie
1803
+ }, [...o[14] || (o[14] = [
1804
+ e("span", { class: "switch-core" }, null, -1)
1805
+ ])], 2)
1806
+ ])
1807
+ ])
1808
+ ])
1809
+ ])
1810
+ ]),
1811
+ _: 1
1812
+ }, 8, ["modelValue"])
1813
+ ]);
1814
+ };
1815
+ }
1816
+ }), ln = /* @__PURE__ */ Q(an, [["__scopeId", "data-v-e34b966d"]]), rn = {
1817
+ key: 0,
1818
+ class: "layout layout--sidebar"
1819
+ }, un = { class: "layout__main" }, cn = { class: "layout__header" }, dn = { class: "layout__content" }, mn = {
1820
+ key: 1,
1821
+ class: "layout layout--top"
1822
+ }, pn = { class: "layout__top-menu" }, vn = { class: "layout__main" }, _n = { class: "layout__content" }, hn = {
1823
+ key: 2,
1824
+ class: "layout layout--mix"
1825
+ }, fn = { class: "layout__mix-top-menu" }, gn = { class: "layout__mix-body" }, yn = { class: "layout__content" }, kn = /* @__PURE__ */ ee({
1826
+ __name: "index",
1827
+ setup(t) {
1828
+ const s = ae(), n = ce(), r = w(
1829
+ () => s.isCollapsed ? "64px" : "210px"
1830
+ ), l = w(() => s.layout), c = w(() => l.value === "mix"), $ = w(() => l.value === "sidebar" ? n.menuList : l.value === "mix" ? s.mixSubMenus : []), m = w(() => c.value ? $.value.length > 0 : !1);
1831
+ return (y, p) => {
1832
+ const f = vt("router-view");
1833
+ return i(), d(K, null, [
1834
+ l.value === "sidebar" ? (i(), d("div", rn, [
1835
+ e("aside", {
1836
+ class: "layout__aside",
1837
+ style: ke({ width: r.value })
1838
+ }, [
1839
+ g(Ze, {
1840
+ "menu-list": $.value,
1841
+ "show-logo": !0,
1842
+ "show-user": !0
1843
+ }, null, 8, ["menu-list"])
1844
+ ], 4),
1845
+ e("div", un, [
1846
+ e("header", cn, [
1847
+ g(Us)
1848
+ ]),
1849
+ e("main", dn, [
1850
+ g(f)
1851
+ ])
1852
+ ])
1853
+ ])) : P("", !0),
1854
+ l.value === "top" ? (i(), d("div", mn, [
1855
+ e("div", pn, [
1856
+ g(Co)
1857
+ ]),
1858
+ e("div", vn, [
1859
+ e("main", _n, [
1860
+ g(f)
1861
+ ])
1862
+ ])
1863
+ ])) : P("", !0),
1864
+ l.value === "mix" ? (i(), d("div", hn, [
1865
+ e("div", fn, [
1866
+ g(ln)
1867
+ ]),
1868
+ e("div", gn, [
1869
+ m.value ? (i(), d("aside", {
1870
+ key: 0,
1871
+ class: "layout__aside",
1872
+ style: ke({ width: r.value })
1873
+ }, [
1874
+ g(Ze, {
1875
+ "menu-list": $.value,
1876
+ "show-logo": !1,
1877
+ "show-user": !1
1878
+ }, null, 8, ["menu-list"])
1879
+ ], 4)) : P("", !0),
1880
+ e("main", yn, [
1881
+ g(f)
1882
+ ])
1883
+ ])
1884
+ ])) : P("", !0)
1885
+ ], 64);
1886
+ };
1887
+ }
1888
+ }), lt = /* @__PURE__ */ Q(kn, [["__scopeId", "data-v-70b115a5"]]), wn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1889
+ __proto__: null,
1890
+ default: lt
1891
+ }, Symbol.toStringTag, { value: "Module" })), bn = { class: "tabs-wrapper" }, xn = { class: "tab-label" }, Cn = ["onClick"], $n = /* @__PURE__ */ ee({
1892
+ __name: "Tabs",
1893
+ setup(t) {
1894
+ const s = me(), n = ne(), r = w(() => {
1895
+ const m = [];
1896
+ return s.matched.forEach((y) => {
1897
+ var p;
1898
+ (p = y.meta) != null && p.affix && m.push({
1899
+ name: y.name,
1900
+ title: y.meta.title,
1901
+ path: y.path,
1902
+ affix: !0
1903
+ });
1904
+ }), m;
1905
+ }), l = w(() => s.path), c = (m) => {
1906
+ n.push(m);
1907
+ }, $ = (m) => {
1908
+ const y = r.value.find((p) => p.path === m);
1909
+ if (!(y != null && y.affix) && m === l.value) {
1910
+ const p = r.value.findIndex((_) => _.path === m), f = r.value[p - 1] || r.value[p + 1];
1911
+ f && n.push(f.path);
1912
+ }
1913
+ };
1914
+ return (m, y) => (i(), d("div", bn, [
1915
+ g(a(ht), {
1916
+ modelValue: l.value,
1917
+ "onUpdate:modelValue": y[0] || (y[0] = (p) => l.value = p),
1918
+ type: "card",
1919
+ onTabClick: c
1920
+ }, {
1921
+ default: S(() => [
1922
+ (i(!0), d(K, null, H(r.value, (p) => (i(), F(a(ft), {
1923
+ key: p.path,
1924
+ name: p.path,
1925
+ label: p.title,
1926
+ closable: !p.affix
1927
+ }, {
1928
+ label: S(() => [
1929
+ e("span", xn, [
1930
+ de(C(p.title) + " ", 1),
1931
+ p.affix ? P("", !0) : (i(), d("span", {
1932
+ key: 0,
1933
+ class: "tab-close",
1934
+ onClick: Te((f) => $(p.path), ["stop"])
1935
+ }, " ✕ ", 8, Cn))
1936
+ ])
1937
+ ]),
1938
+ _: 2
1939
+ }, 1032, ["name", "label", "closable"]))), 128))
1940
+ ]),
1941
+ _: 1
1942
+ }, 8, ["modelValue"])
1943
+ ]));
1944
+ }
1945
+ }), ca = /* @__PURE__ */ Q($n, [["__scopeId", "data-v-9156d8cd"]]), Ln = {}, Sn = { class: "footer" };
1946
+ function Mn(t, s) {
1947
+ return i(), d("div", Sn, [...s[0] || (s[0] = [
1948
+ e("span", null, "Copyright © 2024 Xto Demo. All Rights Reserved.", -1)
1949
+ ])]);
1950
+ }
1951
+ const da = /* @__PURE__ */ Q(Ln, [["render", Mn], ["__scopeId", "data-v-4852826a"]]), In = () => {
1952
+ const t = kt.create({
1953
+ baseURL: void 0,
1954
+ timeout: 3e4,
1955
+ headers: {
1956
+ "Content-Type": "application/json"
1957
+ }
1958
+ });
1959
+ return t.interceptors.request.use(
1960
+ (s) => {
1961
+ const n = De(), r = xt() || "Bearer";
1962
+ return n && (s.headers.Authorization = `${r} ${n}`), s;
1963
+ },
1964
+ (s) => Promise.reject(s)
1965
+ ), t.interceptors.response.use(
1966
+ (s) => {
1967
+ const { data: n } = s;
1968
+ return n.code === 200 || n.code === 0 ? n.data : (oe.error(n.message || "请求失败"), Promise.reject(new Error(n.message || "请求失败")));
1969
+ },
1970
+ (s) => {
1971
+ var r;
1972
+ const { response: n } = s;
1973
+ if (n)
1974
+ switch (n.status) {
1975
+ case 401:
1976
+ oe.error("登录已过期,请重新登录"), nt(), window.location.href = "/login";
1977
+ break;
1978
+ case 403:
1979
+ oe.error("没有权限访问");
1980
+ break;
1981
+ case 404:
1982
+ oe.error("请求资源不存在");
1983
+ break;
1984
+ case 500:
1985
+ oe.error("服务器错误");
1986
+ break;
1987
+ default:
1988
+ oe.error(((r = n.data) == null ? void 0 : r.message) || "请求失败");
1989
+ }
1990
+ else
1991
+ oe.error("网络连接失败");
1992
+ return Promise.reject(s);
1993
+ }
1994
+ ), t;
1995
+ }, ye = In(), A = {
1996
+ get(t, s) {
1997
+ return ye.get(t, s);
1998
+ },
1999
+ post(t, s, n) {
2000
+ return ye.post(t, s, n);
2001
+ },
2002
+ put(t, s, n) {
2003
+ return ye.put(t, s, n);
2004
+ },
2005
+ patch(t, s, n) {
2006
+ return ye.patch(t, s, n);
2007
+ },
2008
+ delete(t, s) {
2009
+ return ye.delete(t, s);
2010
+ }
2011
+ };
2012
+ function Tn(t) {
2013
+ return A.post("/user/v1.0/login/by-domain", t);
2014
+ }
2015
+ function ma() {
2016
+ return A.put("/user/v1.0/user/logout");
2017
+ }
2018
+ function Nn() {
2019
+ return A.get("/user/v1.0/user/get-me");
2020
+ }
2021
+ function pa(t) {
2022
+ return A.post("/user/v1.0/refresh", { refreshToken: t });
2023
+ }
2024
+ const Se = k(""), Me = k(""), Ie = k("");
2025
+ function va(t) {
2026
+ t.appId && (Se.value = t.appId), t.clientId && (Me.value = t.clientId), t.apiBaseUrl && (Ie.value = t.apiBaseUrl);
2027
+ }
2028
+ function Je() {
2029
+ if (Se.value)
2030
+ return Se.value;
2031
+ try {
2032
+ return "";
2033
+ } catch {
2034
+ return "";
2035
+ }
2036
+ }
2037
+ function En() {
2038
+ if (Me.value)
2039
+ return Me.value;
2040
+ try {
2041
+ return "";
2042
+ } catch {
2043
+ return "";
2044
+ }
2045
+ }
2046
+ function _a() {
2047
+ if (Ie.value)
2048
+ return Ie.value;
2049
+ try {
2050
+ return "";
2051
+ } catch {
2052
+ return "";
2053
+ }
2054
+ }
2055
+ const ha = {
2056
+ appId: Se,
2057
+ clientId: Me,
2058
+ apiBaseUrl: Ie
2059
+ }, Un = { class: "login" }, Dn = { class: "login__container" }, zn = /* @__PURE__ */ ee({
2060
+ __name: "index",
2061
+ setup(t) {
2062
+ const s = ne(), n = me(), r = k(!1), l = k(!1), c = Ve({
2063
+ uid: "",
2064
+ password: ""
2065
+ }), $ = {
2066
+ uid: [
2067
+ { required: !0, message: "请输入用户名", trigger: "blur" }
2068
+ ],
2069
+ password: [
2070
+ { required: !0, message: "请输入密码", trigger: "blur" },
2071
+ { min: 6, message: "密码长度至少6位", trigger: "blur" }
2072
+ ]
2073
+ }, m = k(), y = async () => {
2074
+ var p;
2075
+ try {
2076
+ await ((p = m.value) == null ? void 0 : p.validate()), r.value = !0;
2077
+ const f = await Tn({
2078
+ appId: Je(),
2079
+ clientId: En(),
2080
+ uid: c.uid,
2081
+ password: c.password,
2082
+ code: !0
2083
+ });
2084
+ ot(f), oe.success("登录成功");
2085
+ const _ = n.query.redirect || "/";
2086
+ s.push(_);
2087
+ } catch (f) {
2088
+ console.error("登录失败:", f);
2089
+ } finally {
2090
+ r.value = !1;
2091
+ }
2092
+ };
2093
+ return (p, f) => (i(), d("div", Un, [
2094
+ e("div", Dn, [
2095
+ f[5] || (f[5] = e("div", { class: "login__header" }, [
2096
+ e("img", {
2097
+ src: Ue,
2098
+ alt: "Logo",
2099
+ class: "login__logo"
2100
+ }),
2101
+ e("h1", { class: "login__title" }, "Xto Demo"),
2102
+ e("p", { class: "login__subtitle" }, "后台管理系统")
2103
+ ], -1)),
2104
+ g(a(gt), {
2105
+ ref_key: "formRef",
2106
+ ref: m,
2107
+ model: c,
2108
+ rules: $,
2109
+ class: "login__form",
2110
+ "label-width": "0"
2111
+ }, {
2112
+ default: S(() => [
2113
+ g(a(xe), { prop: "uid" }, {
2114
+ default: S(() => [
2115
+ g(a(Qe), {
2116
+ modelValue: c.uid,
2117
+ "onUpdate:modelValue": f[0] || (f[0] = (_) => c.uid = _),
2118
+ placeholder: "用户名",
2119
+ size: "large"
2120
+ }, {
2121
+ prefix: S(() => [
2122
+ g(a(L), {
2123
+ name: "user",
2124
+ size: 18
2125
+ })
2126
+ ]),
2127
+ _: 1
2128
+ }, 8, ["modelValue"])
2129
+ ]),
2130
+ _: 1
2131
+ }),
2132
+ g(a(xe), { prop: "password" }, {
2133
+ default: S(() => [
2134
+ g(a(Qe), {
2135
+ modelValue: c.password,
2136
+ "onUpdate:modelValue": f[1] || (f[1] = (_) => c.password = _),
2137
+ type: "password",
2138
+ placeholder: "密码",
2139
+ size: "large",
2140
+ "show-password": "",
2141
+ onKeyup: _t(y, ["enter"])
2142
+ }, {
2143
+ prefix: S(() => [
2144
+ g(a(L), {
2145
+ name: "lock",
2146
+ size: 18
2147
+ })
2148
+ ]),
2149
+ _: 1
2150
+ }, 8, ["modelValue"])
2151
+ ]),
2152
+ _: 1
2153
+ }),
2154
+ g(a(xe), null, {
2155
+ default: S(() => [
2156
+ g(a(yt), {
2157
+ modelValue: l.value,
2158
+ "onUpdate:modelValue": f[2] || (f[2] = (_) => l.value = _)
2159
+ }, {
2160
+ default: S(() => [...f[3] || (f[3] = [
2161
+ de("记住我", -1)
2162
+ ])]),
2163
+ _: 1
2164
+ }, 8, ["modelValue"])
2165
+ ]),
2166
+ _: 1
2167
+ }),
2168
+ g(a(xe), null, {
2169
+ default: S(() => [
2170
+ g(a(Ee), {
2171
+ type: "primary",
2172
+ size: "large",
2173
+ loading: r.value,
2174
+ class: "login__submit",
2175
+ onClick: y
2176
+ }, {
2177
+ default: S(() => [...f[4] || (f[4] = [
2178
+ de(" 登录 ", -1)
2179
+ ])]),
2180
+ _: 1
2181
+ }, 8, ["loading"])
2182
+ ]),
2183
+ _: 1
2184
+ })
2185
+ ]),
2186
+ _: 1
2187
+ }, 8, ["model"]),
2188
+ f[6] || (f[6] = e("div", { class: "login__footer" }, [
2189
+ e("p", null, "请输入您的用户名和密码")
2190
+ ], -1))
2191
+ ])
2192
+ ]));
2193
+ }
2194
+ }), Rn = /* @__PURE__ */ Q(zn, [["__scopeId", "data-v-f3e724b6"]]), An = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2195
+ __proto__: null,
2196
+ default: Rn
2197
+ }, Symbol.toStringTag, { value: "Module" })), Pn = { class: "error-page" }, On = { class: "error-page__content" }, Vn = /* @__PURE__ */ ee({
2198
+ __name: "404",
2199
+ setup(t) {
2200
+ const s = ne(), n = () => {
2201
+ s.push("/");
2202
+ };
2203
+ return (r, l) => (i(), d("div", Pn, [
2204
+ e("div", On, [
2205
+ l[1] || (l[1] = e("div", { class: "error-page__code" }, "404", -1)),
2206
+ l[2] || (l[2] = e("div", { class: "error-page__title" }, "页面不存在", -1)),
2207
+ l[3] || (l[3] = e("div", { class: "error-page__desc" }, "抱歉,您访问的页面不存在或已被删除", -1)),
2208
+ g(a(Ee), {
2209
+ type: "primary",
2210
+ onClick: n
2211
+ }, {
2212
+ default: S(() => [...l[0] || (l[0] = [
2213
+ de("返回首页", -1)
2214
+ ])]),
2215
+ _: 1
2216
+ })
2217
+ ])
2218
+ ]));
2219
+ }
2220
+ }), Fn = /* @__PURE__ */ Q(Vn, [["__scopeId", "data-v-54fcac4c"]]), rt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2221
+ __proto__: null,
2222
+ default: Fn
2223
+ }, Symbol.toStringTag, { value: "Module" })), Bn = { class: "error-page" }, Kn = { class: "error-page__content" }, jn = /* @__PURE__ */ ee({
2224
+ __name: "403",
2225
+ setup(t) {
2226
+ const s = ne(), n = () => {
2227
+ s.push("/");
2228
+ };
2229
+ return (r, l) => (i(), d("div", Bn, [
2230
+ e("div", Kn, [
2231
+ l[1] || (l[1] = e("div", { class: "error-page__code" }, "403", -1)),
2232
+ l[2] || (l[2] = e("div", { class: "error-page__title" }, "无访问权限", -1)),
2233
+ l[3] || (l[3] = e("div", { class: "error-page__desc" }, "抱歉,您没有权限访问此页面", -1)),
2234
+ g(a(Ee), {
2235
+ type: "primary",
2236
+ onClick: n
2237
+ }, {
2238
+ default: S(() => [...l[0] || (l[0] = [
2239
+ de("返回首页", -1)
2240
+ ])]),
2241
+ _: 1
2242
+ })
2243
+ ])
2244
+ ]));
2245
+ }
2246
+ }), fa = /* @__PURE__ */ Q(jn, [["__scopeId", "data-v-b2ff9b3e"]]);
2247
+ function ga() {
2248
+ const t = ae(), s = G(), n = be(), r = w(() => s.userName || ""), l = w(() => s.userInfo), c = w(() => t.appName), $ = w(() => n.isLoggedIn), m = w(() => t.isDark), y = w(() => t.theme), p = w(() => t.isCollapsed), f = w(() => t.layout);
2249
+ return {
2250
+ userName: r,
2251
+ userInfo: l,
2252
+ appName: c,
2253
+ isLoggedIn: $,
2254
+ isDark: m,
2255
+ theme: y,
2256
+ isCollapsed: p,
2257
+ layout: f,
2258
+ toggleTheme: () => {
2259
+ t.toggleTheme();
2260
+ },
2261
+ toggleCollapse: () => {
2262
+ t.toggleCollapse();
2263
+ }
2264
+ };
2265
+ }
2266
+ function ya() {
2267
+ const t = G();
2268
+ return {
2269
+ isLoggedIn: w(() => t.isLoggedIn)
2270
+ };
2271
+ }
2272
+ function ka(t, s = {}) {
2273
+ const { rules: n, onSubmit: r } = s, l = k(), c = Ve({ ...t }), $ = k(!1), m = k(!1), y = k(!1), p = () => {
2274
+ b(), y.value = !1, m.value = !0;
2275
+ }, f = (T) => {
2276
+ Object.assign(c, T), y.value = !0, m.value = !0;
2277
+ }, _ = () => {
2278
+ m.value = !1, b();
2279
+ }, b = () => {
2280
+ var T;
2281
+ Object.keys(t).forEach((z) => {
2282
+ c[z] = t[z];
2283
+ }), (T = l.value) == null || T.resetFields();
2284
+ };
2285
+ return {
2286
+ formRef: l,
2287
+ formData: c,
2288
+ rules: n,
2289
+ loading: $,
2290
+ visible: m,
2291
+ isEdit: y,
2292
+ openAdd: p,
2293
+ openEdit: f,
2294
+ close: _,
2295
+ resetForm: b,
2296
+ handleSubmit: async () => {
2297
+ var T;
2298
+ try {
2299
+ await ((T = l.value) == null ? void 0 : T.validate()), $.value = !0, await (r == null ? void 0 : r(c)), _();
2300
+ } catch (z) {
2301
+ console.error(z);
2302
+ } finally {
2303
+ $.value = !1;
2304
+ }
2305
+ }
2306
+ };
2307
+ }
2308
+ function wa(t) {
2309
+ const { fetchData: s, defaultPageSize: n = 10 } = t, r = k(!1), l = k([]), c = k(0), $ = k(1), m = k(n), y = Ve({}), p = async () => {
2310
+ r.value = !0;
2311
+ try {
2312
+ const O = {
2313
+ ...y,
2314
+ page: $.value,
2315
+ pageSize: m.value
2316
+ }, R = await s(O);
2317
+ l.value = R.list, c.value = R.total;
2318
+ } catch (O) {
2319
+ console.error(O);
2320
+ } finally {
2321
+ r.value = !1;
2322
+ }
2323
+ }, f = () => {
2324
+ $.value = 1, p();
2325
+ }, _ = () => {
2326
+ Object.keys(y).forEach((O) => {
2327
+ y[O] = void 0;
2328
+ }), $.value = 1, p();
2329
+ }, b = (O) => {
2330
+ $.value = O, p();
2331
+ }, j = (O) => {
2332
+ m.value = O, $.value = 1, p();
2333
+ }, T = () => {
2334
+ p();
2335
+ }, z = w(() => ({
2336
+ current: $.value,
2337
+ pageSize: m.value,
2338
+ total: c.value
2339
+ }));
2340
+ return {
2341
+ loading: r,
2342
+ data: l,
2343
+ total: c,
2344
+ currentPage: $,
2345
+ pageSize: m,
2346
+ searchParams: y,
2347
+ pagination: z,
2348
+ getData: p,
2349
+ handleSearch: f,
2350
+ handleReset: _,
2351
+ handlePageChange: b,
2352
+ handleSizeChange: j,
2353
+ refresh: T
2354
+ };
2355
+ }
2356
+ function ba(t) {
2357
+ return G().isLoggedIn;
2358
+ }
2359
+ function xa(t) {
2360
+ return G().isLoggedIn;
2361
+ }
2362
+ function Ca() {
2363
+ return !0;
2364
+ }
2365
+ const it = [
2366
+ {
2367
+ path: "/login",
2368
+ name: "Login",
2369
+ component: () => Promise.resolve().then(() => An),
2370
+ meta: {
2371
+ title: "登录",
2372
+ hidden: !0
2373
+ }
2374
+ }
2375
+ ], ut = {
2376
+ path: "/",
2377
+ name: "Layout",
2378
+ component: () => Promise.resolve().then(() => wn),
2379
+ redirect: "/dashboard",
2380
+ children: [
2381
+ {
2382
+ path: "/dashboard",
2383
+ name: "Dashboard",
2384
+ component: () => import("./index-BAOHlfVd.js"),
2385
+ meta: {
2386
+ title: "仪表盘",
2387
+ icon: "dashboard",
2388
+ keepAlive: !0,
2389
+ affix: !0
2390
+ }
2391
+ },
2392
+ {
2393
+ path: "/system/user",
2394
+ name: "SystemUser",
2395
+ component: () => import("./index-Dtw-qZ0V.js"),
2396
+ meta: {
2397
+ title: "用户管理",
2398
+ icon: "user",
2399
+ keepAlive: !0
2400
+ }
2401
+ },
2402
+ {
2403
+ path: "/system/role",
2404
+ name: "SystemRole",
2405
+ component: () => import("./index-CBKo6Enz.js"),
2406
+ meta: {
2407
+ title: "角色管理",
2408
+ icon: "role",
2409
+ keepAlive: !0
2410
+ }
2411
+ },
2412
+ {
2413
+ path: "/system/menu",
2414
+ name: "SystemMenu",
2415
+ component: () => import("./index-DVS-5SZn.js"),
2416
+ meta: {
2417
+ title: "菜单管理",
2418
+ icon: "menu",
2419
+ keepAlive: !0
2420
+ }
2421
+ },
2422
+ // catch-all 路由:让 404 在 Layout 内部渲染,保持左侧菜单显示
2423
+ {
2424
+ path: "/:pathMatch(.*)*",
2425
+ name: "CatchAll",
2426
+ component: () => Promise.resolve().then(() => rt),
2427
+ meta: {
2428
+ title: "404",
2429
+ hidden: !0
2430
+ }
2431
+ }
2432
+ ]
2433
+ }, $a = [
2434
+ {
2435
+ path: "/dashboard",
2436
+ name: "Dashboard",
2437
+ component: () => import("./index-BAOHlfVd.js"),
2438
+ meta: {
2439
+ title: "仪表盘",
2440
+ icon: "dashboard",
2441
+ keepAlive: !0,
2442
+ affix: !0
2443
+ }
2444
+ },
2445
+ {
2446
+ path: "/system",
2447
+ name: "System",
2448
+ redirect: "/system/user",
2449
+ meta: {
2450
+ title: "系统管理",
2451
+ icon: "setting"
2452
+ },
2453
+ children: [
2454
+ {
2455
+ path: "user",
2456
+ name: "SystemUser",
2457
+ component: () => import("./index-Dtw-qZ0V.js"),
2458
+ meta: {
2459
+ title: "用户管理",
2460
+ icon: "user",
2461
+ keepAlive: !0
2462
+ }
2463
+ },
2464
+ {
2465
+ path: "role",
2466
+ name: "SystemRole",
2467
+ component: () => import("./index-CBKo6Enz.js"),
2468
+ meta: {
2469
+ title: "角色管理",
2470
+ icon: "role",
2471
+ keepAlive: !0
2472
+ }
2473
+ },
2474
+ {
2475
+ path: "menu",
2476
+ name: "SystemMenu",
2477
+ component: () => import("./index-DVS-5SZn.js"),
2478
+ meta: {
2479
+ title: "菜单管理",
2480
+ icon: "menu",
2481
+ keepAlive: !0
2482
+ }
2483
+ }
2484
+ ]
2485
+ }
2486
+ ], qn = [
2487
+ {
2488
+ menuCode: "dashboard",
2489
+ menuName: "仪表盘",
2490
+ menuUrl: "/dashboard",
2491
+ icon: "dashboard",
2492
+ closable: !0,
2493
+ isDefault: !0,
2494
+ isOut: !1
2495
+ },
2496
+ {
2497
+ menuCode: "system",
2498
+ menuName: "系统管理",
2499
+ menuUrl: "/system",
2500
+ icon: "setting",
2501
+ closable: !1,
2502
+ isDefault: !1,
2503
+ isOut: !1,
2504
+ children: [
2505
+ {
2506
+ menuCode: "system_user",
2507
+ menuName: "用户管理",
2508
+ menuUrl: "/system/user",
2509
+ icon: "user",
2510
+ closable: !0,
2511
+ isDefault: !1,
2512
+ isOut: !1
2513
+ },
2514
+ {
2515
+ menuCode: "system_role",
2516
+ menuName: "角色管理",
2517
+ menuUrl: "/system/role",
2518
+ icon: "role",
2519
+ closable: !0,
2520
+ isDefault: !1,
2521
+ isOut: !1
2522
+ },
2523
+ {
2524
+ menuCode: "system_menu",
2525
+ menuName: "菜单管理",
2526
+ menuUrl: "/system/menu",
2527
+ icon: "menu",
2528
+ closable: !0,
2529
+ isDefault: !1,
2530
+ isOut: !1
2531
+ }
2532
+ ]
2533
+ }
2534
+ ], ct = Fe({
2535
+ history: Be(),
2536
+ routes: [...it, ut],
2537
+ scrollBehavior: () => ({ left: 0, top: 0 })
2538
+ }), Yn = ["/login"];
2539
+ ct.beforeEach(async (t, s, n) => {
2540
+ const r = ae();
2541
+ if (r.initTheme(), at())
2542
+ if (t.path === "/login")
2543
+ n({ path: "/" });
2544
+ else {
2545
+ const l = G();
2546
+ l.isLoggedIn || (l.setUserInfo({
2547
+ appId: Je(),
2548
+ userId: "1",
2549
+ userName: "管理员",
2550
+ departmentName: "技术部",
2551
+ email: "admin@example.com",
2552
+ mobilePhone: "13800138000",
2553
+ positionName: "管理员",
2554
+ avatar: ""
2555
+ }), ce().setMenuList(qn)), t.name && t.meta.keepAlive && r.addCachedView(t.name), n();
2556
+ }
2557
+ else
2558
+ Yn.includes(t.path) ? n() : n("/login");
2559
+ });
2560
+ function La() {
2561
+ const t = Fe({
2562
+ history: Be(),
2563
+ routes: [...it, ut]
2564
+ });
2565
+ ct.matcher = t.matcher;
2566
+ }
2567
+ function Sa(t, s = {}) {
2568
+ const n = s.indexPath || "/dashboard", r = {
2569
+ path: "/:pathMatch(.*)*",
2570
+ name: "CatchAll",
2571
+ component: () => Promise.resolve().then(() => rt),
2572
+ meta: {
2573
+ title: "404"
2574
+ }
2575
+ };
2576
+ return {
2577
+ path: "/",
2578
+ name: "Layout",
2579
+ component: lt,
2580
+ redirect: n,
2581
+ children: [...t, r]
2582
+ };
2583
+ }
2584
+ function Ma(t) {
2585
+ return Fe({
2586
+ history: Be(),
2587
+ routes: t,
2588
+ scrollBehavior: () => ({ left: 0, top: 0 })
2589
+ });
2590
+ }
2591
+ function Ia(t) {
2592
+ return A.get("/role/list", { params: t });
2593
+ }
2594
+ function Ta(t) {
2595
+ return A.get(`/role/${t}`);
2596
+ }
2597
+ function Na(t) {
2598
+ return A.post("/role", t);
2599
+ }
2600
+ function Ea(t, s) {
2601
+ return A.put(`/role/${t}`, s);
2602
+ }
2603
+ function Ua(t) {
2604
+ return A.delete(`/role/${t}`);
2605
+ }
2606
+ function Da(t, s) {
2607
+ return A.patch(`/role/${t}/status`, { status: s });
2608
+ }
2609
+ function za() {
2610
+ return A.get("/user/v1.0/menu/list");
2611
+ }
2612
+ function Wn(t) {
2613
+ const s = t || Je();
2614
+ return A.get(`/user/v1.0/menu/get-menu?appId=${s}`);
2615
+ }
2616
+ function Ra(t) {
2617
+ return A.post("/menu", t);
2618
+ }
2619
+ function Aa(t, s) {
2620
+ return A.put(`/menu/${t}`, s);
2621
+ }
2622
+ function Pa(t) {
2623
+ return A.delete(`/menu/${t}`);
2624
+ }
2625
+ const Hn = ["/login", "/404", "/403"];
2626
+ function Oa(t, s = {}) {
2627
+ const n = s.whiteList || Hn, r = s.loginPath || "/login", l = s.homePath || "/";
2628
+ t.beforeEach(async (c, $, m) => {
2629
+ const y = ae(), p = G(), f = ce();
2630
+ if (y.initTheme(), De())
2631
+ if (c.path === r)
2632
+ m({ path: l });
2633
+ else if (p.isLoggedIn)
2634
+ c.name && c.meta.keepAlive && y.addCachedView(c.name), m();
2635
+ else
2636
+ try {
2637
+ if (s.fetchUserInfo) {
2638
+ const b = await s.fetchUserInfo();
2639
+ p.setUserInfo(b);
2640
+ } else {
2641
+ const b = await Nn();
2642
+ p.setUserInfo(b);
2643
+ }
2644
+ if (s.fetchMenu) {
2645
+ const b = await s.fetchMenu();
2646
+ f.setMenuList(b);
2647
+ } else {
2648
+ const b = await Wn(s.appId);
2649
+ f.setMenuList(b);
2650
+ }
2651
+ s.onLoginSuccess && s.onLoginSuccess(), c.name && c.meta.keepAlive && y.addCachedView(c.name), m({ ...c, replace: !0 });
2652
+ } catch (b) {
2653
+ console.error("获取用户信息失败:", b), p.clearUserInfo(), f.clearMenu(), localStorage.removeItem("token"), localStorage.removeItem("token_type"), localStorage.removeItem("refresh_token"), m({ path: r, query: { redirect: c.fullPath } });
2654
+ }
2655
+ else
2656
+ n.includes(c.path) ? m() : m({ path: r, query: { redirect: c.fullPath } });
2657
+ }), t.afterEach(() => {
2658
+ });
2659
+ }
2660
+ function Va(t) {
2661
+ return A.get("/user/list", { params: t });
2662
+ }
2663
+ function Fa(t) {
2664
+ return A.get(`/user/${t}`);
2665
+ }
2666
+ function Ba(t) {
2667
+ return A.post("/user", t);
2668
+ }
2669
+ function Ka(t, s) {
2670
+ return A.put(`/user/${t}`, s);
2671
+ }
2672
+ function ja(t) {
2673
+ return A.delete(`/user/${t}`);
2674
+ }
2675
+ function qa(t) {
2676
+ return A.post("/user/batch-delete", { ids: t });
2677
+ }
2678
+ function Ya(t, s) {
2679
+ return A.patch(`/user/${t}/status`, { status: s });
2680
+ }
2681
+ function Wa(t) {
2682
+ return A.post(`/user/${t}/reset-password`);
2683
+ }
2684
+ var Gn = /* @__PURE__ */ ((t) => (t[t.ENABLED = 1] = "ENABLED", t[t.DISABLED = 0] = "DISABLED", t))(Gn || {}), Xn = /* @__PURE__ */ ((t) => (t[t.UNKNOWN = 0] = "UNKNOWN", t[t.MALE = 1] = "MALE", t[t.FEMALE = 2] = "FEMALE", t))(Xn || {}), Jn = /* @__PURE__ */ ((t) => (t[t.DIRECTORY = 0] = "DIRECTORY", t[t.MENU = 1] = "MENU", t[t.BUTTON = 2] = "BUTTON", t))(Jn || {});
2685
+ const Ha = {
2686
+ 1: "启用",
2687
+ 0: "禁用"
2688
+ }, Ga = {
2689
+ 0: "未知",
2690
+ 1: "男",
2691
+ 2: "女"
2692
+ }, Xa = {
2693
+ 0: "目录",
2694
+ 1: "菜单",
2695
+ 2: "按钮"
2696
+ }, Ja = [
2697
+ {
2698
+ label: "启用",
2699
+ value: 1
2700
+ /* ENABLED */
2701
+ },
2702
+ {
2703
+ label: "禁用",
2704
+ value: 0
2705
+ /* DISABLED */
2706
+ }
2707
+ ], Qa = [
2708
+ {
2709
+ label: "未知",
2710
+ value: 0
2711
+ /* UNKNOWN */
2712
+ },
2713
+ {
2714
+ label: "男",
2715
+ value: 1
2716
+ /* MALE */
2717
+ },
2718
+ {
2719
+ label: "女",
2720
+ value: 2
2721
+ /* FEMALE */
2722
+ }
2723
+ ], Za = [
2724
+ {
2725
+ label: "目录",
2726
+ value: 0
2727
+ /* DIRECTORY */
2728
+ },
2729
+ {
2730
+ label: "菜单",
2731
+ value: 1
2732
+ /* MENU */
2733
+ },
2734
+ {
2735
+ label: "按钮",
2736
+ value: 2
2737
+ /* BUTTON */
2738
+ }
2739
+ ], el = {
2740
+ mounted(t, s) {
2741
+ var r;
2742
+ G().isLoggedIn || (r = t.parentNode) == null || r.removeChild(t);
2743
+ }
2744
+ };
2745
+ export {
2746
+ ut as $,
2747
+ za as A,
2748
+ Wn as B,
2749
+ ia as C,
2750
+ ra as D,
2751
+ Ta as E,
2752
+ da as F,
2753
+ Xn as G,
2754
+ Us as H,
2755
+ Ia as I,
2756
+ De as J,
2757
+ Lt as K,
2758
+ lt as L,
2759
+ Jn as M,
2760
+ xt as N,
2761
+ Fa as O,
2762
+ Nn as P,
2763
+ Va as Q,
2764
+ ba as R,
2765
+ Gn as S,
2766
+ ca as T,
2767
+ xa as U,
2768
+ at as V,
2769
+ A as W,
2770
+ va as X,
2771
+ Ca as Y,
2772
+ Tt as Z,
2773
+ Q as _,
2774
+ Ja as a,
2775
+ x as a0,
2776
+ Ce as a1,
2777
+ Tn as a2,
2778
+ ma as a3,
2779
+ qn as a4,
2780
+ el as a5,
2781
+ pa as a6,
2782
+ Wa as a7,
2783
+ La as a8,
2784
+ ct as a9,
2785
+ la as aa,
2786
+ $e as ab,
2787
+ It as ac,
2788
+ Mt as ad,
2789
+ $t as ae,
2790
+ bt as af,
2791
+ St as ag,
2792
+ ot as ah,
2793
+ Ct as ai,
2794
+ Oa as aj,
2795
+ it as ak,
2796
+ Aa as al,
2797
+ Ea as am,
2798
+ Da as an,
2799
+ Ka as ao,
2800
+ Ya as ap,
2801
+ ga as aq,
2802
+ ae as ar,
2803
+ ya as as,
2804
+ be as at,
2805
+ ka as au,
2806
+ ce as av,
2807
+ wa as aw,
2808
+ G as ax,
2809
+ Za as b,
2810
+ fa as c,
2811
+ Qa as d,
2812
+ Ga as e,
2813
+ Xa as f,
2814
+ Fn as g,
2815
+ Ze as h,
2816
+ Rn as i,
2817
+ Ha as j,
2818
+ ha as k,
2819
+ qa as l,
2820
+ nt as m,
2821
+ Sa as n,
2822
+ Ra as o,
2823
+ Na as p,
2824
+ Ma as q,
2825
+ Ba as r,
2826
+ $a as s,
2827
+ Pa as t,
2828
+ Ua as u,
2829
+ ja as v,
2830
+ _a as w,
2831
+ Je as x,
2832
+ En as y,
2833
+ ua as z
2834
+ };