xto-fronted 0.4.17 → 0.4.19

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.
@@ -1,2303 +0,0 @@
1
- import { ref as k, computed as y, watch as Fe, defineComponent as q, openBlock as c, createElementBlock as _, normalizeClass as V, createElementVNode as t, withDirectives as Ke, toDisplayString as I, unref as m, vShow as ut, createVNode as x, withCtx as M, Fragment as D, renderList as F, createBlock as A, createTextVNode as te, createCommentVNode as z, onMounted as je, onUnmounted as ct, withModifiers as qe, Transition as ze, withKeys as Ye, vModelText as dt, normalizeStyle as xe, resolveComponent as mt, reactive as Ce } from "vue";
2
- import { useRoute as Q, useRouter as X, createRouter as Te, createWebHistory as Ie } from "vue-router";
3
- import { defineStore as pe } from "pinia";
4
- import { Menu as We, SubMenu as He, MenuItem as ue, Tabs as pt, TabPane as ht } from "@xto/navigation";
5
- import { Icon as P, Button as he } from "@xto/base";
6
- import { Drawer as ft, Message as H } from "@xto/feedback";
7
- import { Form as vt, FormItem as re, Input as Oe, Checkbox as _t } from "@xto/form";
8
- import gt from "axios";
9
- const oe = "xto_", Xe = (e) => ({
10
- get(s) {
11
- const o = e.getItem(oe + 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
- e.removeItem(oe + s);
22
- return;
23
- }
24
- const n = typeof o == "string" ? o : JSON.stringify(o);
25
- e.setItem(oe + s, n);
26
- },
27
- remove(s) {
28
- e.removeItem(oe + s);
29
- },
30
- clear() {
31
- Object.keys(e).forEach((o) => {
32
- o.startsWith(oe) && e.removeItem(o);
33
- });
34
- }
35
- }), le = Xe(window.localStorage), ie = Xe(window.sessionStorage), g = {
36
- get: le.get,
37
- set: le.set,
38
- remove: le.remove,
39
- clear: le.clear
40
- }, jo = {
41
- get: ie.get,
42
- set: ie.set,
43
- remove: ie.remove,
44
- clear: ie.clear
45
- }, J = pe("app", () => {
46
- const e = k(g.get("appName") || "XTO App"), s = k(g.get("indexPath") || "/dashboard"), o = k(g.get("isDark") || !1), n = k(g.get("theme") || "light"), a = k(g.get("layout") || "sidebar"), d = k(g.get("isCollapsed") || !1), b = k(g.get("showTabs") ?? !0), p = k(g.get("showFooter") ?? !0), f = k(g.get("showBreadcrumb") ?? !0), i = k(g.get("primaryColor") || "#409eff"), u = k([]), l = k(g.get("activeTopMenuPath") || ""), r = y(() => o.value ? "dark" : "light"), S = (T) => {
47
- e.value = T, g.set("appName", T);
48
- }, v = (T) => {
49
- s.value = T, g.set("indexPath", T);
50
- }, R = () => {
51
- o.value = !o.value, n.value = o.value ? "dark" : "light", U();
52
- }, C = (T) => {
53
- n.value = T, o.value = T === "dark", U();
54
- }, U = () => {
55
- const T = document.documentElement;
56
- o.value ? T.classList.add("dark") : T.classList.remove("dark"), g.set("isDark", o.value), g.set("theme", n.value);
57
- }, W = () => {
58
- d.value = !d.value, g.set("isCollapsed", d.value);
59
- }, B = (T) => {
60
- a.value = T, g.set("layout", T), T !== "mix" && (l.value = "", g.remove("activeTopMenuPath"));
61
- }, E = (T) => {
62
- l.value = T, g.set("activeTopMenuPath", T);
63
- }, j = () => {
64
- b.value = !b.value, g.set("showTabs", b.value);
65
- }, $ = () => {
66
- p.value = !p.value, g.set("showFooter", p.value);
67
- }, O = () => {
68
- f.value = !f.value, g.set("showBreadcrumb", f.value);
69
- }, ve = (T) => {
70
- i.value = T, document.documentElement.style.setProperty("--color-primary", T), g.set("primaryColor", T);
71
- }, _e = (T) => {
72
- u.value.includes(T) || u.value.push(T);
73
- }, ge = (T) => {
74
- const se = u.value.indexOf(T);
75
- se > -1 && u.value.splice(se, 1);
76
- }, ae = () => {
77
- u.value = [];
78
- }, ye = () => {
79
- U(), i.value !== "#409eff" && document.documentElement.style.setProperty("--color-primary", i.value);
80
- };
81
- return Fe(o, U), {
82
- appName: e,
83
- indexPath: s,
84
- isDark: o,
85
- theme: n,
86
- layout: a,
87
- isCollapsed: d,
88
- showTabs: b,
89
- showFooter: p,
90
- showBreadcrumb: f,
91
- primaryColor: i,
92
- cachedViews: u,
93
- activeTopMenuPath: l,
94
- themeClass: r,
95
- setAppName: S,
96
- setIndexPath: v,
97
- toggleTheme: R,
98
- toggleCollapse: W,
99
- setTheme: C,
100
- setLayout: B,
101
- setActiveTopMenuPath: E,
102
- toggleTabs: j,
103
- toggleFooter: $,
104
- toggleBreadcrumb: O,
105
- setPrimaryColor: ve,
106
- addCachedView: _e,
107
- removeCachedView: ge,
108
- clearCachedViews: ae,
109
- initTheme: ye
110
- };
111
- }), be = "menu_list", yt = {
112
- menuCode: "home",
113
- menuName: "首页",
114
- menuUrl: "/dashboard",
115
- icon: "home",
116
- closable: !1,
117
- isDefault: !1,
118
- isOut: !1
119
- }, Z = pe("menu", () => {
120
- const e = k(g.get(be) || []), s = y(() => e.value.length > 0);
121
- return {
122
- menuList: e,
123
- hasMenu: s,
124
- setMenuList: (a) => {
125
- e.value = [yt, ...a], g.set(be, e.value);
126
- },
127
- clearMenu: () => {
128
- e.value = [], g.remove(be);
129
- }
130
- };
131
- }), Je = "/vite.svg", we = "user_info", Y = pe("user", () => {
132
- const e = k(g.get(we)), s = y(() => !!e.value), o = y(() => {
133
- var l;
134
- return ((l = e.value) == null ? void 0 : l.userId) || "";
135
- }), n = y(() => {
136
- var l;
137
- return ((l = e.value) == null ? void 0 : l.userName) || "";
138
- }), a = y(() => {
139
- var l;
140
- return ((l = e.value) == null ? void 0 : l.departmentName) || "";
141
- }), d = y(() => {
142
- var l;
143
- return ((l = e.value) == null ? void 0 : l.email) || "";
144
- }), b = y(() => {
145
- var l;
146
- return ((l = e.value) == null ? void 0 : l.mobilePhone) || "";
147
- }), p = y(() => {
148
- var l;
149
- return ((l = e.value) == null ? void 0 : l.positionName) || "";
150
- }), f = y(() => {
151
- var l;
152
- return ((l = e.value) == null ? void 0 : l.avatar) || "";
153
- });
154
- return {
155
- userInfo: e,
156
- isLoggedIn: s,
157
- userId: o,
158
- userName: n,
159
- departmentName: a,
160
- email: d,
161
- mobilePhone: b,
162
- positionName: p,
163
- avatar: f,
164
- setUserInfo: (l) => {
165
- e.value = l, g.set(we, l);
166
- },
167
- clearUserInfo: () => {
168
- e.value = null, g.remove(we);
169
- }
170
- };
171
- }), Me = "token", Se = "token_type", Ue = "refresh_token", Le = "expires_time", $e = "refresh_time", Ne = "code", fe = () => g.get(Me), kt = (e) => {
172
- g.set(Me, e);
173
- }, bt = () => g.get(Se), wt = (e) => {
174
- g.set(Se, e);
175
- }, qo = () => g.get(Ue), xt = (e) => {
176
- g.set(Ue, e);
177
- }, Ct = () => g.get(Le), Tt = (e) => {
178
- g.set(Le, e);
179
- }, Yo = () => g.get($e), It = (e) => {
180
- g.set($e, e);
181
- }, Wo = () => g.get(Ne), Mt = (e) => {
182
- g.set(Ne, e);
183
- }, Qe = (e) => {
184
- kt(e.access_token), wt(e.token_type || "Bearer"), xt(e.refresh_token), Tt(e.expires_time), It(e.refresh_time), e.code && Mt(e.code);
185
- }, Ze = () => {
186
- g.remove(Me), g.remove(Se), g.remove(Ue), g.remove(Le), g.remove($e), g.remove(Ne);
187
- }, St = () => {
188
- const e = Ct();
189
- return e ? Date.now() > e : !0;
190
- }, Ge = () => !!fe() && !St(), Ee = pe("auth", () => {
191
- const e = k(fe()), s = y(() => Ge()), o = k(""), n = k(""), a = k(""), d = k("/login");
192
- return {
193
- token: e,
194
- isLoggedIn: s,
195
- baseUrl: o,
196
- appId: n,
197
- clientId: a,
198
- loginPath: d,
199
- login: (r) => {
200
- e.value = r.access_token, Qe(r);
201
- },
202
- logout: () => {
203
- e.value = null, Ze();
204
- },
205
- setBaseUrl: (r) => {
206
- o.value = r;
207
- },
208
- setAppId: (r) => {
209
- n.value = r;
210
- },
211
- setClientId: (r) => {
212
- a.value = r;
213
- },
214
- setLoginPath: (r) => {
215
- d.value = r;
216
- }
217
- };
218
- }), Ut = { class: "sidebar__logo" }, Lt = { class: "sidebar__menu-icon" }, $t = {
219
- key: 1,
220
- class: "sidebar__menu-char"
221
- }, Nt = { class: "sidebar__menu-icon" }, Et = {
222
- key: 1,
223
- class: "sidebar__menu-char"
224
- }, Pt = { class: "sidebar__menu-icon" }, Rt = {
225
- key: 1,
226
- class: "sidebar__menu-char"
227
- }, At = {
228
- key: 0,
229
- class: "sidebar__user"
230
- }, Dt = { class: "sidebar__user-info" }, zt = { class: "sidebar__user-name" }, Ot = { class: "sidebar__user-role" }, Bt = /* @__PURE__ */ q({
231
- __name: "Sidebar",
232
- props: {
233
- menuList: { default: () => [] }
234
- },
235
- setup(e) {
236
- const s = e, o = Q(), n = X(), a = Z(), d = Y(), b = Ee(), p = J(), f = y(() => s.menuList.length > 0 ? s.menuList : a.menuList), i = y(() => p.isCollapsed), u = y(() => o.path), l = y(() => p.isDark ? "#1d1e1f" : "#fff"), r = y(() => p.isDark ? "#cfd3dc" : "#303133"), S = y(() => "#409eff"), v = (E) => {
237
- E && E !== o.path && n.push(E);
238
- }, R = () => {
239
- b.logout(), d.clearUserInfo(), a.clearMenu(), n.push("/login");
240
- }, C = /* @__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
- ]), U = (E) => {
343
- if (!E || E === "") return "";
344
- if (E.startsWith("tineco-icon-")) {
345
- const $ = E.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
- }[$] || $;
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
- }[E] || E;
379
- }, W = (E) => E ? E.charAt(0) : "", B = (E) => C.has(E);
380
- return (E, j) => (c(), _("div", {
381
- class: V(["sidebar", { "sidebar--collapsed": i.value }])
382
- }, [
383
- t("div", Ut, [
384
- j[0] || (j[0] = t("img", {
385
- src: Je,
386
- alt: "Logo",
387
- class: "sidebar__logo-img"
388
- }, null, -1)),
389
- Ke(t("span", { class: "sidebar__logo-text" }, I(m(p).appName), 513), [
390
- [ut, !i.value]
391
- ])
392
- ]),
393
- x(m(We), {
394
- "default-active": u.value,
395
- mode: "vertical",
396
- collapse: i.value,
397
- "collapse-transition": !1,
398
- "background-color": l.value,
399
- "text-color": r.value,
400
- "active-text-color": S.value,
401
- class: "sidebar__menu",
402
- onSelect: v
403
- }, {
404
- default: M(() => [
405
- (c(!0), _(D, null, F(f.value, ($) => (c(), _(D, {
406
- key: $.menuUrl
407
- }, [
408
- $.children && $.children.length > 0 ? (c(), A(m(He), {
409
- key: 0,
410
- index: $.menuUrl
411
- }, {
412
- title: M(() => [
413
- t("span", Lt, [
414
- B(U($.icon)) ? (c(), A(m(P), {
415
- key: 0,
416
- name: U($.icon),
417
- size: 16
418
- }, null, 8, ["name"])) : (c(), _("span", $t, I(W($.menuName)), 1))
419
- ]),
420
- t("span", null, I($.menuName), 1)
421
- ]),
422
- default: M(() => [
423
- (c(!0), _(D, null, F($.children, (O) => (c(), A(m(ue), {
424
- key: O.menuUrl,
425
- index: O.menuUrl
426
- }, {
427
- default: M(() => [
428
- t("span", Nt, [
429
- B(U(O.icon)) ? (c(), A(m(P), {
430
- key: 0,
431
- name: U(O.icon),
432
- size: 16
433
- }, null, 8, ["name"])) : (c(), _("span", Et, I(W(O.menuName)), 1))
434
- ]),
435
- t("span", null, I(O.menuName), 1)
436
- ]),
437
- _: 2
438
- }, 1032, ["index"]))), 128))
439
- ]),
440
- _: 2
441
- }, 1032, ["index"])) : (c(), A(m(ue), {
442
- key: 1,
443
- index: $.menuUrl
444
- }, {
445
- default: M(() => [
446
- t("span", Pt, [
447
- B(U($.icon)) ? (c(), A(m(P), {
448
- key: 0,
449
- name: U($.icon),
450
- size: 16
451
- }, null, 8, ["name"])) : (c(), _("span", Rt, I(W($.menuName)), 1))
452
- ]),
453
- t("span", null, I($.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
- i.value ? z("", !0) : (c(), _("div", At, [
462
- t("div", Dt, [
463
- t("span", zt, I(m(d).userName), 1),
464
- t("span", Ot, I(m(d).departmentName), 1)
465
- ]),
466
- x(m(he), {
467
- type: "text",
468
- size: "small",
469
- onClick: R
470
- }, {
471
- default: M(() => [...j[1] || (j[1] = [
472
- te("退出", -1)
473
- ])]),
474
- _: 1
475
- })
476
- ]))
477
- ], 2));
478
- }
479
- }), K = (e, s) => {
480
- const o = e.__vccOpts || e;
481
- for (const [n, a] of s)
482
- o[n] = a;
483
- return o;
484
- }, Be = /* @__PURE__ */ K(Bt, [["__scopeId", "data-v-480fc818"]]), Vt = { class: "header" }, Ft = { class: "header__left" }, Kt = {
485
- key: 1,
486
- class: "header__breadcrumb"
487
- }, jt = {
488
- key: 0,
489
- class: "breadcrumb-separator"
490
- }, qt = { class: "header__right" }, Yt = ["title"], Wt = { class: "header__avatar" }, Ht = { 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" }, Gt = { class: "header__dropdown-name" }, es = { class: "header__dropdown-role" }, ts = { class: "header__dropdown-menu" }, ss = { class: "search-container" }, os = { class: "search-input-wrapper" }, ns = {
494
- key: 0,
495
- class: "search-results"
496
- }, as = ["onClick"], rs = { class: "search-result-info" }, ls = { class: "search-result-title" }, is = {
497
- key: 0,
498
- class: "search-result-parent"
499
- }, us = {
500
- key: 1,
501
- class: "search-empty"
502
- }, cs = { class: "settings-drawer" }, ds = { class: "settings-section" }, ms = { class: "settings-layout-options" }, ps = ["onClick"], hs = { class: "layout-option__preview" }, fs = {
503
- key: 0,
504
- class: "layout-preview-sidebar"
505
- }, vs = {
506
- key: 1,
507
- class: "layout-preview-top"
508
- }, _s = {
509
- key: 2,
510
- class: "layout-preview-mix"
511
- }, gs = { class: "layout-option__label" }, ys = { class: "settings-section" }, ks = { class: "settings-color-options" }, bs = ["title", "onClick"], ws = { class: "settings-section" }, xs = { class: "settings-switch-list" }, Cs = { class: "settings-switch-item" }, Ts = { class: "settings-switch-item" }, Is = /* @__PURE__ */ q({
512
- __name: "Header",
513
- setup(e) {
514
- const s = Q(), o = X(), n = J(), a = Y(), d = Ee(), b = Z(), p = k(!1), f = k(!1), i = k(null), u = k(!1), l = k(!1), r = k(""), S = k(null), v = k(!1), R = [
515
- { value: "sidebar", label: "左侧菜单", icon: "sidebar-left" },
516
- { value: "top", label: "顶部菜单", icon: "menu" },
517
- { value: "mix", label: "混合菜单", icon: "grid" }
518
- ], C = [
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
- ], U = y(() => s.matched.filter((h) => h.meta && h.meta.title).map((h) => ({
526
- title: h.meta.title,
527
- path: h.path
528
- }))), W = (N, h = "") => {
529
- const G = [];
530
- return N.forEach((w) => {
531
- w.children && w.children.length > 0 ? G.push(...W(w.children, w.title)) : G.push({ ...w, parentTitle: h });
532
- }), G;
533
- }, B = y(() => r.value.trim() ? W(b.menuList).filter(
534
- (h) => h.title.toLowerCase().includes(r.value.toLowerCase())
535
- ) : []), E = y(() => n.layout), j = () => {
536
- n.toggleCollapse();
537
- }, $ = () => {
538
- n.toggleTheme();
539
- }, O = () => {
540
- f.value = !0;
541
- }, ve = (N) => {
542
- n.setLayout(N);
543
- }, _e = (N) => {
544
- v.value = N;
545
- const h = document.documentElement;
546
- N ? h.classList.add("grey-mode") : h.classList.remove("grey-mode");
547
- }, ge = () => {
548
- document.fullscreenElement ? document.exitFullscreen() : document.documentElement.requestFullscreen();
549
- }, ae = () => {
550
- u.value = !!document.fullscreenElement;
551
- }, ye = () => {
552
- p.value = !p.value;
553
- }, T = () => {
554
- p.value = !1;
555
- }, se = () => {
556
- l.value = !0;
557
- }, ke = () => {
558
- l.value = !1, r.value = "";
559
- }, Re = (N) => {
560
- o.push(N), ke();
561
- }, at = (N) => {
562
- n.setPrimaryColor(N);
563
- }, rt = () => {
564
- T(), o.push("/profile");
565
- }, lt = () => {
566
- T(), o.push("/change-password");
567
- }, it = () => {
568
- T(), d.logout(), a.clearUserInfo(), b.clearMenu(), o.push("/login");
569
- }, Ae = (N) => {
570
- i.value && !i.value.contains(N.target) && T(), S.value && !S.value.contains(N.target) && ke();
571
- }, De = (N) => {
572
- N.key === "Escape" && (ke(), T()), (N.ctrlKey || N.metaKey) && N.key === "k" && (N.preventDefault(), se());
573
- };
574
- return je(() => {
575
- document.addEventListener("click", Ae), document.addEventListener("fullscreenchange", ae), document.addEventListener("keydown", De), n.initTheme(), v.value = document.documentElement.classList.contains("grey-mode");
576
- }), ct(() => {
577
- document.removeEventListener("click", Ae), document.removeEventListener("fullscreenchange", ae), document.removeEventListener("keydown", De);
578
- }), (N, h) => {
579
- var G;
580
- return c(), _("div", Vt, [
581
- t("div", Ft, [
582
- m(n).layout === "sidebar" ? (c(), _("div", {
583
- key: 0,
584
- class: "header__collapse",
585
- onClick: j
586
- }, [
587
- x(m(P), {
588
- name: m(n).isCollapsed ? "menu-unfold" : "menu-fold",
589
- size: 18
590
- }, null, 8, ["name"])
591
- ])) : z("", !0),
592
- m(n).showBreadcrumb ? (c(), _("div", Kt, [
593
- (c(!0), _(D, null, F(U.value, (w, ee) => (c(), _("span", {
594
- key: w.path
595
- }, [
596
- ee > 0 ? (c(), _("span", jt, "/")) : z("", !0),
597
- t("span", {
598
- class: V({ "is-current": ee === U.value.length - 1 })
599
- }, I(w.title), 3)
600
- ]))), 128))
601
- ])) : z("", !0)
602
- ]),
603
- t("div", qt, [
604
- t("div", {
605
- class: "header__action",
606
- onClick: se,
607
- title: "搜索 (Ctrl+K)"
608
- }, [
609
- x(m(P), {
610
- name: "search",
611
- size: 16
612
- })
613
- ]),
614
- t("div", {
615
- class: "header__action",
616
- onClick: ge,
617
- title: u.value ? "退出全屏" : "全屏"
618
- }, [
619
- x(m(P), {
620
- name: u.value ? "fullscreen-exit" : "fullscreen",
621
- size: 16
622
- }, null, 8, ["name"])
623
- ], 8, Yt),
624
- t("div", {
625
- class: "header__action",
626
- onClick: O,
627
- title: "换肤设置"
628
- }, [
629
- x(m(P), {
630
- name: "skin",
631
- size: 16
632
- })
633
- ]),
634
- t("div", {
635
- class: "header__action",
636
- onClick: $,
637
- title: "切换主题"
638
- }, [
639
- x(m(P), {
640
- name: m(n).isDark ? "sun" : "moon",
641
- size: 16
642
- }, null, 8, ["name"])
643
- ]),
644
- t("div", {
645
- class: "header__user",
646
- ref_key: "dropdownRef",
647
- ref: i
648
- }, [
649
- t("div", {
650
- class: "header__user-trigger",
651
- onClick: qe(ye, ["stop"])
652
- }, [
653
- t("div", Wt, [
654
- t("span", null, I(((G = m(a).userName) == null ? void 0 : G.charAt(0)) || "U"), 1)
655
- ]),
656
- t("span", Ht, I(m(a).userName), 1),
657
- t("span", {
658
- class: V(["header__user-arrow", { "is-active": p.value }])
659
- }, "▼", 2)
660
- ]),
661
- x(ze, { name: "dropdown" }, {
662
- default: M(() => {
663
- var w;
664
- return [
665
- p.value ? (c(), _("div", Xt, [
666
- t("div", Jt, [
667
- t("div", Qt, [
668
- t("span", null, I(((w = m(a).userName) == null ? void 0 : w.charAt(0)) || "U"), 1)
669
- ]),
670
- t("div", Zt, [
671
- t("div", Gt, I(m(a).userName), 1),
672
- t("div", es, I(m(a).departmentName), 1)
673
- ])
674
- ]),
675
- h[8] || (h[8] = t("div", { class: "header__dropdown-divider" }, null, -1)),
676
- t("div", ts, [
677
- t("div", {
678
- class: "header__dropdown-item",
679
- onClick: rt
680
- }, [
681
- x(m(P), {
682
- name: "user",
683
- size: 16
684
- }),
685
- h[4] || (h[4] = t("span", null, "个人信息", -1))
686
- ]),
687
- t("div", {
688
- class: "header__dropdown-item",
689
- onClick: lt
690
- }, [
691
- x(m(P), {
692
- name: "lock",
693
- size: 16
694
- }),
695
- h[5] || (h[5] = t("span", null, "修改密码", -1))
696
- ]),
697
- h[7] || (h[7] = t("div", { class: "header__dropdown-divider" }, null, -1)),
698
- t("div", {
699
- class: "header__dropdown-item header__dropdown-item--danger",
700
- onClick: it
701
- }, [
702
- x(m(P), {
703
- name: "logout",
704
- size: 16
705
- }),
706
- h[6] || (h[6] = t("span", null, "退出登录", -1))
707
- ])
708
- ])
709
- ])) : z("", !0)
710
- ];
711
- }),
712
- _: 1
713
- })
714
- ], 512)
715
- ]),
716
- x(ze, { name: "search" }, {
717
- default: M(() => [
718
- l.value ? (c(), _("div", {
719
- key: 0,
720
- class: "header__search-modal",
721
- ref_key: "searchRef",
722
- ref: S
723
- }, [
724
- t("div", ss, [
725
- t("div", os, [
726
- x(m(P), {
727
- class: "search-icon",
728
- name: "search",
729
- size: 20
730
- }),
731
- Ke(t("input", {
732
- "onUpdate:modelValue": h[0] || (h[0] = (w) => r.value = w),
733
- type: "text",
734
- class: "search-input",
735
- placeholder: "搜索菜单...",
736
- autofocus: "",
737
- onKeyup: h[1] || (h[1] = Ye((w) => B.value[0] && Re(B.value[0].path), ["enter"]))
738
- }, null, 544), [
739
- [dt, r.value]
740
- ]),
741
- h[9] || (h[9] = t("span", { class: "search-shortcut" }, "ESC 关闭", -1))
742
- ]),
743
- B.value.length > 0 ? (c(), _("div", ns, [
744
- (c(!0), _(D, null, F(B.value, (w, ee) => (c(), _("div", {
745
- key: w.path,
746
- class: V(["search-result-item", { "is-first": ee === 0 }]),
747
- onClick: (Ro) => Re(w.path)
748
- }, [
749
- x(m(P), {
750
- class: "search-result-icon",
751
- name: w.icon || "file",
752
- size: 20
753
- }, null, 8, ["name"]),
754
- t("div", rs, [
755
- t("span", ls, I(w.title), 1),
756
- w.parentTitle ? (c(), _("span", is, I(w.parentTitle), 1)) : z("", !0)
757
- ])
758
- ], 10, as))), 128))
759
- ])) : r.value ? (c(), _("div", us, " 未找到匹配的菜单 ")) : z("", !0)
760
- ])
761
- ], 512)) : z("", !0)
762
- ]),
763
- _: 1
764
- }),
765
- x(m(ft), {
766
- modelValue: f.value,
767
- "onUpdate:modelValue": h[3] || (h[3] = (w) => f.value = w),
768
- title: "换肤设置",
769
- direction: "rtl",
770
- size: "320px"
771
- }, {
772
- default: M(() => [
773
- t("div", cs, [
774
- t("div", ds, [
775
- h[13] || (h[13] = t("div", { class: "settings-title" }, "布局模式", -1)),
776
- t("div", ms, [
777
- (c(), _(D, null, F(R, (w) => t("div", {
778
- key: w.value,
779
- class: V(["layout-option", { "is-active": E.value === w.value }]),
780
- onClick: (ee) => ve(w.value)
781
- }, [
782
- t("div", hs, [
783
- w.value === "sidebar" ? (c(), _("div", fs, [...h[10] || (h[10] = [
784
- t("div", { class: "preview-aside" }, null, -1),
785
- t("div", { class: "preview-main" }, [
786
- t("div", { class: "preview-header" }),
787
- t("div", { class: "preview-content" })
788
- ], -1)
789
- ])])) : w.value === "top" ? (c(), _("div", vs, [...h[11] || (h[11] = [
790
- t("div", { class: "preview-header-full" }, null, -1),
791
- t("div", { class: "preview-content-full" }, null, -1)
792
- ])])) : (c(), _("div", _s, [...h[12] || (h[12] = [
793
- t("div", { class: "preview-header-mix" }, [
794
- t("div", { class: "preview-mix-left" })
795
- ], -1),
796
- t("div", { class: "preview-mix-body" }, [
797
- t("div", { class: "preview-mix-aside" }),
798
- t("div", { class: "preview-mix-content" })
799
- ], -1)
800
- ])]))
801
- ]),
802
- t("span", gs, I(w.label), 1)
803
- ], 10, ps)), 64))
804
- ])
805
- ]),
806
- t("div", ys, [
807
- h[14] || (h[14] = t("div", { class: "settings-title" }, "主题色", -1)),
808
- t("div", ks, [
809
- (c(), _(D, null, F(C, (w) => t("div", {
810
- key: w.value,
811
- class: V(["color-option", { "is-active": m(n).primaryColor === w.value }]),
812
- style: xe({ backgroundColor: w.value }),
813
- title: w.label,
814
- onClick: (ee) => at(w.value)
815
- }, [
816
- m(n).primaryColor === w.value ? (c(), A(m(P), {
817
- key: 0,
818
- name: "check",
819
- size: 12,
820
- color: "#fff"
821
- })) : z("", !0)
822
- ], 14, bs)), 64))
823
- ])
824
- ]),
825
- t("div", ws, [
826
- h[19] || (h[19] = t("div", { class: "settings-title" }, "功能设置", -1)),
827
- t("div", xs, [
828
- t("div", Cs, [
829
- h[16] || (h[16] = t("span", null, "灰色模式", -1)),
830
- t("div", {
831
- class: V(["switch-wrapper", { "is-checked": v.value }]),
832
- onClick: h[2] || (h[2] = (w) => _e(!v.value))
833
- }, [...h[15] || (h[15] = [
834
- t("span", { class: "switch-core" }, null, -1)
835
- ])], 2)
836
- ]),
837
- t("div", Ts, [
838
- h[18] || (h[18] = t("span", null, "暗黑模式", -1)),
839
- t("div", {
840
- class: V(["switch-wrapper", { "is-checked": m(n).isDark }]),
841
- onClick: $
842
- }, [...h[17] || (h[17] = [
843
- t("span", { class: "switch-core" }, null, -1)
844
- ])], 2)
845
- ])
846
- ])
847
- ])
848
- ])
849
- ]),
850
- _: 1
851
- }, 8, ["modelValue"])
852
- ]);
853
- };
854
- }
855
- }), Ve = /* @__PURE__ */ K(Is, [["__scopeId", "data-v-5b72324e"]]), Ms = { class: "top-menu" }, Ss = { class: "top-menu__menu-icon" }, Us = {
856
- key: 1,
857
- class: "top-menu__menu-char"
858
- }, Ls = { class: "top-menu__menu-icon" }, $s = {
859
- key: 1,
860
- class: "top-menu__menu-char"
861
- }, Ns = { class: "top-menu__menu-icon" }, Es = {
862
- key: 1,
863
- class: "top-menu__menu-char"
864
- }, Ps = /* @__PURE__ */ q({
865
- __name: "TopMenu",
866
- setup(e) {
867
- const s = Q(), o = X(), n = Z(), a = J(), d = y(() => s.path), b = y(() => a.isDark ? "#1d1e1f" : "#fff"), p = y(() => a.isDark ? "#cfd3dc" : "#303133"), f = y(() => "#409eff"), i = (v) => {
868
- v && v !== s.path && o.push(v);
869
- }, u = /* @__PURE__ */ new Set([
870
- "arrow-up",
871
- "arrow-down",
872
- "arrow-left",
873
- "arrow-right",
874
- "caret-down",
875
- "caret-right",
876
- "plus",
877
- "minus",
878
- "close",
879
- "check",
880
- "edit",
881
- "delete",
882
- "copy",
883
- "download",
884
- "upload",
885
- "refresh",
886
- "search",
887
- "filter",
888
- "more",
889
- "setting",
890
- "share",
891
- "loading",
892
- "info",
893
- "success",
894
- "warning",
895
- "error",
896
- "question",
897
- "user",
898
- "user-add",
899
- "user-group",
900
- "logout",
901
- "login",
902
- "file",
903
- "folder",
904
- "folder-open",
905
- "document",
906
- "image",
907
- "video",
908
- "music",
909
- "camera",
910
- "mail",
911
- "phone",
912
- "chat",
913
- "bell",
914
- "message",
915
- "eye",
916
- "eye-off",
917
- "calendar",
918
- "clock",
919
- "history",
920
- "timer",
921
- "location",
922
- "map",
923
- "globe",
924
- "star",
925
- "heart",
926
- "thumb-up",
927
- "link",
928
- "external-link",
929
- "lock",
930
- "unlock",
931
- "key",
932
- "home",
933
- "menu",
934
- "menu-fold",
935
- "menu-unfold",
936
- "sidebar-fold",
937
- "sidebar-expand",
938
- "sidebar-left",
939
- "dashboard",
940
- "chart",
941
- "chart-pie",
942
- "chart-line",
943
- "report",
944
- "analytics",
945
- "system",
946
- "permission",
947
- "role",
948
- "user-manage",
949
- "log",
950
- "notification",
951
- "app",
952
- "list",
953
- "grid",
954
- "fullscreen",
955
- "fullscreen-exit",
956
- "zoom-in",
957
- "zoom-out",
958
- "print",
959
- "bookmark",
960
- "tag",
961
- "code",
962
- "terminal",
963
- "database",
964
- "server",
965
- "cloud",
966
- "gift",
967
- "moon",
968
- "sun",
969
- "theme",
970
- "skin"
971
- ]), l = (v) => {
972
- if (!v || v === "") return "";
973
- if (v.startsWith("tineco-icon-")) {
974
- const C = v.replace("tineco-icon-", "");
975
- return {
976
- home: "home",
977
- dashboard: "dashboard",
978
- system: "system",
979
- user: "user",
980
- role: "role",
981
- menu: "list",
982
- setting: "setting",
983
- file: "file",
984
- folder: "folder",
985
- chart: "chart",
986
- report: "report",
987
- analytics: "analytics"
988
- }[C] || C;
989
- }
990
- return {
991
- dashboard: "dashboard",
992
- system: "system",
993
- user: "user",
994
- role: "role",
995
- menu: "list",
996
- setting: "setting",
997
- home: "home",
998
- chart: "chart",
999
- report: "report",
1000
- analytics: "analytics",
1001
- permission: "permission",
1002
- log: "log",
1003
- notification: "notification",
1004
- app: "app",
1005
- list: "list",
1006
- grid: "grid"
1007
- }[v] || v;
1008
- }, r = (v) => v ? v.charAt(0) : "", S = (v) => u.has(v);
1009
- return (v, R) => (c(), _("div", Ms, [
1010
- x(m(We), {
1011
- "default-active": d.value,
1012
- mode: "horizontal",
1013
- "background-color": b.value,
1014
- "text-color": p.value,
1015
- "active-text-color": f.value,
1016
- class: "top-menu__menu",
1017
- onSelect: i
1018
- }, {
1019
- default: M(() => [
1020
- (c(!0), _(D, null, F(m(n).menuList, (C) => (c(), _(D, {
1021
- key: C.menuUrl
1022
- }, [
1023
- C.children && C.children.length > 0 ? (c(), A(m(He), {
1024
- key: 0,
1025
- index: C.menuUrl
1026
- }, {
1027
- title: M(() => [
1028
- t("span", Ss, [
1029
- S(l(C.icon)) ? (c(), A(m(P), {
1030
- key: 0,
1031
- name: l(C.icon),
1032
- size: 16
1033
- }, null, 8, ["name"])) : (c(), _("span", Us, I(r(C.menuName)), 1))
1034
- ]),
1035
- t("span", null, I(C.menuName), 1)
1036
- ]),
1037
- default: M(() => [
1038
- (c(!0), _(D, null, F(C.children, (U) => (c(), A(m(ue), {
1039
- key: U.menuUrl,
1040
- index: U.menuUrl
1041
- }, {
1042
- default: M(() => [
1043
- t("span", Ls, [
1044
- S(l(U.icon)) ? (c(), A(m(P), {
1045
- key: 0,
1046
- name: l(U.icon),
1047
- size: 16
1048
- }, null, 8, ["name"])) : (c(), _("span", $s, I(r(U.menuName)), 1))
1049
- ]),
1050
- t("span", null, I(U.menuName), 1)
1051
- ]),
1052
- _: 2
1053
- }, 1032, ["index"]))), 128))
1054
- ]),
1055
- _: 2
1056
- }, 1032, ["index"])) : (c(), A(m(ue), {
1057
- key: 1,
1058
- index: C.menuUrl
1059
- }, {
1060
- default: M(() => [
1061
- t("span", Ns, [
1062
- S(l(C.icon)) ? (c(), A(m(P), {
1063
- key: 0,
1064
- name: l(C.icon),
1065
- size: 16
1066
- }, null, 8, ["name"])) : (c(), _("span", Es, I(r(C.menuName)), 1))
1067
- ]),
1068
- t("span", null, I(C.menuName), 1)
1069
- ]),
1070
- _: 2
1071
- }, 1032, ["index"]))
1072
- ], 64))), 128))
1073
- ]),
1074
- _: 1
1075
- }, 8, ["default-active", "background-color", "text-color", "active-text-color"])
1076
- ]));
1077
- }
1078
- }), Rs = /* @__PURE__ */ K(Ps, [["__scopeId", "data-v-8b571a75"]]), As = { class: "mix-top-menu" }, Ds = { class: "mix-top-menu__logo" }, zs = { class: "mix-top-menu__logo-text" }, Os = { class: "mix-top-menu__items" }, Bs = ["onClick"], Vs = { class: "mix-top-menu__item-icon" }, Fs = {
1079
- key: 1,
1080
- class: "mix-top-menu__item-char"
1081
- }, Ks = { class: "mix-top-menu__item-text" }, js = /* @__PURE__ */ q({
1082
- __name: "MixTopMenu",
1083
- setup(e) {
1084
- const s = Q(), o = X(), n = Z(), a = J(), d = y(() => a.activeTopMenuPath), b = y(() => n.menuList), p = /* @__PURE__ */ new Set([
1085
- "arrow-up",
1086
- "arrow-down",
1087
- "arrow-left",
1088
- "arrow-right",
1089
- "caret-down",
1090
- "caret-right",
1091
- "plus",
1092
- "minus",
1093
- "close",
1094
- "check",
1095
- "edit",
1096
- "delete",
1097
- "copy",
1098
- "download",
1099
- "upload",
1100
- "refresh",
1101
- "search",
1102
- "filter",
1103
- "more",
1104
- "setting",
1105
- "share",
1106
- "loading",
1107
- "info",
1108
- "success",
1109
- "warning",
1110
- "error",
1111
- "question",
1112
- "user",
1113
- "user-add",
1114
- "user-group",
1115
- "logout",
1116
- "login",
1117
- "file",
1118
- "folder",
1119
- "folder-open",
1120
- "document",
1121
- "image",
1122
- "video",
1123
- "music",
1124
- "camera",
1125
- "mail",
1126
- "phone",
1127
- "chat",
1128
- "bell",
1129
- "message",
1130
- "eye",
1131
- "eye-off",
1132
- "calendar",
1133
- "clock",
1134
- "history",
1135
- "timer",
1136
- "location",
1137
- "map",
1138
- "globe",
1139
- "star",
1140
- "heart",
1141
- "thumb-up",
1142
- "link",
1143
- "external-link",
1144
- "lock",
1145
- "unlock",
1146
- "key",
1147
- "home",
1148
- "menu",
1149
- "menu-fold",
1150
- "menu-unfold",
1151
- "sidebar-fold",
1152
- "sidebar-expand",
1153
- "sidebar-left",
1154
- "dashboard",
1155
- "chart",
1156
- "chart-pie",
1157
- "chart-line",
1158
- "report",
1159
- "analytics",
1160
- "system",
1161
- "permission",
1162
- "role",
1163
- "user-manage",
1164
- "log",
1165
- "notification",
1166
- "app",
1167
- "list",
1168
- "grid",
1169
- "fullscreen",
1170
- "fullscreen-exit",
1171
- "zoom-in",
1172
- "zoom-out",
1173
- "print",
1174
- "bookmark",
1175
- "tag",
1176
- "code",
1177
- "terminal",
1178
- "database",
1179
- "server",
1180
- "cloud",
1181
- "gift",
1182
- "moon",
1183
- "sun",
1184
- "theme",
1185
- "skin"
1186
- ]), f = (r) => {
1187
- if (!r || r === "") return "";
1188
- if (r.startsWith("tineco-icon-")) {
1189
- const v = r.replace("tineco-icon-", "");
1190
- return {
1191
- home: "home",
1192
- dashboard: "dashboard",
1193
- system: "system",
1194
- user: "user",
1195
- role: "role",
1196
- menu: "list",
1197
- setting: "setting",
1198
- file: "file",
1199
- folder: "folder",
1200
- chart: "chart",
1201
- report: "report",
1202
- analytics: "analytics"
1203
- }[v] || v;
1204
- }
1205
- return {
1206
- dashboard: "dashboard",
1207
- system: "system",
1208
- user: "user",
1209
- role: "role",
1210
- menu: "list",
1211
- setting: "setting",
1212
- home: "home",
1213
- chart: "chart",
1214
- report: "report",
1215
- analytics: "analytics",
1216
- permission: "permission",
1217
- log: "log",
1218
- notification: "notification",
1219
- app: "app",
1220
- list: "list",
1221
- grid: "grid"
1222
- }[r] || r;
1223
- }, i = (r) => r ? r.charAt(0) : "", u = (r) => p.has(r), l = (r) => {
1224
- if (a.setActiveTopMenuPath(r.menuUrl), r.menuUrl)
1225
- if (r.children && r.children.length > 0) {
1226
- const S = r.children.find((v) => v.isDefault) || r.children[0];
1227
- S && S.menuUrl !== s.path && o.push(S.menuUrl);
1228
- } else r.menuUrl !== s.path && o.push(r.menuUrl);
1229
- };
1230
- return je(() => {
1231
- if (!a.activeTopMenuPath && b.value.length > 0) {
1232
- for (const r of b.value) {
1233
- if (r.menuUrl === s.path) {
1234
- a.setActiveTopMenuPath(r.menuUrl);
1235
- break;
1236
- }
1237
- if (r.children && r.children.length > 0 && r.children.some(
1238
- (v) => v.menuUrl === s.path || v.children && v.children.some((R) => R.menuUrl === s.path)
1239
- )) {
1240
- a.setActiveTopMenuPath(r.menuUrl);
1241
- break;
1242
- }
1243
- }
1244
- a.activeTopMenuPath || a.setActiveTopMenuPath(b.value[0].menuUrl);
1245
- }
1246
- }), (r, S) => (c(), _("div", As, [
1247
- t("div", Ds, [
1248
- t("span", zs, I(m(a).appName), 1)
1249
- ]),
1250
- t("div", Os, [
1251
- (c(!0), _(D, null, F(b.value, (v) => (c(), _("div", {
1252
- key: v.menuUrl,
1253
- class: V(["mix-top-menu__item", { "is-active": d.value === v.menuUrl }]),
1254
- onClick: (R) => l(v)
1255
- }, [
1256
- t("span", Vs, [
1257
- u(f(v.icon)) ? (c(), A(m(P), {
1258
- key: 0,
1259
- name: f(v.icon),
1260
- size: 16
1261
- }, null, 8, ["name"])) : (c(), _("span", Fs, I(i(v.menuName)), 1))
1262
- ]),
1263
- t("span", Ks, I(v.menuName), 1)
1264
- ], 10, Bs))), 128))
1265
- ]),
1266
- S[0] || (S[0] = t("div", { class: "mix-top-menu__actions" }, null, -1))
1267
- ]));
1268
- }
1269
- }), qs = /* @__PURE__ */ K(js, [["__scopeId", "data-v-5df2ff55"]]), Ys = { class: "layout__mix-body" }, Ws = { class: "layout__main" }, Hs = { class: "layout__header" }, Xs = { class: "layout__content" }, Js = { class: "layout__main" }, Qs = { class: "layout__header" }, Zs = { class: "layout__content" }, Gs = /* @__PURE__ */ q({
1270
- __name: "index",
1271
- setup(e) {
1272
- const s = Q(), o = J(), n = Z(), a = y(
1273
- () => o.isCollapsed ? "64px" : "210px"
1274
- ), d = y(() => o.layout), b = y(() => d.value === "sidebar" ? !0 : d.value === "mix" ? f.value.length > 0 : !1), p = y(() => d.value === "top"), f = y(() => {
1275
- if (d.value !== "mix") return n.menuList;
1276
- const i = o.activeTopMenuPath;
1277
- if (!i) return [];
1278
- const u = n.menuList.find((l) => l.menuUrl === i);
1279
- return (u == null ? void 0 : u.children) || [];
1280
- });
1281
- return Fe(
1282
- () => s.path,
1283
- (i) => {
1284
- if (d.value === "mix" && n.menuList.length > 0)
1285
- for (const u of n.menuList) {
1286
- if (u.menuUrl === i) {
1287
- (!o.activeTopMenuPath || o.activeTopMenuPath !== u.menuUrl) && o.setActiveTopMenuPath(u.menuUrl);
1288
- break;
1289
- }
1290
- if (u.children && u.children.length > 0 && u.children.some(
1291
- (r) => r.menuUrl === i || r.children && r.children.some((S) => S.menuUrl === i)
1292
- )) {
1293
- (!o.activeTopMenuPath || o.activeTopMenuPath !== u.menuUrl) && o.setActiveTopMenuPath(u.menuUrl);
1294
- break;
1295
- }
1296
- }
1297
- },
1298
- { immediate: !0 }
1299
- ), (i, u) => {
1300
- const l = mt("router-view");
1301
- return c(), _("div", {
1302
- class: V(["layout", `layout--${d.value}`])
1303
- }, [
1304
- d.value === "mix" ? (c(), _(D, { key: 0 }, [
1305
- x(qs),
1306
- t("div", Ys, [
1307
- f.value.length > 0 ? (c(), _("aside", {
1308
- key: 0,
1309
- class: "layout__aside",
1310
- style: xe({ width: a.value })
1311
- }, [
1312
- x(Be, { "menu-list": f.value }, null, 8, ["menu-list"])
1313
- ], 4)) : z("", !0),
1314
- t("div", Ws, [
1315
- t("header", Hs, [
1316
- x(Ve)
1317
- ]),
1318
- t("main", Xs, [
1319
- x(l)
1320
- ])
1321
- ])
1322
- ])
1323
- ], 64)) : (c(), _(D, { key: 1 }, [
1324
- b.value ? (c(), _("aside", {
1325
- key: 0,
1326
- class: "layout__aside",
1327
- style: xe({ width: a.value })
1328
- }, [
1329
- x(Be, {
1330
- "menu-list": m(n).menuList
1331
- }, null, 8, ["menu-list"])
1332
- ], 4)) : z("", !0),
1333
- p.value ? (c(), A(Rs, { key: 1 })) : z("", !0),
1334
- t("div", Js, [
1335
- t("header", Qs, [
1336
- x(Ve)
1337
- ]),
1338
- t("main", Zs, [
1339
- x(l)
1340
- ])
1341
- ])
1342
- ], 64))
1343
- ], 2);
1344
- };
1345
- }
1346
- }), et = /* @__PURE__ */ K(Gs, [["__scopeId", "data-v-335d0383"]]), eo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1347
- __proto__: null,
1348
- default: et
1349
- }, Symbol.toStringTag, { value: "Module" })), to = { class: "tabs-wrapper" }, so = { class: "tab-label" }, oo = ["onClick"], no = /* @__PURE__ */ q({
1350
- __name: "Tabs",
1351
- setup(e) {
1352
- const s = Q(), o = X(), n = y(() => {
1353
- const p = [];
1354
- return s.matched.forEach((f) => {
1355
- var i;
1356
- (i = f.meta) != null && i.affix && p.push({
1357
- name: f.name,
1358
- title: f.meta.title,
1359
- path: f.path,
1360
- affix: !0
1361
- });
1362
- }), p;
1363
- }), a = y(() => s.path), d = (p) => {
1364
- o.push(p);
1365
- }, b = (p) => {
1366
- const f = n.value.find((i) => i.path === p);
1367
- if (!(f != null && f.affix) && p === a.value) {
1368
- const i = n.value.findIndex((l) => l.path === p), u = n.value[i - 1] || n.value[i + 1];
1369
- u && o.push(u.path);
1370
- }
1371
- };
1372
- return (p, f) => (c(), _("div", to, [
1373
- x(m(pt), {
1374
- modelValue: a.value,
1375
- "onUpdate:modelValue": f[0] || (f[0] = (i) => a.value = i),
1376
- type: "card",
1377
- onTabClick: d
1378
- }, {
1379
- default: M(() => [
1380
- (c(!0), _(D, null, F(n.value, (i) => (c(), A(m(ht), {
1381
- key: i.path,
1382
- name: i.path,
1383
- label: i.title,
1384
- closable: !i.affix
1385
- }, {
1386
- label: M(() => [
1387
- t("span", so, [
1388
- te(I(i.title) + " ", 1),
1389
- i.affix ? z("", !0) : (c(), _("span", {
1390
- key: 0,
1391
- class: "tab-close",
1392
- onClick: qe((u) => b(i.path), ["stop"])
1393
- }, " ✕ ", 8, oo))
1394
- ])
1395
- ]),
1396
- _: 2
1397
- }, 1032, ["name", "label", "closable"]))), 128))
1398
- ]),
1399
- _: 1
1400
- }, 8, ["modelValue"])
1401
- ]));
1402
- }
1403
- }), Ho = /* @__PURE__ */ K(no, [["__scopeId", "data-v-9156d8cd"]]), ao = {}, ro = { class: "footer" };
1404
- function lo(e, s) {
1405
- return c(), _("div", ro, [...s[0] || (s[0] = [
1406
- t("span", null, "Copyright © 2024 Xto Demo. All Rights Reserved.", -1)
1407
- ])]);
1408
- }
1409
- const Xo = /* @__PURE__ */ K(ao, [["render", lo], ["__scopeId", "data-v-4852826a"]]), io = () => {
1410
- const e = gt.create({
1411
- baseURL: void 0,
1412
- timeout: 3e4,
1413
- headers: {
1414
- "Content-Type": "application/json"
1415
- }
1416
- });
1417
- return e.interceptors.request.use(
1418
- (s) => {
1419
- const o = fe(), n = bt() || "Bearer";
1420
- return o && (s.headers.Authorization = `${n} ${o}`), s;
1421
- },
1422
- (s) => Promise.reject(s)
1423
- ), e.interceptors.response.use(
1424
- (s) => {
1425
- const { data: o } = s;
1426
- return o.code === 200 || o.code === 0 ? o.data : (H.error(o.message || "请求失败"), Promise.reject(new Error(o.message || "请求失败")));
1427
- },
1428
- (s) => {
1429
- var n;
1430
- const { response: o } = s;
1431
- if (o)
1432
- switch (o.status) {
1433
- case 401:
1434
- H.error("登录已过期,请重新登录"), Ze(), window.location.href = "/login";
1435
- break;
1436
- case 403:
1437
- H.error("没有权限访问");
1438
- break;
1439
- case 404:
1440
- H.error("请求资源不存在");
1441
- break;
1442
- case 500:
1443
- H.error("服务器错误");
1444
- break;
1445
- default:
1446
- H.error(((n = o.data) == null ? void 0 : n.message) || "请求失败");
1447
- }
1448
- else
1449
- H.error("网络连接失败");
1450
- return Promise.reject(s);
1451
- }
1452
- ), e;
1453
- }, ne = io(), L = {
1454
- get(e, s) {
1455
- return ne.get(e, s);
1456
- },
1457
- post(e, s, o) {
1458
- return ne.post(e, s, o);
1459
- },
1460
- put(e, s, o) {
1461
- return ne.put(e, s, o);
1462
- },
1463
- patch(e, s, o) {
1464
- return ne.patch(e, s, o);
1465
- },
1466
- delete(e, s) {
1467
- return ne.delete(e, s);
1468
- }
1469
- };
1470
- function uo(e) {
1471
- return L.post("/user/v1.0/login/by-domain", e);
1472
- }
1473
- function Jo() {
1474
- return L.put("/user/v1.0/user/logout");
1475
- }
1476
- function co() {
1477
- return L.get("/user/v1.0/user/get-me");
1478
- }
1479
- function Qo(e) {
1480
- return L.post("/user/v1.0/refresh", { refreshToken: e });
1481
- }
1482
- const ce = k(""), de = k(""), me = k("");
1483
- function Zo(e) {
1484
- e.appId && (ce.value = e.appId), e.clientId && (de.value = e.clientId), e.apiBaseUrl && (me.value = e.apiBaseUrl);
1485
- }
1486
- function Pe() {
1487
- if (ce.value)
1488
- return ce.value;
1489
- try {
1490
- return "";
1491
- } catch {
1492
- return "";
1493
- }
1494
- }
1495
- function mo() {
1496
- if (de.value)
1497
- return de.value;
1498
- try {
1499
- return "";
1500
- } catch {
1501
- return "";
1502
- }
1503
- }
1504
- function Go() {
1505
- if (me.value)
1506
- return me.value;
1507
- try {
1508
- return "";
1509
- } catch {
1510
- return "";
1511
- }
1512
- }
1513
- const en = {
1514
- appId: ce,
1515
- clientId: de,
1516
- apiBaseUrl: me
1517
- }, po = { class: "login" }, ho = { class: "login__container" }, fo = /* @__PURE__ */ q({
1518
- __name: "index",
1519
- setup(e) {
1520
- const s = X(), o = Q(), n = k(!1), a = k(!1), d = Ce({
1521
- uid: "",
1522
- password: ""
1523
- }), b = {
1524
- uid: [
1525
- { required: !0, message: "请输入用户名", trigger: "blur" }
1526
- ],
1527
- password: [
1528
- { required: !0, message: "请输入密码", trigger: "blur" },
1529
- { min: 6, message: "密码长度至少6位", trigger: "blur" }
1530
- ]
1531
- }, p = k(), f = async () => {
1532
- var i;
1533
- try {
1534
- await ((i = p.value) == null ? void 0 : i.validate()), n.value = !0;
1535
- const u = await uo({
1536
- appId: Pe(),
1537
- clientId: mo(),
1538
- uid: d.uid,
1539
- password: d.password,
1540
- code: !0
1541
- });
1542
- Qe(u), H.success("登录成功");
1543
- const l = o.query.redirect || "/";
1544
- s.push(l);
1545
- } catch (u) {
1546
- console.error("登录失败:", u);
1547
- } finally {
1548
- n.value = !1;
1549
- }
1550
- };
1551
- return (i, u) => (c(), _("div", po, [
1552
- t("div", ho, [
1553
- u[5] || (u[5] = t("div", { class: "login__header" }, [
1554
- t("img", {
1555
- src: Je,
1556
- alt: "Logo",
1557
- class: "login__logo"
1558
- }),
1559
- t("h1", { class: "login__title" }, "Xto Demo"),
1560
- t("p", { class: "login__subtitle" }, "后台管理系统")
1561
- ], -1)),
1562
- x(m(vt), {
1563
- ref_key: "formRef",
1564
- ref: p,
1565
- model: d,
1566
- rules: b,
1567
- class: "login__form",
1568
- "label-width": "0"
1569
- }, {
1570
- default: M(() => [
1571
- x(m(re), { prop: "uid" }, {
1572
- default: M(() => [
1573
- x(m(Oe), {
1574
- modelValue: d.uid,
1575
- "onUpdate:modelValue": u[0] || (u[0] = (l) => d.uid = l),
1576
- placeholder: "用户名",
1577
- size: "large"
1578
- }, {
1579
- prefix: M(() => [
1580
- x(m(P), {
1581
- name: "user",
1582
- size: 18
1583
- })
1584
- ]),
1585
- _: 1
1586
- }, 8, ["modelValue"])
1587
- ]),
1588
- _: 1
1589
- }),
1590
- x(m(re), { prop: "password" }, {
1591
- default: M(() => [
1592
- x(m(Oe), {
1593
- modelValue: d.password,
1594
- "onUpdate:modelValue": u[1] || (u[1] = (l) => d.password = l),
1595
- type: "password",
1596
- placeholder: "密码",
1597
- size: "large",
1598
- "show-password": "",
1599
- onKeyup: Ye(f, ["enter"])
1600
- }, {
1601
- prefix: M(() => [
1602
- x(m(P), {
1603
- name: "lock",
1604
- size: 18
1605
- })
1606
- ]),
1607
- _: 1
1608
- }, 8, ["modelValue"])
1609
- ]),
1610
- _: 1
1611
- }),
1612
- x(m(re), null, {
1613
- default: M(() => [
1614
- x(m(_t), {
1615
- modelValue: a.value,
1616
- "onUpdate:modelValue": u[2] || (u[2] = (l) => a.value = l)
1617
- }, {
1618
- default: M(() => [...u[3] || (u[3] = [
1619
- te("记住我", -1)
1620
- ])]),
1621
- _: 1
1622
- }, 8, ["modelValue"])
1623
- ]),
1624
- _: 1
1625
- }),
1626
- x(m(re), null, {
1627
- default: M(() => [
1628
- x(m(he), {
1629
- type: "primary",
1630
- size: "large",
1631
- loading: n.value,
1632
- class: "login__submit",
1633
- onClick: f
1634
- }, {
1635
- default: M(() => [...u[4] || (u[4] = [
1636
- te(" 登录 ", -1)
1637
- ])]),
1638
- _: 1
1639
- }, 8, ["loading"])
1640
- ]),
1641
- _: 1
1642
- })
1643
- ]),
1644
- _: 1
1645
- }, 8, ["model"]),
1646
- u[6] || (u[6] = t("div", { class: "login__footer" }, [
1647
- t("p", null, "请输入您的用户名和密码")
1648
- ], -1))
1649
- ])
1650
- ]));
1651
- }
1652
- }), vo = /* @__PURE__ */ K(fo, [["__scopeId", "data-v-f3e724b6"]]), _o = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1653
- __proto__: null,
1654
- default: vo
1655
- }, Symbol.toStringTag, { value: "Module" })), go = { class: "error-page" }, yo = { class: "error-page__content" }, ko = /* @__PURE__ */ q({
1656
- __name: "404",
1657
- setup(e) {
1658
- const s = X(), o = () => {
1659
- s.push("/");
1660
- };
1661
- return (n, a) => (c(), _("div", go, [
1662
- t("div", yo, [
1663
- a[1] || (a[1] = t("div", { class: "error-page__code" }, "404", -1)),
1664
- a[2] || (a[2] = t("div", { class: "error-page__title" }, "页面不存在", -1)),
1665
- a[3] || (a[3] = t("div", { class: "error-page__desc" }, "抱歉,您访问的页面不存在或已被删除", -1)),
1666
- x(m(he), {
1667
- type: "primary",
1668
- onClick: o
1669
- }, {
1670
- default: M(() => [...a[0] || (a[0] = [
1671
- te("返回首页", -1)
1672
- ])]),
1673
- _: 1
1674
- })
1675
- ])
1676
- ]));
1677
- }
1678
- }), bo = /* @__PURE__ */ K(ko, [["__scopeId", "data-v-c3c12c24"]]), wo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1679
- __proto__: null,
1680
- default: bo
1681
- }, Symbol.toStringTag, { value: "Module" })), xo = { class: "error-page" }, Co = { class: "error-page__content" }, To = /* @__PURE__ */ q({
1682
- __name: "403",
1683
- setup(e) {
1684
- const s = X(), o = () => {
1685
- s.push("/");
1686
- };
1687
- return (n, a) => (c(), _("div", xo, [
1688
- t("div", Co, [
1689
- a[1] || (a[1] = t("div", { class: "error-page__code" }, "403", -1)),
1690
- a[2] || (a[2] = t("div", { class: "error-page__title" }, "无访问权限", -1)),
1691
- a[3] || (a[3] = t("div", { class: "error-page__desc" }, "抱歉,您没有权限访问此页面", -1)),
1692
- x(m(he), {
1693
- type: "primary",
1694
- onClick: o
1695
- }, {
1696
- default: M(() => [...a[0] || (a[0] = [
1697
- te("返回首页", -1)
1698
- ])]),
1699
- _: 1
1700
- })
1701
- ])
1702
- ]));
1703
- }
1704
- }), Io = /* @__PURE__ */ K(To, [["__scopeId", "data-v-dd5f2795"]]), Mo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1705
- __proto__: null,
1706
- default: Io
1707
- }, Symbol.toStringTag, { value: "Module" }));
1708
- function tn() {
1709
- const e = J(), s = Y(), o = Ee(), n = y(() => s.userName || ""), a = y(() => s.userInfo), d = y(() => e.appName), b = y(() => o.isLoggedIn), p = y(() => e.isDark), f = y(() => e.theme), i = y(() => e.isCollapsed), u = y(() => e.layout);
1710
- return {
1711
- userName: n,
1712
- userInfo: a,
1713
- appName: d,
1714
- isLoggedIn: b,
1715
- isDark: p,
1716
- theme: f,
1717
- isCollapsed: i,
1718
- layout: u,
1719
- toggleTheme: () => {
1720
- e.toggleTheme();
1721
- },
1722
- toggleCollapse: () => {
1723
- e.toggleCollapse();
1724
- }
1725
- };
1726
- }
1727
- function sn() {
1728
- const e = Y();
1729
- return {
1730
- isLoggedIn: y(() => e.isLoggedIn)
1731
- };
1732
- }
1733
- function on(e, s = {}) {
1734
- const { rules: o, onSubmit: n } = s, a = k(), d = Ce({ ...e }), b = k(!1), p = k(!1), f = k(!1), i = () => {
1735
- r(), f.value = !1, p.value = !0;
1736
- }, u = (v) => {
1737
- Object.assign(d, v), f.value = !0, p.value = !0;
1738
- }, l = () => {
1739
- p.value = !1, r();
1740
- }, r = () => {
1741
- var v;
1742
- Object.keys(e).forEach((R) => {
1743
- d[R] = e[R];
1744
- }), (v = a.value) == null || v.resetFields();
1745
- };
1746
- return {
1747
- formRef: a,
1748
- formData: d,
1749
- rules: o,
1750
- loading: b,
1751
- visible: p,
1752
- isEdit: f,
1753
- openAdd: i,
1754
- openEdit: u,
1755
- close: l,
1756
- resetForm: r,
1757
- handleSubmit: async () => {
1758
- var v;
1759
- try {
1760
- await ((v = a.value) == null ? void 0 : v.validate()), b.value = !0, await (n == null ? void 0 : n(d)), l();
1761
- } catch (R) {
1762
- console.error(R);
1763
- } finally {
1764
- b.value = !1;
1765
- }
1766
- }
1767
- };
1768
- }
1769
- function nn(e) {
1770
- const { fetchData: s, defaultPageSize: o = 10 } = e, n = k(!1), a = k([]), d = k(0), b = k(1), p = k(o), f = Ce({}), i = async () => {
1771
- n.value = !0;
1772
- try {
1773
- const C = {
1774
- ...f,
1775
- page: b.value,
1776
- pageSize: p.value
1777
- }, U = await s(C);
1778
- a.value = U.list, d.value = U.total;
1779
- } catch (C) {
1780
- console.error(C);
1781
- } finally {
1782
- n.value = !1;
1783
- }
1784
- }, u = () => {
1785
- b.value = 1, i();
1786
- }, l = () => {
1787
- Object.keys(f).forEach((C) => {
1788
- f[C] = void 0;
1789
- }), b.value = 1, i();
1790
- }, r = (C) => {
1791
- b.value = C, i();
1792
- }, S = (C) => {
1793
- p.value = C, b.value = 1, i();
1794
- }, v = () => {
1795
- i();
1796
- }, R = y(() => ({
1797
- current: b.value,
1798
- pageSize: p.value,
1799
- total: d.value
1800
- }));
1801
- return {
1802
- loading: n,
1803
- data: a,
1804
- total: d,
1805
- currentPage: b,
1806
- pageSize: p,
1807
- searchParams: f,
1808
- pagination: R,
1809
- getData: i,
1810
- handleSearch: u,
1811
- handleReset: l,
1812
- handlePageChange: r,
1813
- handleSizeChange: S,
1814
- refresh: v
1815
- };
1816
- }
1817
- function an(e) {
1818
- return Y().isLoggedIn;
1819
- }
1820
- function rn(e) {
1821
- return Y().isLoggedIn;
1822
- }
1823
- function ln() {
1824
- return !0;
1825
- }
1826
- const tt = [
1827
- {
1828
- path: "/login",
1829
- name: "Login",
1830
- component: () => Promise.resolve().then(() => _o),
1831
- meta: {
1832
- title: "登录",
1833
- hidden: !0
1834
- }
1835
- },
1836
- {
1837
- path: "/404",
1838
- name: "NotFound",
1839
- component: () => Promise.resolve().then(() => wo),
1840
- meta: {
1841
- title: "404",
1842
- hidden: !0
1843
- }
1844
- },
1845
- {
1846
- path: "/403",
1847
- name: "Forbidden",
1848
- component: () => Promise.resolve().then(() => Mo),
1849
- meta: {
1850
- title: "403",
1851
- hidden: !0
1852
- }
1853
- }
1854
- ], st = {
1855
- path: "/:pathMatch(.*)*",
1856
- redirect: "/404",
1857
- meta: {
1858
- hidden: !0
1859
- }
1860
- }, ot = {
1861
- path: "/",
1862
- name: "Layout",
1863
- component: () => Promise.resolve().then(() => eo),
1864
- redirect: "/dashboard",
1865
- children: [
1866
- {
1867
- path: "/dashboard",
1868
- name: "Dashboard",
1869
- component: () => import("./index-DYjM-bJ4.js"),
1870
- meta: {
1871
- title: "仪表盘",
1872
- icon: "dashboard",
1873
- keepAlive: !0,
1874
- affix: !0
1875
- }
1876
- },
1877
- {
1878
- path: "/system/user",
1879
- name: "SystemUser",
1880
- component: () => import("./index-U9HXi5z6.js"),
1881
- meta: {
1882
- title: "用户管理",
1883
- icon: "user",
1884
- keepAlive: !0
1885
- }
1886
- },
1887
- {
1888
- path: "/system/role",
1889
- name: "SystemRole",
1890
- component: () => import("./index-CXru1UAh.js"),
1891
- meta: {
1892
- title: "角色管理",
1893
- icon: "role",
1894
- keepAlive: !0
1895
- }
1896
- },
1897
- {
1898
- path: "/system/menu",
1899
- name: "SystemMenu",
1900
- component: () => import("./index-Cp8sP57V.js"),
1901
- meta: {
1902
- title: "菜单管理",
1903
- icon: "menu",
1904
- keepAlive: !0
1905
- }
1906
- }
1907
- ]
1908
- }, un = [
1909
- {
1910
- path: "/dashboard",
1911
- name: "Dashboard",
1912
- component: () => import("./index-DYjM-bJ4.js"),
1913
- meta: {
1914
- title: "仪表盘",
1915
- icon: "dashboard",
1916
- keepAlive: !0,
1917
- affix: !0
1918
- }
1919
- },
1920
- {
1921
- path: "/system",
1922
- name: "System",
1923
- redirect: "/system/user",
1924
- meta: {
1925
- title: "系统管理",
1926
- icon: "setting"
1927
- },
1928
- children: [
1929
- {
1930
- path: "user",
1931
- name: "SystemUser",
1932
- component: () => import("./index-U9HXi5z6.js"),
1933
- meta: {
1934
- title: "用户管理",
1935
- icon: "user",
1936
- keepAlive: !0
1937
- }
1938
- },
1939
- {
1940
- path: "role",
1941
- name: "SystemRole",
1942
- component: () => import("./index-CXru1UAh.js"),
1943
- meta: {
1944
- title: "角色管理",
1945
- icon: "role",
1946
- keepAlive: !0
1947
- }
1948
- },
1949
- {
1950
- path: "menu",
1951
- name: "SystemMenu",
1952
- component: () => import("./index-Cp8sP57V.js"),
1953
- meta: {
1954
- title: "菜单管理",
1955
- icon: "menu",
1956
- keepAlive: !0
1957
- }
1958
- }
1959
- ]
1960
- }
1961
- ], So = [
1962
- {
1963
- menuCode: "dashboard",
1964
- menuName: "仪表盘",
1965
- menuUrl: "/dashboard",
1966
- icon: "dashboard",
1967
- closable: !0,
1968
- isDefault: !0,
1969
- isOut: !1
1970
- },
1971
- {
1972
- menuCode: "system",
1973
- menuName: "系统管理",
1974
- menuUrl: "/system",
1975
- icon: "setting",
1976
- closable: !1,
1977
- isDefault: !1,
1978
- isOut: !1,
1979
- children: [
1980
- {
1981
- menuCode: "system_user",
1982
- menuName: "用户管理",
1983
- menuUrl: "/system/user",
1984
- icon: "user",
1985
- closable: !0,
1986
- isDefault: !1,
1987
- isOut: !1
1988
- },
1989
- {
1990
- menuCode: "system_role",
1991
- menuName: "角色管理",
1992
- menuUrl: "/system/role",
1993
- icon: "role",
1994
- closable: !0,
1995
- isDefault: !1,
1996
- isOut: !1
1997
- },
1998
- {
1999
- menuCode: "system_menu",
2000
- menuName: "菜单管理",
2001
- menuUrl: "/system/menu",
2002
- icon: "menu",
2003
- closable: !0,
2004
- isDefault: !1,
2005
- isOut: !1
2006
- }
2007
- ]
2008
- }
2009
- ], nt = Te({
2010
- history: Ie(),
2011
- routes: [...tt, ot, st],
2012
- scrollBehavior: () => ({ left: 0, top: 0 })
2013
- }), Uo = ["/login", "/404", "/403"];
2014
- nt.beforeEach(async (e, s, o) => {
2015
- const n = J();
2016
- if (n.initTheme(), Ge())
2017
- if (e.path === "/login")
2018
- o({ path: "/" });
2019
- else {
2020
- const a = Y();
2021
- a.isLoggedIn || (a.setUserInfo({
2022
- appId: Pe(),
2023
- userId: "1",
2024
- userName: "管理员",
2025
- departmentName: "技术部",
2026
- email: "admin@example.com",
2027
- mobilePhone: "13800138000",
2028
- positionName: "管理员",
2029
- avatar: ""
2030
- }), Z().setMenuList(So)), e.name && e.meta.keepAlive && n.addCachedView(e.name), o();
2031
- }
2032
- else
2033
- Uo.includes(e.path) ? o() : o("/login");
2034
- });
2035
- function cn() {
2036
- const e = Te({
2037
- history: Ie(),
2038
- routes: [...tt, ot, st]
2039
- });
2040
- nt.matcher = e.matcher;
2041
- }
2042
- function dn(e, s = {}) {
2043
- const o = s.indexPath || "/dashboard";
2044
- return {
2045
- path: "/",
2046
- name: "Layout",
2047
- component: et,
2048
- redirect: o,
2049
- children: e
2050
- };
2051
- }
2052
- function mn(e) {
2053
- return Te({
2054
- history: Ie(),
2055
- routes: e,
2056
- scrollBehavior: () => ({ left: 0, top: 0 })
2057
- });
2058
- }
2059
- function pn(e) {
2060
- return L.get("/role/list", { params: e });
2061
- }
2062
- function hn(e) {
2063
- return L.get(`/role/${e}`);
2064
- }
2065
- function fn(e) {
2066
- return L.post("/role", e);
2067
- }
2068
- function vn(e, s) {
2069
- return L.put(`/role/${e}`, s);
2070
- }
2071
- function _n(e) {
2072
- return L.delete(`/role/${e}`);
2073
- }
2074
- function gn(e, s) {
2075
- return L.patch(`/role/${e}/status`, { status: s });
2076
- }
2077
- function yn() {
2078
- return L.get("/user/v1.0/menu/list");
2079
- }
2080
- function Lo(e) {
2081
- const s = e || Pe();
2082
- return L.get(`/user/v1.0/menu/get-menu?appId=${s}`);
2083
- }
2084
- function kn(e) {
2085
- return L.post("/menu", e);
2086
- }
2087
- function bn(e, s) {
2088
- return L.put(`/menu/${e}`, s);
2089
- }
2090
- function wn(e) {
2091
- return L.delete(`/menu/${e}`);
2092
- }
2093
- const $o = ["/login", "/404", "/403"];
2094
- function xn(e, s = {}) {
2095
- const o = s.whiteList || $o, n = s.loginPath || "/login", a = s.homePath || "/";
2096
- e.beforeEach(async (d, b, p) => {
2097
- const f = J(), i = Y(), u = Z();
2098
- if (f.initTheme(), fe())
2099
- if (d.path === n)
2100
- p({ path: a });
2101
- else if (i.isLoggedIn)
2102
- d.name && d.meta.keepAlive && f.addCachedView(d.name), p();
2103
- else
2104
- try {
2105
- if (s.fetchUserInfo) {
2106
- const r = await s.fetchUserInfo();
2107
- i.setUserInfo(r);
2108
- } else {
2109
- const r = await co();
2110
- i.setUserInfo(r);
2111
- }
2112
- if (s.fetchMenu) {
2113
- const r = await s.fetchMenu();
2114
- u.setMenuList(r);
2115
- } else {
2116
- const r = await Lo(s.appId);
2117
- u.setMenuList(r);
2118
- }
2119
- s.onLoginSuccess && s.onLoginSuccess(), d.name && d.meta.keepAlive && f.addCachedView(d.name), p({ ...d, replace: !0 });
2120
- } catch (r) {
2121
- console.error("获取用户信息失败:", r), i.clearUserInfo(), u.clearMenu(), localStorage.removeItem("token"), localStorage.removeItem("token_type"), localStorage.removeItem("refresh_token"), p({ path: n, query: { redirect: d.fullPath } });
2122
- }
2123
- else
2124
- o.includes(d.path) ? p() : p({ path: n, query: { redirect: d.fullPath } });
2125
- }), e.afterEach(() => {
2126
- });
2127
- }
2128
- function Cn(e) {
2129
- return L.get("/user/list", { params: e });
2130
- }
2131
- function Tn(e) {
2132
- return L.get(`/user/${e}`);
2133
- }
2134
- function In(e) {
2135
- return L.post("/user", e);
2136
- }
2137
- function Mn(e, s) {
2138
- return L.put(`/user/${e}`, s);
2139
- }
2140
- function Sn(e) {
2141
- return L.delete(`/user/${e}`);
2142
- }
2143
- function Un(e) {
2144
- return L.post("/user/batch-delete", { ids: e });
2145
- }
2146
- function Ln(e, s) {
2147
- return L.patch(`/user/${e}/status`, { status: s });
2148
- }
2149
- function $n(e) {
2150
- return L.post(`/user/${e}/reset-password`);
2151
- }
2152
- var No = /* @__PURE__ */ ((e) => (e[e.ENABLED = 1] = "ENABLED", e[e.DISABLED = 0] = "DISABLED", e))(No || {}), Eo = /* @__PURE__ */ ((e) => (e[e.UNKNOWN = 0] = "UNKNOWN", e[e.MALE = 1] = "MALE", e[e.FEMALE = 2] = "FEMALE", e))(Eo || {}), Po = /* @__PURE__ */ ((e) => (e[e.DIRECTORY = 0] = "DIRECTORY", e[e.MENU = 1] = "MENU", e[e.BUTTON = 2] = "BUTTON", e))(Po || {});
2153
- const Nn = {
2154
- 1: "启用",
2155
- 0: "禁用"
2156
- }, En = {
2157
- 0: "未知",
2158
- 1: "男",
2159
- 2: "女"
2160
- }, Pn = {
2161
- 0: "目录",
2162
- 1: "菜单",
2163
- 2: "按钮"
2164
- }, Rn = [
2165
- {
2166
- label: "启用",
2167
- value: 1
2168
- /* ENABLED */
2169
- },
2170
- {
2171
- label: "禁用",
2172
- value: 0
2173
- /* DISABLED */
2174
- }
2175
- ], An = [
2176
- {
2177
- label: "未知",
2178
- value: 0
2179
- /* UNKNOWN */
2180
- },
2181
- {
2182
- label: "男",
2183
- value: 1
2184
- /* MALE */
2185
- },
2186
- {
2187
- label: "女",
2188
- value: 2
2189
- /* FEMALE */
2190
- }
2191
- ], Dn = [
2192
- {
2193
- label: "目录",
2194
- value: 0
2195
- /* DIRECTORY */
2196
- },
2197
- {
2198
- label: "菜单",
2199
- value: 1
2200
- /* MENU */
2201
- },
2202
- {
2203
- label: "按钮",
2204
- value: 2
2205
- /* BUTTON */
2206
- }
2207
- ], zn = {
2208
- mounted(e, s) {
2209
- var n;
2210
- Y().isLoggedIn || (n = e.parentNode) == null || n.removeChild(e);
2211
- }
2212
- };
2213
- export {
2214
- St as $,
2215
- Wo as A,
2216
- yn as B,
2217
- Lo as C,
2218
- Yo as D,
2219
- qo as E,
2220
- Xo as F,
2221
- Eo as G,
2222
- Ve as H,
2223
- hn as I,
2224
- pn as J,
2225
- fe as K,
2226
- et as L,
2227
- Po as M,
2228
- Ct as N,
2229
- bt as O,
2230
- Tn as P,
2231
- co as Q,
2232
- Cn as R,
2233
- No as S,
2234
- Ho as T,
2235
- an as U,
2236
- rn as V,
2237
- Ge as W,
2238
- L as X,
2239
- Zo as Y,
2240
- ln as Z,
2241
- K as _,
2242
- Rn as a,
2243
- ot as a0,
2244
- g as a1,
2245
- le as a2,
2246
- uo as a3,
2247
- Jo as a4,
2248
- So as a5,
2249
- zn as a6,
2250
- Qo as a7,
2251
- $n as a8,
2252
- cn as a9,
2253
- nt as aa,
2254
- jo as ab,
2255
- ie as ac,
2256
- Mt as ad,
2257
- It as ae,
2258
- xt as af,
2259
- kt as ag,
2260
- Tt as ah,
2261
- Qe as ai,
2262
- wt as aj,
2263
- xn as ak,
2264
- tt as al,
2265
- bn as am,
2266
- vn as an,
2267
- gn as ao,
2268
- Mn as ap,
2269
- Ln as aq,
2270
- tn as ar,
2271
- J as as,
2272
- sn as at,
2273
- Ee as au,
2274
- on as av,
2275
- Z as aw,
2276
- nn as ax,
2277
- Y as ay,
2278
- Dn as b,
2279
- Io as c,
2280
- An as d,
2281
- En as e,
2282
- Pn as f,
2283
- bo as g,
2284
- Be as h,
2285
- vo as i,
2286
- Nn as j,
2287
- en as k,
2288
- Un as l,
2289
- Ze as m,
2290
- dn as n,
2291
- kn as o,
2292
- fn as p,
2293
- mn as q,
2294
- In as r,
2295
- un as s,
2296
- wn as t,
2297
- _n as u,
2298
- Sn as v,
2299
- st as w,
2300
- Go as x,
2301
- Pe as y,
2302
- mo as z
2303
- };