xto-fronted 0.4.21 → 0.4.23

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