xto-fronted 0.4.1 → 0.4.3

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