xto-fronted 0.4.5 → 0.4.6

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,1697 @@
1
+ import { ref as h, computed as k, watch as ot, defineComponent as F, openBlock as g, createElementBlock as w, normalizeClass as O, createElementVNode as t, withDirectives as ze, toDisplayString as U, unref as d, vShow as at, createVNode as b, withCtx as N, Fragment as z, renderList as B, createBlock as Z, createTextVNode as q, createCommentVNode as D, onMounted as nt, onUnmounted as rt, withModifiers as Ve, Transition as Pe, withKeys as Be, vModelText as lt, normalizeStyle as Fe, resolveComponent as it, reactive as ke } from "vue";
2
+ import { defineStore as le } from "pinia";
3
+ import { useRoute as ie, useRouter as W, createRouter as we, createWebHistory as Ce } from "vue-router";
4
+ import { Menu as ut, SubMenu as ct, MenuItem as Oe, Tabs as dt, TabPane as mt } from "@xto/navigation";
5
+ import { Icon as M, Button as ue } from "@xto/base";
6
+ import { Drawer as pt, Message as A } from "@xto/feedback";
7
+ import { Form as vt, FormItem as te, Input as Ae, Checkbox as ht } from "@xto/form";
8
+ import ft from "axios";
9
+ const J = "xto_", Ke = (e) => ({
10
+ get(s) {
11
+ const o = e.getItem(J + 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(J + s);
22
+ return;
23
+ }
24
+ const a = typeof o == "string" ? o : JSON.stringify(o);
25
+ e.setItem(J + s, a);
26
+ },
27
+ remove(s) {
28
+ e.removeItem(J + s);
29
+ },
30
+ clear() {
31
+ Object.keys(e).forEach((o) => {
32
+ o.startsWith(J) && e.removeItem(o);
33
+ });
34
+ }
35
+ }), se = Ke(window.localStorage), oe = Ke(window.sessionStorage), p = {
36
+ get: se.get,
37
+ set: se.set,
38
+ remove: se.remove,
39
+ clear: se.clear
40
+ }, fo = {
41
+ get: oe.get,
42
+ set: oe.set,
43
+ remove: oe.remove,
44
+ clear: oe.clear
45
+ }, H = le("app", () => {
46
+ const e = h(p.get("appName") || "XTO App"), s = h(p.get("indexPath") || "/dashboard"), o = h(p.get("isDark") || !1), a = h(p.get("theme") || "light"), n = h(p.get("layout") || "sidebar"), u = h(p.get("isCollapsed") || !1), y = h(p.get("showTabs") ?? !0), l = h(p.get("showFooter") ?? !0), v = h(p.get("showBreadcrumb") ?? !0), i = h(p.get("primaryColor") || "#409eff"), m = h([]), c = k(() => o.value ? "dark" : "light"), f = (C) => {
47
+ e.value = C, p.set("appName", C);
48
+ }, $ = (C) => {
49
+ s.value = C, p.set("indexPath", C);
50
+ }, x = () => {
51
+ o.value = !o.value, a.value = o.value ? "dark" : "light", L();
52
+ }, S = (C) => {
53
+ a.value = C, o.value = C === "dark", L();
54
+ }, L = () => {
55
+ const C = document.documentElement;
56
+ o.value ? C.classList.add("dark") : C.classList.remove("dark"), p.set("isDark", o.value), p.set("theme", a.value);
57
+ }, E = () => {
58
+ u.value = !u.value, p.set("isCollapsed", u.value);
59
+ }, R = (C) => {
60
+ n.value = C, p.set("layout", C);
61
+ }, K = () => {
62
+ y.value = !y.value, p.set("showTabs", y.value);
63
+ }, me = () => {
64
+ l.value = !l.value, p.set("showFooter", l.value);
65
+ }, pe = () => {
66
+ v.value = !v.value, p.set("showBreadcrumb", v.value);
67
+ }, G = (C) => {
68
+ i.value = C, document.documentElement.style.setProperty("--color-primary", C), p.set("primaryColor", C);
69
+ }, ve = (C) => {
70
+ m.value.includes(C) || m.value.push(C);
71
+ }, he = (C) => {
72
+ const ee = m.value.indexOf(C);
73
+ ee > -1 && m.value.splice(ee, 1);
74
+ }, fe = () => {
75
+ m.value = [];
76
+ }, _e = () => {
77
+ L(), i.value !== "#409eff" && document.documentElement.style.setProperty("--color-primary", i.value);
78
+ };
79
+ return ot(o, L), {
80
+ appName: e,
81
+ indexPath: s,
82
+ isDark: o,
83
+ theme: a,
84
+ layout: n,
85
+ isCollapsed: u,
86
+ showTabs: y,
87
+ showFooter: l,
88
+ showBreadcrumb: v,
89
+ primaryColor: i,
90
+ cachedViews: m,
91
+ themeClass: c,
92
+ setAppName: f,
93
+ setIndexPath: $,
94
+ toggleTheme: x,
95
+ toggleCollapse: E,
96
+ setTheme: S,
97
+ setLayout: R,
98
+ toggleTabs: K,
99
+ toggleFooter: me,
100
+ toggleBreadcrumb: pe,
101
+ setPrimaryColor: G,
102
+ addCachedView: ve,
103
+ removeCachedView: he,
104
+ clearCachedViews: fe,
105
+ initTheme: _e
106
+ };
107
+ }), je = "/vite.svg", ye = "menu_list", _t = {
108
+ menuCode: "home",
109
+ menuName: "首页",
110
+ menuUrl: "/dashboard",
111
+ icon: "home",
112
+ closable: !1,
113
+ isDefault: !1,
114
+ isOut: !1
115
+ }, ce = le("menu", () => {
116
+ const e = h(p.get(ye) || []), s = k(() => e.value.length > 0);
117
+ return {
118
+ menuList: e,
119
+ hasMenu: s,
120
+ setMenuList: (n) => {
121
+ e.value = [_t, ...n], p.set(ye, e.value);
122
+ },
123
+ clearMenu: () => {
124
+ e.value = [], p.remove(ye);
125
+ }
126
+ };
127
+ }), be = "user_info", P = le("user", () => {
128
+ const e = h(p.get(be)), s = k(() => !!e.value), o = k(() => {
129
+ var c;
130
+ return ((c = e.value) == null ? void 0 : c.userId) || "";
131
+ }), a = k(() => {
132
+ var c;
133
+ return ((c = e.value) == null ? void 0 : c.userName) || "";
134
+ }), n = k(() => {
135
+ var c;
136
+ return ((c = e.value) == null ? void 0 : c.departmentName) || "";
137
+ }), u = k(() => {
138
+ var c;
139
+ return ((c = e.value) == null ? void 0 : c.email) || "";
140
+ }), y = k(() => {
141
+ var c;
142
+ return ((c = e.value) == null ? void 0 : c.mobilePhone) || "";
143
+ }), l = k(() => {
144
+ var c;
145
+ return ((c = e.value) == null ? void 0 : c.positionName) || "";
146
+ }), v = k(() => {
147
+ var c;
148
+ return ((c = e.value) == null ? void 0 : c.avatar) || "";
149
+ });
150
+ return {
151
+ userInfo: e,
152
+ isLoggedIn: s,
153
+ userId: o,
154
+ userName: a,
155
+ departmentName: n,
156
+ email: u,
157
+ mobilePhone: y,
158
+ positionName: l,
159
+ avatar: v,
160
+ setUserInfo: (c) => {
161
+ e.value = c, p.set(be, c);
162
+ },
163
+ clearUserInfo: () => {
164
+ e.value = null, p.remove(be);
165
+ }
166
+ };
167
+ }), Ie = "token", Se = "token_type", Le = "refresh_token", Te = "expires_time", Ee = "refresh_time", xe = "code", de = () => p.get(Ie), gt = (e) => {
168
+ p.set(Ie, e);
169
+ }, yt = () => p.get(Se), bt = (e) => {
170
+ p.set(Se, e);
171
+ }, _o = () => p.get(Le), kt = (e) => {
172
+ p.set(Le, e);
173
+ }, wt = () => p.get(Te), Ct = (e) => {
174
+ p.set(Te, e);
175
+ }, go = () => p.get(Ee), It = (e) => {
176
+ p.set(Ee, e);
177
+ }, yo = () => p.get(xe), St = (e) => {
178
+ p.set(xe, e);
179
+ }, Ye = (e) => {
180
+ gt(e.access_token), bt(e.token_type || "Bearer"), kt(e.refresh_token), Ct(e.expires_time), It(e.refresh_time), e.code && St(e.code);
181
+ }, qe = () => {
182
+ p.remove(Ie), p.remove(Se), p.remove(Le), p.remove(Te), p.remove(Ee), p.remove(xe);
183
+ }, Lt = () => {
184
+ const e = wt();
185
+ return e ? Date.now() > e : !0;
186
+ }, We = () => !!de() && !Lt(), Ne = le("auth", () => {
187
+ const e = h(de()), s = k(() => We()), o = h(""), a = h(""), n = h(""), u = h("/login");
188
+ return {
189
+ token: e,
190
+ isLoggedIn: s,
191
+ baseUrl: o,
192
+ appId: a,
193
+ clientId: n,
194
+ loginPath: u,
195
+ login: (f) => {
196
+ e.value = f.access_token, Ye(f);
197
+ },
198
+ logout: () => {
199
+ e.value = null, qe();
200
+ },
201
+ setBaseUrl: (f) => {
202
+ o.value = f;
203
+ },
204
+ setAppId: (f) => {
205
+ a.value = f;
206
+ },
207
+ setClientId: (f) => {
208
+ n.value = f;
209
+ },
210
+ setLoginPath: (f) => {
211
+ u.value = f;
212
+ }
213
+ };
214
+ }), Tt = { class: "sidebar__logo" }, Et = {
215
+ key: 0,
216
+ class: "sidebar__user"
217
+ }, xt = { class: "sidebar__user-info" }, Nt = { class: "sidebar__user-name" }, Ut = { class: "sidebar__user-role" }, Mt = /* @__PURE__ */ F({
218
+ __name: "Sidebar",
219
+ setup(e) {
220
+ const s = ie(), o = W(), a = ce(), n = P(), u = Ne(), y = H(), l = k(() => y.isCollapsed), v = k(() => s.path), i = k(() => y.isDark ? "#1d1e1f" : "#fff"), m = k(() => y.isDark ? "#cfd3dc" : "#303133"), c = k(() => "#409eff"), f = (S) => {
221
+ S && S !== s.path && o.push(S);
222
+ }, $ = () => {
223
+ u.logout(), n.clearUserInfo(), a.clearMenu(), o.push("/login");
224
+ }, x = (S) => {
225
+ if (!S || S === "") return "folder";
226
+ if (S.startsWith("tineco-icon-")) {
227
+ const E = S.replace("tineco-icon-", "");
228
+ return {
229
+ home: "home",
230
+ dashboard: "dashboard",
231
+ system: "system",
232
+ user: "user",
233
+ role: "role",
234
+ menu: "list",
235
+ setting: "setting",
236
+ file: "file",
237
+ folder: "folder",
238
+ chart: "chart",
239
+ report: "report",
240
+ analytics: "analytics"
241
+ }[E] || E;
242
+ }
243
+ return {
244
+ dashboard: "dashboard",
245
+ system: "system",
246
+ user: "user",
247
+ role: "role",
248
+ menu: "list",
249
+ setting: "setting",
250
+ home: "home",
251
+ chart: "chart",
252
+ report: "report",
253
+ analytics: "analytics",
254
+ // 添加更多映射
255
+ permission: "permission",
256
+ log: "log",
257
+ notification: "notification",
258
+ app: "app",
259
+ list: "list",
260
+ grid: "grid"
261
+ }[S] || S;
262
+ };
263
+ return (S, L) => (g(), w("div", {
264
+ class: O(["sidebar", { "sidebar--collapsed": l.value }])
265
+ }, [
266
+ t("div", Tt, [
267
+ L[0] || (L[0] = t("img", {
268
+ src: je,
269
+ alt: "Logo",
270
+ class: "sidebar__logo-img"
271
+ }, null, -1)),
272
+ ze(t("span", { class: "sidebar__logo-text" }, U(d(y).appName), 513), [
273
+ [at, !l.value]
274
+ ])
275
+ ]),
276
+ b(d(ut), {
277
+ "default-active": v.value,
278
+ mode: "vertical",
279
+ collapse: l.value,
280
+ "collapse-transition": !1,
281
+ "background-color": i.value,
282
+ "text-color": m.value,
283
+ "active-text-color": c.value,
284
+ class: "sidebar__menu",
285
+ onSelect: f
286
+ }, {
287
+ default: N(() => [
288
+ (g(!0), w(z, null, B(d(a).menuList, (E) => (g(), w(z, {
289
+ key: E.menuUrl
290
+ }, [
291
+ E.children && E.children.length > 0 ? (g(), Z(d(ct), {
292
+ key: 0,
293
+ index: E.menuUrl
294
+ }, {
295
+ title: N(() => [
296
+ b(d(M), {
297
+ name: x(E.icon),
298
+ size: 16
299
+ }, null, 8, ["name"]),
300
+ t("span", null, U(E.menuName), 1)
301
+ ]),
302
+ default: N(() => [
303
+ (g(!0), w(z, null, B(E.children, (R) => (g(), Z(d(Oe), {
304
+ key: R.menuUrl,
305
+ index: R.menuUrl
306
+ }, {
307
+ default: N(() => [
308
+ b(d(M), {
309
+ name: x(R.icon),
310
+ size: 16
311
+ }, null, 8, ["name"]),
312
+ t("span", null, U(R.menuName), 1)
313
+ ]),
314
+ _: 2
315
+ }, 1032, ["index"]))), 128))
316
+ ]),
317
+ _: 2
318
+ }, 1032, ["index"])) : (g(), Z(d(Oe), {
319
+ key: 1,
320
+ index: E.menuUrl
321
+ }, {
322
+ default: N(() => [
323
+ b(d(M), {
324
+ name: x(E.icon),
325
+ size: 16
326
+ }, null, 8, ["name"]),
327
+ t("span", null, U(E.menuName), 1)
328
+ ]),
329
+ _: 2
330
+ }, 1032, ["index"]))
331
+ ], 64))), 128))
332
+ ]),
333
+ _: 1
334
+ }, 8, ["default-active", "collapse", "background-color", "text-color", "active-text-color"]),
335
+ l.value ? D("", !0) : (g(), w("div", Et, [
336
+ t("div", xt, [
337
+ t("span", Nt, U(d(n).userName), 1),
338
+ t("span", Ut, U(d(n).departmentName), 1)
339
+ ]),
340
+ b(d(ue), {
341
+ type: "text",
342
+ size: "small",
343
+ onClick: $
344
+ }, {
345
+ default: N(() => [...L[1] || (L[1] = [
346
+ q("退出", -1)
347
+ ])]),
348
+ _: 1
349
+ })
350
+ ]))
351
+ ], 2));
352
+ }
353
+ }), V = (e, s) => {
354
+ const o = e.__vccOpts || e;
355
+ for (const [a, n] of s)
356
+ o[a] = n;
357
+ return o;
358
+ }, $t = /* @__PURE__ */ V(Mt, [["__scopeId", "data-v-556a489e"]]), Rt = { class: "header" }, Dt = { class: "header__left" }, Pt = {
359
+ key: 0,
360
+ class: "header__breadcrumb"
361
+ }, Ot = {
362
+ key: 0,
363
+ class: "breadcrumb-separator"
364
+ }, At = { class: "header__right" }, zt = ["title"], Vt = { class: "header__avatar" }, Bt = { class: "header__user-name" }, Ft = {
365
+ key: 0,
366
+ class: "header__dropdown"
367
+ }, Kt = { class: "header__dropdown-header" }, jt = { class: "header__dropdown-avatar" }, Yt = { class: "header__dropdown-info" }, qt = { class: "header__dropdown-name" }, Wt = { class: "header__dropdown-role" }, Ht = { class: "header__dropdown-menu" }, Xt = { class: "search-container" }, Jt = { class: "search-input-wrapper" }, Qt = {
368
+ key: 0,
369
+ class: "search-results"
370
+ }, Zt = ["onClick"], Gt = { class: "search-result-info" }, es = { class: "search-result-title" }, ts = {
371
+ key: 0,
372
+ class: "search-result-parent"
373
+ }, ss = {
374
+ key: 1,
375
+ class: "search-empty"
376
+ }, os = { class: "settings-drawer" }, as = { class: "settings-section" }, ns = { class: "settings-layout-options" }, rs = ["onClick"], ls = { class: "layout-option__preview" }, is = {
377
+ key: 0,
378
+ class: "layout-preview-sidebar"
379
+ }, us = {
380
+ key: 1,
381
+ class: "layout-preview-top"
382
+ }, cs = {
383
+ key: 2,
384
+ class: "layout-preview-mix"
385
+ }, ds = { class: "layout-option__label" }, ms = { class: "settings-section" }, ps = { class: "settings-color-options" }, vs = ["title", "onClick"], hs = { class: "settings-section" }, fs = { class: "settings-switch-list" }, _s = { class: "settings-switch-item" }, gs = { class: "settings-switch-item" }, ys = /* @__PURE__ */ F({
386
+ __name: "Header",
387
+ setup(e) {
388
+ const s = ie(), o = W(), a = H(), n = P(), u = Ne(), y = ce(), l = h(!1), v = h(!1), i = h(null), m = h(!1), c = h(!1), f = h(""), $ = h(null), x = h(!1), S = [
389
+ { value: "sidebar", label: "左侧菜单", icon: "sidebar-left" },
390
+ { value: "top", label: "顶部菜单", icon: "menu" },
391
+ { value: "mix", label: "混合菜单", icon: "grid" }
392
+ ], L = [
393
+ { value: "#409eff", label: "默认蓝" },
394
+ { value: "#1890ff", label: "科技蓝" },
395
+ { value: "#52c41a", label: "极光绿" },
396
+ { value: "#faad14", label: "日落橙" },
397
+ { value: "#f5222d", label: "薄暮红" },
398
+ { value: "#722ed1", label: "酱紫" }
399
+ ], E = k(() => s.matched.filter((r) => r.meta && r.meta.title).map((r) => ({
400
+ title: r.meta.title,
401
+ path: r.path
402
+ }))), R = (T, r = "") => {
403
+ const j = [];
404
+ return T.forEach((_) => {
405
+ _.children && _.children.length > 0 ? j.push(...R(_.children, _.title)) : j.push({ ..._, parentTitle: r });
406
+ }), j;
407
+ }, K = k(() => f.value.trim() ? R(y.menuList).filter(
408
+ (r) => r.title.toLowerCase().includes(f.value.toLowerCase())
409
+ ) : []), me = k(() => a.layout), pe = () => {
410
+ a.toggleCollapse();
411
+ }, G = () => {
412
+ a.toggleTheme();
413
+ }, ve = () => {
414
+ v.value = !0;
415
+ }, he = (T) => {
416
+ a.setLayout(T);
417
+ }, fe = (T) => {
418
+ x.value = T;
419
+ const r = document.documentElement;
420
+ T ? r.classList.add("grey-mode") : r.classList.remove("grey-mode");
421
+ }, _e = () => {
422
+ document.fullscreenElement ? document.exitFullscreen() : document.documentElement.requestFullscreen();
423
+ }, C = () => {
424
+ m.value = !!document.fullscreenElement;
425
+ }, ee = () => {
426
+ l.value = !l.value;
427
+ }, X = () => {
428
+ l.value = !1;
429
+ }, Me = () => {
430
+ c.value = !0;
431
+ }, ge = () => {
432
+ c.value = !1, f.value = "";
433
+ }, $e = (T) => {
434
+ o.push(T), ge();
435
+ }, Ge = (T) => {
436
+ a.setPrimaryColor(T);
437
+ }, et = () => {
438
+ X(), o.push("/profile");
439
+ }, tt = () => {
440
+ X(), o.push("/change-password");
441
+ }, st = () => {
442
+ X(), u.logout(), n.clearUserInfo(), y.clearMenu(), o.push("/login");
443
+ }, Re = (T) => {
444
+ i.value && !i.value.contains(T.target) && X(), $.value && !$.value.contains(T.target) && ge();
445
+ }, De = (T) => {
446
+ T.key === "Escape" && (ge(), X()), (T.ctrlKey || T.metaKey) && T.key === "k" && (T.preventDefault(), Me());
447
+ };
448
+ return nt(() => {
449
+ document.addEventListener("click", Re), document.addEventListener("fullscreenchange", C), document.addEventListener("keydown", De), a.initTheme(), x.value = document.documentElement.classList.contains("grey-mode");
450
+ }), rt(() => {
451
+ document.removeEventListener("click", Re), document.removeEventListener("fullscreenchange", C), document.removeEventListener("keydown", De);
452
+ }), (T, r) => {
453
+ var j;
454
+ return g(), w("div", Rt, [
455
+ t("div", Dt, [
456
+ t("div", {
457
+ class: "header__collapse",
458
+ onClick: pe
459
+ }, [
460
+ b(d(M), {
461
+ name: d(a).isCollapsed ? "menu-unfold" : "menu-fold",
462
+ size: 18
463
+ }, null, 8, ["name"])
464
+ ]),
465
+ d(a).showBreadcrumb ? (g(), w("div", Pt, [
466
+ (g(!0), w(z, null, B(E.value, (_, Y) => (g(), w("span", {
467
+ key: _.path
468
+ }, [
469
+ Y > 0 ? (g(), w("span", Ot, "/")) : D("", !0),
470
+ t("span", {
471
+ class: O({ "is-current": Y === E.value.length - 1 })
472
+ }, U(_.title), 3)
473
+ ]))), 128))
474
+ ])) : D("", !0)
475
+ ]),
476
+ t("div", At, [
477
+ t("div", {
478
+ class: "header__action",
479
+ onClick: Me,
480
+ title: "搜索 (Ctrl+K)"
481
+ }, [
482
+ b(d(M), {
483
+ name: "search",
484
+ size: 16
485
+ })
486
+ ]),
487
+ t("div", {
488
+ class: "header__action",
489
+ onClick: _e,
490
+ title: m.value ? "退出全屏" : "全屏"
491
+ }, [
492
+ b(d(M), {
493
+ name: m.value ? "fullscreen-exit" : "fullscreen",
494
+ size: 16
495
+ }, null, 8, ["name"])
496
+ ], 8, zt),
497
+ t("div", {
498
+ class: "header__action",
499
+ onClick: ve,
500
+ title: "换肤设置"
501
+ }, [
502
+ b(d(M), {
503
+ name: "setting",
504
+ size: 16
505
+ })
506
+ ]),
507
+ t("div", {
508
+ class: "header__action",
509
+ onClick: G,
510
+ title: "切换主题"
511
+ }, [
512
+ b(d(M), {
513
+ name: d(a).isDark ? "sun" : "moon",
514
+ size: 16
515
+ }, null, 8, ["name"])
516
+ ]),
517
+ t("div", {
518
+ class: "header__user",
519
+ ref_key: "dropdownRef",
520
+ ref: i
521
+ }, [
522
+ t("div", {
523
+ class: "header__user-trigger",
524
+ onClick: Ve(ee, ["stop"])
525
+ }, [
526
+ t("div", Vt, [
527
+ t("span", null, U(((j = d(n).userName) == null ? void 0 : j.charAt(0)) || "U"), 1)
528
+ ]),
529
+ t("span", Bt, U(d(n).userName), 1),
530
+ t("span", {
531
+ class: O(["header__user-arrow", { "is-active": l.value }])
532
+ }, "▼", 2)
533
+ ]),
534
+ b(Pe, { name: "dropdown" }, {
535
+ default: N(() => {
536
+ var _;
537
+ return [
538
+ l.value ? (g(), w("div", Ft, [
539
+ t("div", Kt, [
540
+ t("div", jt, [
541
+ t("span", null, U(((_ = d(n).userName) == null ? void 0 : _.charAt(0)) || "U"), 1)
542
+ ]),
543
+ t("div", Yt, [
544
+ t("div", qt, U(d(n).userName), 1),
545
+ t("div", Wt, U(d(n).departmentName), 1)
546
+ ])
547
+ ]),
548
+ r[8] || (r[8] = t("div", { class: "header__dropdown-divider" }, null, -1)),
549
+ t("div", Ht, [
550
+ t("div", {
551
+ class: "header__dropdown-item",
552
+ onClick: et
553
+ }, [
554
+ b(d(M), {
555
+ name: "user",
556
+ size: 16
557
+ }),
558
+ r[4] || (r[4] = t("span", null, "个人信息", -1))
559
+ ]),
560
+ t("div", {
561
+ class: "header__dropdown-item",
562
+ onClick: tt
563
+ }, [
564
+ b(d(M), {
565
+ name: "lock",
566
+ size: 16
567
+ }),
568
+ r[5] || (r[5] = t("span", null, "修改密码", -1))
569
+ ]),
570
+ r[7] || (r[7] = t("div", { class: "header__dropdown-divider" }, null, -1)),
571
+ t("div", {
572
+ class: "header__dropdown-item header__dropdown-item--danger",
573
+ onClick: st
574
+ }, [
575
+ b(d(M), {
576
+ name: "logout",
577
+ size: 16
578
+ }),
579
+ r[6] || (r[6] = t("span", null, "退出登录", -1))
580
+ ])
581
+ ])
582
+ ])) : D("", !0)
583
+ ];
584
+ }),
585
+ _: 1
586
+ })
587
+ ], 512)
588
+ ]),
589
+ b(Pe, { name: "search" }, {
590
+ default: N(() => [
591
+ c.value ? (g(), w("div", {
592
+ key: 0,
593
+ class: "header__search-modal",
594
+ ref_key: "searchRef",
595
+ ref: $
596
+ }, [
597
+ t("div", Xt, [
598
+ t("div", Jt, [
599
+ b(d(M), {
600
+ class: "search-icon",
601
+ name: "search",
602
+ size: 20
603
+ }),
604
+ ze(t("input", {
605
+ "onUpdate:modelValue": r[0] || (r[0] = (_) => f.value = _),
606
+ type: "text",
607
+ class: "search-input",
608
+ placeholder: "搜索菜单...",
609
+ autofocus: "",
610
+ onKeyup: r[1] || (r[1] = Be((_) => K.value[0] && $e(K.value[0].path), ["enter"]))
611
+ }, null, 544), [
612
+ [lt, f.value]
613
+ ]),
614
+ r[9] || (r[9] = t("span", { class: "search-shortcut" }, "ESC 关闭", -1))
615
+ ]),
616
+ K.value.length > 0 ? (g(), w("div", Qt, [
617
+ (g(!0), w(z, null, B(K.value, (_, Y) => (g(), w("div", {
618
+ key: _.path,
619
+ class: O(["search-result-item", { "is-first": Y === 0 }]),
620
+ onClick: (ro) => $e(_.path)
621
+ }, [
622
+ b(d(M), {
623
+ class: "search-result-icon",
624
+ name: _.icon || "file",
625
+ size: 20
626
+ }, null, 8, ["name"]),
627
+ t("div", Gt, [
628
+ t("span", es, U(_.title), 1),
629
+ _.parentTitle ? (g(), w("span", ts, U(_.parentTitle), 1)) : D("", !0)
630
+ ])
631
+ ], 10, Zt))), 128))
632
+ ])) : f.value ? (g(), w("div", ss, " 未找到匹配的菜单 ")) : D("", !0)
633
+ ])
634
+ ], 512)) : D("", !0)
635
+ ]),
636
+ _: 1
637
+ }),
638
+ b(d(pt), {
639
+ modelValue: v.value,
640
+ "onUpdate:modelValue": r[3] || (r[3] = (_) => v.value = _),
641
+ title: "换肤设置",
642
+ direction: "rtl",
643
+ size: "320px"
644
+ }, {
645
+ default: N(() => [
646
+ t("div", os, [
647
+ t("div", as, [
648
+ r[13] || (r[13] = t("div", { class: "settings-title" }, "布局模式", -1)),
649
+ t("div", ns, [
650
+ (g(), w(z, null, B(S, (_) => t("div", {
651
+ key: _.value,
652
+ class: O(["layout-option", { "is-active": me.value === _.value }]),
653
+ onClick: (Y) => he(_.value)
654
+ }, [
655
+ t("div", ls, [
656
+ _.value === "sidebar" ? (g(), w("div", is, [...r[10] || (r[10] = [
657
+ t("div", { class: "preview-aside" }, null, -1),
658
+ t("div", { class: "preview-main" }, [
659
+ t("div", { class: "preview-header" }),
660
+ t("div", { class: "preview-content" })
661
+ ], -1)
662
+ ])])) : _.value === "top" ? (g(), w("div", us, [...r[11] || (r[11] = [
663
+ t("div", { class: "preview-header-full" }, null, -1),
664
+ t("div", { class: "preview-content-full" }, null, -1)
665
+ ])])) : (g(), w("div", cs, [...r[12] || (r[12] = [
666
+ t("div", { class: "preview-header-mix" }, [
667
+ t("div", { class: "preview-mix-left" })
668
+ ], -1),
669
+ t("div", { class: "preview-mix-body" }, [
670
+ t("div", { class: "preview-mix-aside" }),
671
+ t("div", { class: "preview-mix-content" })
672
+ ], -1)
673
+ ])]))
674
+ ]),
675
+ t("span", ds, U(_.label), 1)
676
+ ], 10, rs)), 64))
677
+ ])
678
+ ]),
679
+ t("div", ms, [
680
+ r[14] || (r[14] = t("div", { class: "settings-title" }, "主题色", -1)),
681
+ t("div", ps, [
682
+ (g(), w(z, null, B(L, (_) => t("div", {
683
+ key: _.value,
684
+ class: O(["color-option", { "is-active": d(a).primaryColor === _.value }]),
685
+ style: Fe({ backgroundColor: _.value }),
686
+ title: _.label,
687
+ onClick: (Y) => Ge(_.value)
688
+ }, [
689
+ d(a).primaryColor === _.value ? (g(), Z(d(M), {
690
+ key: 0,
691
+ name: "check",
692
+ size: 12,
693
+ color: "#fff"
694
+ })) : D("", !0)
695
+ ], 14, vs)), 64))
696
+ ])
697
+ ]),
698
+ t("div", hs, [
699
+ r[19] || (r[19] = t("div", { class: "settings-title" }, "功能设置", -1)),
700
+ t("div", fs, [
701
+ t("div", _s, [
702
+ r[16] || (r[16] = t("span", null, "灰色模式", -1)),
703
+ t("div", {
704
+ class: O(["switch-wrapper", { "is-checked": x.value }]),
705
+ onClick: r[2] || (r[2] = (_) => fe(!x.value))
706
+ }, [...r[15] || (r[15] = [
707
+ t("span", { class: "switch-core" }, null, -1)
708
+ ])], 2)
709
+ ]),
710
+ t("div", gs, [
711
+ r[18] || (r[18] = t("span", null, "暗黑模式", -1)),
712
+ t("div", {
713
+ class: O(["switch-wrapper", { "is-checked": d(a).isDark }]),
714
+ onClick: G
715
+ }, [...r[17] || (r[17] = [
716
+ t("span", { class: "switch-core" }, null, -1)
717
+ ])], 2)
718
+ ])
719
+ ])
720
+ ])
721
+ ])
722
+ ]),
723
+ _: 1
724
+ }, 8, ["modelValue"])
725
+ ]);
726
+ };
727
+ }
728
+ }), bs = /* @__PURE__ */ V(ys, [["__scopeId", "data-v-de94213f"]]), ks = { class: "layout" }, ws = { class: "layout__main" }, Cs = { class: "layout__header" }, Is = { class: "layout__content" }, Ss = /* @__PURE__ */ F({
729
+ __name: "index",
730
+ setup(e) {
731
+ const s = H(), o = k(
732
+ () => s.isCollapsed ? "64px" : "210px"
733
+ );
734
+ return (a, n) => {
735
+ const u = it("router-view");
736
+ return g(), w("div", ks, [
737
+ t("aside", {
738
+ class: "layout__aside",
739
+ style: Fe({ width: o.value })
740
+ }, [
741
+ b($t)
742
+ ], 4),
743
+ t("div", ws, [
744
+ t("header", Cs, [
745
+ b(bs)
746
+ ]),
747
+ t("main", Is, [
748
+ b(u)
749
+ ])
750
+ ])
751
+ ]);
752
+ };
753
+ }
754
+ }), He = /* @__PURE__ */ V(Ss, [["__scopeId", "data-v-a3110011"]]), Ls = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
755
+ __proto__: null,
756
+ default: He
757
+ }, Symbol.toStringTag, { value: "Module" })), Ts = { class: "tabs-wrapper" }, Es = { class: "tab-label" }, xs = ["onClick"], Ns = /* @__PURE__ */ F({
758
+ __name: "Tabs",
759
+ setup(e) {
760
+ const s = ie(), o = W(), a = k(() => {
761
+ const l = [];
762
+ return s.matched.forEach((v) => {
763
+ var i;
764
+ (i = v.meta) != null && i.affix && l.push({
765
+ name: v.name,
766
+ title: v.meta.title,
767
+ path: v.path,
768
+ affix: !0
769
+ });
770
+ }), l;
771
+ }), n = k(() => s.path), u = (l) => {
772
+ o.push(l);
773
+ }, y = (l) => {
774
+ const v = a.value.find((i) => i.path === l);
775
+ if (!(v != null && v.affix) && l === n.value) {
776
+ const i = a.value.findIndex((c) => c.path === l), m = a.value[i - 1] || a.value[i + 1];
777
+ m && o.push(m.path);
778
+ }
779
+ };
780
+ return (l, v) => (g(), w("div", Ts, [
781
+ b(d(dt), {
782
+ modelValue: n.value,
783
+ "onUpdate:modelValue": v[0] || (v[0] = (i) => n.value = i),
784
+ type: "card",
785
+ onTabClick: u
786
+ }, {
787
+ default: N(() => [
788
+ (g(!0), w(z, null, B(a.value, (i) => (g(), Z(d(mt), {
789
+ key: i.path,
790
+ name: i.path,
791
+ label: i.title,
792
+ closable: !i.affix
793
+ }, {
794
+ label: N(() => [
795
+ t("span", Es, [
796
+ q(U(i.title) + " ", 1),
797
+ i.affix ? D("", !0) : (g(), w("span", {
798
+ key: 0,
799
+ class: "tab-close",
800
+ onClick: Ve((m) => y(i.path), ["stop"])
801
+ }, " ✕ ", 8, xs))
802
+ ])
803
+ ]),
804
+ _: 2
805
+ }, 1032, ["name", "label", "closable"]))), 128))
806
+ ]),
807
+ _: 1
808
+ }, 8, ["modelValue"])
809
+ ]));
810
+ }
811
+ }), bo = /* @__PURE__ */ V(Ns, [["__scopeId", "data-v-9156d8cd"]]), Us = {}, Ms = { class: "footer" };
812
+ function $s(e, s) {
813
+ return g(), w("div", Ms, [...s[0] || (s[0] = [
814
+ t("span", null, "Copyright © 2024 Xto Demo. All Rights Reserved.", -1)
815
+ ])]);
816
+ }
817
+ const ko = /* @__PURE__ */ V(Us, [["render", $s], ["__scopeId", "data-v-4852826a"]]), Rs = () => {
818
+ const e = ft.create({
819
+ baseURL: void 0,
820
+ timeout: 3e4,
821
+ headers: {
822
+ "Content-Type": "application/json"
823
+ }
824
+ });
825
+ return e.interceptors.request.use(
826
+ (s) => {
827
+ const o = de(), a = yt() || "Bearer";
828
+ return o && (s.headers.Authorization = `${a} ${o}`), s;
829
+ },
830
+ (s) => Promise.reject(s)
831
+ ), e.interceptors.response.use(
832
+ (s) => {
833
+ const { data: o } = s;
834
+ return o.code === 200 || o.code === 0 ? o.data : (A.error(o.message || "请求失败"), Promise.reject(new Error(o.message || "请求失败")));
835
+ },
836
+ (s) => {
837
+ var a;
838
+ const { response: o } = s;
839
+ if (o)
840
+ switch (o.status) {
841
+ case 401:
842
+ A.error("登录已过期,请重新登录"), qe(), window.location.href = "/login";
843
+ break;
844
+ case 403:
845
+ A.error("没有权限访问");
846
+ break;
847
+ case 404:
848
+ A.error("请求资源不存在");
849
+ break;
850
+ case 500:
851
+ A.error("服务器错误");
852
+ break;
853
+ default:
854
+ A.error(((a = o.data) == null ? void 0 : a.message) || "请求失败");
855
+ }
856
+ else
857
+ A.error("网络连接失败");
858
+ return Promise.reject(s);
859
+ }
860
+ ), e;
861
+ }, Q = Rs(), I = {
862
+ get(e, s) {
863
+ return Q.get(e, s);
864
+ },
865
+ post(e, s, o) {
866
+ return Q.post(e, s, o);
867
+ },
868
+ put(e, s, o) {
869
+ return Q.put(e, s, o);
870
+ },
871
+ patch(e, s, o) {
872
+ return Q.patch(e, s, o);
873
+ },
874
+ delete(e, s) {
875
+ return Q.delete(e, s);
876
+ }
877
+ };
878
+ function Ds(e) {
879
+ return I.post("/user/v1.0/login/by-domain", e);
880
+ }
881
+ function wo() {
882
+ return I.put("/user/v1.0/user/logout");
883
+ }
884
+ function Ps() {
885
+ return I.get("/user/v1.0/user/get-me");
886
+ }
887
+ function Co(e) {
888
+ return I.post("/user/v1.0/refresh", { refreshToken: e });
889
+ }
890
+ const ae = h(""), ne = h(""), re = h("");
891
+ function Io(e) {
892
+ e.appId && (ae.value = e.appId), e.clientId && (ne.value = e.clientId), e.apiBaseUrl && (re.value = e.apiBaseUrl);
893
+ }
894
+ function Ue() {
895
+ if (ae.value)
896
+ return ae.value;
897
+ try {
898
+ return "";
899
+ } catch {
900
+ return "";
901
+ }
902
+ }
903
+ function Os() {
904
+ if (ne.value)
905
+ return ne.value;
906
+ try {
907
+ return "";
908
+ } catch {
909
+ return "";
910
+ }
911
+ }
912
+ function So() {
913
+ if (re.value)
914
+ return re.value;
915
+ try {
916
+ return "";
917
+ } catch {
918
+ return "";
919
+ }
920
+ }
921
+ const Lo = {
922
+ appId: ae,
923
+ clientId: ne,
924
+ apiBaseUrl: re
925
+ }, As = { class: "login" }, zs = { class: "login__container" }, Vs = /* @__PURE__ */ F({
926
+ __name: "index",
927
+ setup(e) {
928
+ const s = W(), o = ie(), a = h(!1), n = h(!1), u = ke({
929
+ uid: "",
930
+ password: ""
931
+ }), y = {
932
+ uid: [
933
+ { required: !0, message: "请输入用户名", trigger: "blur" }
934
+ ],
935
+ password: [
936
+ { required: !0, message: "请输入密码", trigger: "blur" },
937
+ { min: 6, message: "密码长度至少6位", trigger: "blur" }
938
+ ]
939
+ }, l = h(), v = async () => {
940
+ var i;
941
+ try {
942
+ await ((i = l.value) == null ? void 0 : i.validate()), a.value = !0;
943
+ const m = await Ds({
944
+ appId: Ue(),
945
+ clientId: Os(),
946
+ uid: u.uid,
947
+ password: u.password,
948
+ code: !0
949
+ });
950
+ Ye(m), A.success("登录成功");
951
+ const c = o.query.redirect || "/";
952
+ s.push(c);
953
+ } catch (m) {
954
+ console.error("登录失败:", m);
955
+ } finally {
956
+ a.value = !1;
957
+ }
958
+ };
959
+ return (i, m) => (g(), w("div", As, [
960
+ t("div", zs, [
961
+ m[5] || (m[5] = t("div", { class: "login__header" }, [
962
+ t("img", {
963
+ src: je,
964
+ alt: "Logo",
965
+ class: "login__logo"
966
+ }),
967
+ t("h1", { class: "login__title" }, "Xto Demo"),
968
+ t("p", { class: "login__subtitle" }, "后台管理系统")
969
+ ], -1)),
970
+ b(d(vt), {
971
+ ref_key: "formRef",
972
+ ref: l,
973
+ model: u,
974
+ rules: y,
975
+ class: "login__form",
976
+ "label-width": "0"
977
+ }, {
978
+ default: N(() => [
979
+ b(d(te), { prop: "uid" }, {
980
+ default: N(() => [
981
+ b(d(Ae), {
982
+ modelValue: u.uid,
983
+ "onUpdate:modelValue": m[0] || (m[0] = (c) => u.uid = c),
984
+ placeholder: "用户名",
985
+ "prefix-icon": "👤",
986
+ size: "large"
987
+ }, null, 8, ["modelValue"])
988
+ ]),
989
+ _: 1
990
+ }),
991
+ b(d(te), { prop: "password" }, {
992
+ default: N(() => [
993
+ b(d(Ae), {
994
+ modelValue: u.password,
995
+ "onUpdate:modelValue": m[1] || (m[1] = (c) => u.password = c),
996
+ type: "password",
997
+ placeholder: "密码",
998
+ "prefix-icon": "🔒",
999
+ size: "large",
1000
+ "show-password": "",
1001
+ onKeyup: Be(v, ["enter"])
1002
+ }, null, 8, ["modelValue"])
1003
+ ]),
1004
+ _: 1
1005
+ }),
1006
+ b(d(te), null, {
1007
+ default: N(() => [
1008
+ b(d(ht), {
1009
+ modelValue: n.value,
1010
+ "onUpdate:modelValue": m[2] || (m[2] = (c) => n.value = c)
1011
+ }, {
1012
+ default: N(() => [...m[3] || (m[3] = [
1013
+ q("记住我", -1)
1014
+ ])]),
1015
+ _: 1
1016
+ }, 8, ["modelValue"])
1017
+ ]),
1018
+ _: 1
1019
+ }),
1020
+ b(d(te), null, {
1021
+ default: N(() => [
1022
+ b(d(ue), {
1023
+ type: "primary",
1024
+ size: "large",
1025
+ loading: a.value,
1026
+ class: "login__submit",
1027
+ onClick: v
1028
+ }, {
1029
+ default: N(() => [...m[4] || (m[4] = [
1030
+ q(" 登录 ", -1)
1031
+ ])]),
1032
+ _: 1
1033
+ }, 8, ["loading"])
1034
+ ]),
1035
+ _: 1
1036
+ })
1037
+ ]),
1038
+ _: 1
1039
+ }, 8, ["model"]),
1040
+ m[6] || (m[6] = t("div", { class: "login__footer" }, [
1041
+ t("p", null, "请输入您的用户名和密码")
1042
+ ], -1))
1043
+ ])
1044
+ ]));
1045
+ }
1046
+ }), Bs = /* @__PURE__ */ V(Vs, [["__scopeId", "data-v-f8d69f9f"]]), Fs = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1047
+ __proto__: null,
1048
+ default: Bs
1049
+ }, Symbol.toStringTag, { value: "Module" })), Ks = { class: "error-page" }, js = { class: "error-page__content" }, Ys = /* @__PURE__ */ F({
1050
+ __name: "404",
1051
+ setup(e) {
1052
+ const s = W(), o = () => {
1053
+ s.push("/");
1054
+ };
1055
+ return (a, n) => (g(), w("div", Ks, [
1056
+ t("div", js, [
1057
+ n[1] || (n[1] = t("div", { class: "error-page__code" }, "404", -1)),
1058
+ n[2] || (n[2] = t("div", { class: "error-page__title" }, "页面不存在", -1)),
1059
+ n[3] || (n[3] = t("div", { class: "error-page__desc" }, "抱歉,您访问的页面不存在或已被删除", -1)),
1060
+ b(d(ue), {
1061
+ type: "primary",
1062
+ onClick: o
1063
+ }, {
1064
+ default: N(() => [...n[0] || (n[0] = [
1065
+ q("返回首页", -1)
1066
+ ])]),
1067
+ _: 1
1068
+ })
1069
+ ])
1070
+ ]));
1071
+ }
1072
+ }), qs = /* @__PURE__ */ V(Ys, [["__scopeId", "data-v-c3c12c24"]]), Ws = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1073
+ __proto__: null,
1074
+ default: qs
1075
+ }, Symbol.toStringTag, { value: "Module" })), Hs = { class: "error-page" }, Xs = { class: "error-page__content" }, Js = /* @__PURE__ */ F({
1076
+ __name: "403",
1077
+ setup(e) {
1078
+ const s = W(), o = () => {
1079
+ s.push("/");
1080
+ };
1081
+ return (a, n) => (g(), w("div", Hs, [
1082
+ t("div", Xs, [
1083
+ n[1] || (n[1] = t("div", { class: "error-page__code" }, "403", -1)),
1084
+ n[2] || (n[2] = t("div", { class: "error-page__title" }, "无访问权限", -1)),
1085
+ n[3] || (n[3] = t("div", { class: "error-page__desc" }, "抱歉,您没有权限访问此页面", -1)),
1086
+ b(d(ue), {
1087
+ type: "primary",
1088
+ onClick: o
1089
+ }, {
1090
+ default: N(() => [...n[0] || (n[0] = [
1091
+ q("返回首页", -1)
1092
+ ])]),
1093
+ _: 1
1094
+ })
1095
+ ])
1096
+ ]));
1097
+ }
1098
+ }), Qs = /* @__PURE__ */ V(Js, [["__scopeId", "data-v-dd5f2795"]]), Zs = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1099
+ __proto__: null,
1100
+ default: Qs
1101
+ }, Symbol.toStringTag, { value: "Module" }));
1102
+ function To() {
1103
+ const e = H(), s = P(), o = Ne(), a = k(() => s.userName || ""), n = k(() => s.userInfo), u = k(() => e.appName), y = k(() => o.isLoggedIn), l = k(() => e.isDark), v = k(() => e.theme), i = k(() => e.isCollapsed), m = k(() => e.layout);
1104
+ return {
1105
+ userName: a,
1106
+ userInfo: n,
1107
+ appName: u,
1108
+ isLoggedIn: y,
1109
+ isDark: l,
1110
+ theme: v,
1111
+ isCollapsed: i,
1112
+ layout: m,
1113
+ toggleTheme: () => {
1114
+ e.toggleTheme();
1115
+ },
1116
+ toggleCollapse: () => {
1117
+ e.toggleCollapse();
1118
+ }
1119
+ };
1120
+ }
1121
+ function Eo() {
1122
+ const e = P();
1123
+ return {
1124
+ isLoggedIn: k(() => e.isLoggedIn)
1125
+ };
1126
+ }
1127
+ function xo(e, s = {}) {
1128
+ const { rules: o, onSubmit: a } = s, n = h(), u = ke({ ...e }), y = h(!1), l = h(!1), v = h(!1), i = () => {
1129
+ f(), v.value = !1, l.value = !0;
1130
+ }, m = (x) => {
1131
+ Object.assign(u, x), v.value = !0, l.value = !0;
1132
+ }, c = () => {
1133
+ l.value = !1, f();
1134
+ }, f = () => {
1135
+ var x;
1136
+ Object.keys(e).forEach((S) => {
1137
+ u[S] = e[S];
1138
+ }), (x = n.value) == null || x.resetFields();
1139
+ };
1140
+ return {
1141
+ formRef: n,
1142
+ formData: u,
1143
+ rules: o,
1144
+ loading: y,
1145
+ visible: l,
1146
+ isEdit: v,
1147
+ openAdd: i,
1148
+ openEdit: m,
1149
+ close: c,
1150
+ resetForm: f,
1151
+ handleSubmit: async () => {
1152
+ var x;
1153
+ try {
1154
+ await ((x = n.value) == null ? void 0 : x.validate()), y.value = !0, await (a == null ? void 0 : a(u)), c();
1155
+ } catch (S) {
1156
+ console.error(S);
1157
+ } finally {
1158
+ y.value = !1;
1159
+ }
1160
+ }
1161
+ };
1162
+ }
1163
+ function No(e) {
1164
+ const { fetchData: s, defaultPageSize: o = 10 } = e, a = h(!1), n = h([]), u = h(0), y = h(1), l = h(o), v = ke({}), i = async () => {
1165
+ a.value = !0;
1166
+ try {
1167
+ const L = {
1168
+ ...v,
1169
+ page: y.value,
1170
+ pageSize: l.value
1171
+ }, E = await s(L);
1172
+ n.value = E.list, u.value = E.total;
1173
+ } catch (L) {
1174
+ console.error(L);
1175
+ } finally {
1176
+ a.value = !1;
1177
+ }
1178
+ }, m = () => {
1179
+ y.value = 1, i();
1180
+ }, c = () => {
1181
+ Object.keys(v).forEach((L) => {
1182
+ v[L] = void 0;
1183
+ }), y.value = 1, i();
1184
+ }, f = (L) => {
1185
+ y.value = L, i();
1186
+ }, $ = (L) => {
1187
+ l.value = L, y.value = 1, i();
1188
+ }, x = () => {
1189
+ i();
1190
+ }, S = k(() => ({
1191
+ current: y.value,
1192
+ pageSize: l.value,
1193
+ total: u.value
1194
+ }));
1195
+ return {
1196
+ loading: a,
1197
+ data: n,
1198
+ total: u,
1199
+ currentPage: y,
1200
+ pageSize: l,
1201
+ searchParams: v,
1202
+ pagination: S,
1203
+ getData: i,
1204
+ handleSearch: m,
1205
+ handleReset: c,
1206
+ handlePageChange: f,
1207
+ handleSizeChange: $,
1208
+ refresh: x
1209
+ };
1210
+ }
1211
+ function Uo(e) {
1212
+ return P().isLoggedIn;
1213
+ }
1214
+ function Mo(e) {
1215
+ return P().isLoggedIn;
1216
+ }
1217
+ function $o() {
1218
+ return !0;
1219
+ }
1220
+ const Xe = [
1221
+ {
1222
+ path: "/login",
1223
+ name: "Login",
1224
+ component: () => Promise.resolve().then(() => Fs),
1225
+ meta: {
1226
+ title: "登录",
1227
+ hidden: !0
1228
+ }
1229
+ },
1230
+ {
1231
+ path: "/404",
1232
+ name: "NotFound",
1233
+ component: () => Promise.resolve().then(() => Ws),
1234
+ meta: {
1235
+ title: "404",
1236
+ hidden: !0
1237
+ }
1238
+ },
1239
+ {
1240
+ path: "/403",
1241
+ name: "Forbidden",
1242
+ component: () => Promise.resolve().then(() => Zs),
1243
+ meta: {
1244
+ title: "403",
1245
+ hidden: !0
1246
+ }
1247
+ }
1248
+ ], Je = {
1249
+ path: "/:pathMatch(.*)*",
1250
+ redirect: "/404",
1251
+ meta: {
1252
+ hidden: !0
1253
+ }
1254
+ }, Qe = {
1255
+ path: "/",
1256
+ name: "Layout",
1257
+ component: () => Promise.resolve().then(() => Ls),
1258
+ redirect: "/dashboard",
1259
+ children: [
1260
+ {
1261
+ path: "/dashboard",
1262
+ name: "Dashboard",
1263
+ component: () => import("./index-BO2Zf9u6.js"),
1264
+ meta: {
1265
+ title: "仪表盘",
1266
+ icon: "dashboard",
1267
+ keepAlive: !0,
1268
+ affix: !0
1269
+ }
1270
+ },
1271
+ {
1272
+ path: "/system/user",
1273
+ name: "SystemUser",
1274
+ component: () => import("./index-15Bu0M8D.js"),
1275
+ meta: {
1276
+ title: "用户管理",
1277
+ icon: "user",
1278
+ keepAlive: !0
1279
+ }
1280
+ },
1281
+ {
1282
+ path: "/system/role",
1283
+ name: "SystemRole",
1284
+ component: () => import("./index-DqQRSPeF.js"),
1285
+ meta: {
1286
+ title: "角色管理",
1287
+ icon: "role",
1288
+ keepAlive: !0
1289
+ }
1290
+ },
1291
+ {
1292
+ path: "/system/menu",
1293
+ name: "SystemMenu",
1294
+ component: () => import("./index-PRFGBLWt.js"),
1295
+ meta: {
1296
+ title: "菜单管理",
1297
+ icon: "menu",
1298
+ keepAlive: !0
1299
+ }
1300
+ }
1301
+ ]
1302
+ }, Ro = [
1303
+ {
1304
+ path: "/dashboard",
1305
+ name: "Dashboard",
1306
+ component: () => import("./index-BO2Zf9u6.js"),
1307
+ meta: {
1308
+ title: "仪表盘",
1309
+ icon: "dashboard",
1310
+ keepAlive: !0,
1311
+ affix: !0
1312
+ }
1313
+ },
1314
+ {
1315
+ path: "/system",
1316
+ name: "System",
1317
+ redirect: "/system/user",
1318
+ meta: {
1319
+ title: "系统管理",
1320
+ icon: "setting"
1321
+ },
1322
+ children: [
1323
+ {
1324
+ path: "user",
1325
+ name: "SystemUser",
1326
+ component: () => import("./index-15Bu0M8D.js"),
1327
+ meta: {
1328
+ title: "用户管理",
1329
+ icon: "user",
1330
+ keepAlive: !0
1331
+ }
1332
+ },
1333
+ {
1334
+ path: "role",
1335
+ name: "SystemRole",
1336
+ component: () => import("./index-DqQRSPeF.js"),
1337
+ meta: {
1338
+ title: "角色管理",
1339
+ icon: "role",
1340
+ keepAlive: !0
1341
+ }
1342
+ },
1343
+ {
1344
+ path: "menu",
1345
+ name: "SystemMenu",
1346
+ component: () => import("./index-PRFGBLWt.js"),
1347
+ meta: {
1348
+ title: "菜单管理",
1349
+ icon: "menu",
1350
+ keepAlive: !0
1351
+ }
1352
+ }
1353
+ ]
1354
+ }
1355
+ ], Gs = [
1356
+ {
1357
+ menuCode: "dashboard",
1358
+ menuName: "仪表盘",
1359
+ menuUrl: "/dashboard",
1360
+ icon: "dashboard",
1361
+ closable: !0,
1362
+ isDefault: !0,
1363
+ isOut: !1
1364
+ },
1365
+ {
1366
+ menuCode: "system",
1367
+ menuName: "系统管理",
1368
+ menuUrl: "/system",
1369
+ icon: "setting",
1370
+ closable: !1,
1371
+ isDefault: !1,
1372
+ isOut: !1,
1373
+ children: [
1374
+ {
1375
+ menuCode: "system_user",
1376
+ menuName: "用户管理",
1377
+ menuUrl: "/system/user",
1378
+ icon: "user",
1379
+ closable: !0,
1380
+ isDefault: !1,
1381
+ isOut: !1
1382
+ },
1383
+ {
1384
+ menuCode: "system_role",
1385
+ menuName: "角色管理",
1386
+ menuUrl: "/system/role",
1387
+ icon: "role",
1388
+ closable: !0,
1389
+ isDefault: !1,
1390
+ isOut: !1
1391
+ },
1392
+ {
1393
+ menuCode: "system_menu",
1394
+ menuName: "菜单管理",
1395
+ menuUrl: "/system/menu",
1396
+ icon: "menu",
1397
+ closable: !0,
1398
+ isDefault: !1,
1399
+ isOut: !1
1400
+ }
1401
+ ]
1402
+ }
1403
+ ], Ze = we({
1404
+ history: Ce(),
1405
+ routes: [...Xe, Qe, Je],
1406
+ scrollBehavior: () => ({ left: 0, top: 0 })
1407
+ }), eo = ["/login", "/404", "/403"];
1408
+ Ze.beforeEach(async (e, s, o) => {
1409
+ const a = H();
1410
+ if (a.initTheme(), We())
1411
+ if (e.path === "/login")
1412
+ o({ path: "/" });
1413
+ else {
1414
+ const n = P();
1415
+ n.isLoggedIn || (n.setUserInfo({
1416
+ appId: Ue(),
1417
+ userId: "1",
1418
+ userName: "管理员",
1419
+ departmentName: "技术部",
1420
+ email: "admin@example.com",
1421
+ mobilePhone: "13800138000",
1422
+ positionName: "管理员",
1423
+ avatar: ""
1424
+ }), ce().setMenuList(Gs)), e.name && e.meta.keepAlive && a.addCachedView(e.name), o();
1425
+ }
1426
+ else
1427
+ eo.includes(e.path) ? o() : o("/login");
1428
+ });
1429
+ function Do() {
1430
+ const e = we({
1431
+ history: Ce(),
1432
+ routes: [...Xe, Qe, Je]
1433
+ });
1434
+ Ze.matcher = e.matcher;
1435
+ }
1436
+ function Po(e, s = {}) {
1437
+ const o = s.indexPath || "/dashboard";
1438
+ return {
1439
+ path: "/",
1440
+ name: "Layout",
1441
+ component: He,
1442
+ redirect: o,
1443
+ children: e
1444
+ };
1445
+ }
1446
+ function Oo(e) {
1447
+ return we({
1448
+ history: Ce(),
1449
+ routes: e,
1450
+ scrollBehavior: () => ({ left: 0, top: 0 })
1451
+ });
1452
+ }
1453
+ function Ao(e) {
1454
+ return I.get("/role/list", { params: e });
1455
+ }
1456
+ function zo(e) {
1457
+ return I.get(`/role/${e}`);
1458
+ }
1459
+ function Vo(e) {
1460
+ return I.post("/role", e);
1461
+ }
1462
+ function Bo(e, s) {
1463
+ return I.put(`/role/${e}`, s);
1464
+ }
1465
+ function Fo(e) {
1466
+ return I.delete(`/role/${e}`);
1467
+ }
1468
+ function Ko(e, s) {
1469
+ return I.patch(`/role/${e}/status`, { status: s });
1470
+ }
1471
+ function jo() {
1472
+ return I.get("/user/v1.0/menu/list");
1473
+ }
1474
+ function to(e) {
1475
+ const s = e || Ue();
1476
+ return I.get(`/user/v1.0/menu/get-menu?appId=${s}`);
1477
+ }
1478
+ function Yo(e) {
1479
+ return I.post("/menu", e);
1480
+ }
1481
+ function qo(e, s) {
1482
+ return I.put(`/menu/${e}`, s);
1483
+ }
1484
+ function Wo(e) {
1485
+ return I.delete(`/menu/${e}`);
1486
+ }
1487
+ const so = ["/login", "/404", "/403"];
1488
+ function Ho(e, s = {}) {
1489
+ const o = s.whiteList || so, a = s.loginPath || "/login", n = s.homePath || "/";
1490
+ e.beforeEach(async (u, y, l) => {
1491
+ const v = H(), i = P(), m = ce();
1492
+ if (v.initTheme(), de())
1493
+ if (u.path === a)
1494
+ l({ path: n });
1495
+ else if (i.isLoggedIn)
1496
+ u.name && u.meta.keepAlive && v.addCachedView(u.name), l();
1497
+ else
1498
+ try {
1499
+ if (s.fetchUserInfo) {
1500
+ const f = await s.fetchUserInfo();
1501
+ i.setUserInfo(f);
1502
+ } else {
1503
+ const f = await Ps();
1504
+ i.setUserInfo(f);
1505
+ }
1506
+ if (s.fetchMenu) {
1507
+ const f = await s.fetchMenu();
1508
+ m.setMenuList(f);
1509
+ } else {
1510
+ const f = await to(s.appId);
1511
+ m.setMenuList(f);
1512
+ }
1513
+ s.onLoginSuccess && s.onLoginSuccess(), u.name && u.meta.keepAlive && v.addCachedView(u.name), l({ ...u, replace: !0 });
1514
+ } catch (f) {
1515
+ console.error("获取用户信息失败:", f), i.clearUserInfo(), m.clearMenu(), localStorage.removeItem("token"), localStorage.removeItem("token_type"), localStorage.removeItem("refresh_token"), l({ path: a, query: { redirect: u.fullPath } });
1516
+ }
1517
+ else
1518
+ o.includes(u.path) ? l() : l({ path: a, query: { redirect: u.fullPath } });
1519
+ }), e.afterEach(() => {
1520
+ });
1521
+ }
1522
+ function Xo(e) {
1523
+ return I.get("/user/list", { params: e });
1524
+ }
1525
+ function Jo(e) {
1526
+ return I.get(`/user/${e}`);
1527
+ }
1528
+ function Qo(e) {
1529
+ return I.post("/user", e);
1530
+ }
1531
+ function Zo(e, s) {
1532
+ return I.put(`/user/${e}`, s);
1533
+ }
1534
+ function Go(e) {
1535
+ return I.delete(`/user/${e}`);
1536
+ }
1537
+ function ea(e) {
1538
+ return I.post("/user/batch-delete", { ids: e });
1539
+ }
1540
+ function ta(e, s) {
1541
+ return I.patch(`/user/${e}/status`, { status: s });
1542
+ }
1543
+ function sa(e) {
1544
+ return I.post(`/user/${e}/reset-password`);
1545
+ }
1546
+ var oo = /* @__PURE__ */ ((e) => (e[e.ENABLED = 1] = "ENABLED", e[e.DISABLED = 0] = "DISABLED", e))(oo || {}), ao = /* @__PURE__ */ ((e) => (e[e.UNKNOWN = 0] = "UNKNOWN", e[e.MALE = 1] = "MALE", e[e.FEMALE = 2] = "FEMALE", e))(ao || {}), no = /* @__PURE__ */ ((e) => (e[e.DIRECTORY = 0] = "DIRECTORY", e[e.MENU = 1] = "MENU", e[e.BUTTON = 2] = "BUTTON", e))(no || {});
1547
+ const oa = {
1548
+ 1: "启用",
1549
+ 0: "禁用"
1550
+ }, aa = {
1551
+ 0: "未知",
1552
+ 1: "男",
1553
+ 2: "女"
1554
+ }, na = {
1555
+ 0: "目录",
1556
+ 1: "菜单",
1557
+ 2: "按钮"
1558
+ }, ra = [
1559
+ {
1560
+ label: "启用",
1561
+ value: 1
1562
+ /* ENABLED */
1563
+ },
1564
+ {
1565
+ label: "禁用",
1566
+ value: 0
1567
+ /* DISABLED */
1568
+ }
1569
+ ], la = [
1570
+ {
1571
+ label: "未知",
1572
+ value: 0
1573
+ /* UNKNOWN */
1574
+ },
1575
+ {
1576
+ label: "男",
1577
+ value: 1
1578
+ /* MALE */
1579
+ },
1580
+ {
1581
+ label: "女",
1582
+ value: 2
1583
+ /* FEMALE */
1584
+ }
1585
+ ], ia = [
1586
+ {
1587
+ label: "目录",
1588
+ value: 0
1589
+ /* DIRECTORY */
1590
+ },
1591
+ {
1592
+ label: "菜单",
1593
+ value: 1
1594
+ /* MENU */
1595
+ },
1596
+ {
1597
+ label: "按钮",
1598
+ value: 2
1599
+ /* BUTTON */
1600
+ }
1601
+ ], ua = {
1602
+ mounted(e, s) {
1603
+ var a;
1604
+ P().isLoggedIn || (a = e.parentNode) == null || a.removeChild(e);
1605
+ }
1606
+ };
1607
+ export {
1608
+ Lt as $,
1609
+ yo as A,
1610
+ jo as B,
1611
+ to as C,
1612
+ go as D,
1613
+ _o as E,
1614
+ ko as F,
1615
+ ao as G,
1616
+ bs as H,
1617
+ zo as I,
1618
+ Ao as J,
1619
+ de as K,
1620
+ He as L,
1621
+ no as M,
1622
+ wt as N,
1623
+ yt as O,
1624
+ Jo as P,
1625
+ Ps as Q,
1626
+ Xo as R,
1627
+ oo as S,
1628
+ bo as T,
1629
+ Uo as U,
1630
+ Mo as V,
1631
+ We as W,
1632
+ I as X,
1633
+ Io as Y,
1634
+ $o as Z,
1635
+ V as _,
1636
+ ra as a,
1637
+ Qe as a0,
1638
+ p as a1,
1639
+ se as a2,
1640
+ Ds as a3,
1641
+ wo as a4,
1642
+ Gs as a5,
1643
+ ua as a6,
1644
+ Co as a7,
1645
+ sa as a8,
1646
+ Do as a9,
1647
+ Ze as aa,
1648
+ fo as ab,
1649
+ oe as ac,
1650
+ St as ad,
1651
+ It as ae,
1652
+ kt as af,
1653
+ gt as ag,
1654
+ Ct as ah,
1655
+ Ye as ai,
1656
+ bt as aj,
1657
+ Ho as ak,
1658
+ Xe as al,
1659
+ qo as am,
1660
+ Bo as an,
1661
+ Ko as ao,
1662
+ Zo as ap,
1663
+ ta as aq,
1664
+ To as ar,
1665
+ H as as,
1666
+ Eo as at,
1667
+ Ne as au,
1668
+ xo as av,
1669
+ ce as aw,
1670
+ No as ax,
1671
+ P as ay,
1672
+ ia as b,
1673
+ Qs as c,
1674
+ la as d,
1675
+ aa as e,
1676
+ na as f,
1677
+ qs as g,
1678
+ $t as h,
1679
+ Bs as i,
1680
+ oa as j,
1681
+ Lo as k,
1682
+ ea as l,
1683
+ qe as m,
1684
+ Po as n,
1685
+ Yo as o,
1686
+ Vo as p,
1687
+ Oo as q,
1688
+ Qo as r,
1689
+ Ro as s,
1690
+ Wo as t,
1691
+ Fo as u,
1692
+ Go as v,
1693
+ Je as w,
1694
+ So as x,
1695
+ Ue as y,
1696
+ Os as z
1697
+ };