xto-fronted 0.2.7 → 0.2.8

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,1457 @@
1
+ import { ref as p, computed as b, watch as $e, defineComponent as z, openBlock as v, createElementBlock as f, createElementVNode as n, withDirectives as Le, vShow as Ae, createVNode as $, unref as g, Fragment as B, renderList as W, toDisplayString as A, createCommentVNode as N, withCtx as E, createBlock as G, createTextVNode as F, onMounted as Ee, onUnmounted as Ie, normalizeClass as _e, withModifiers as ge, Transition as Re, resolveComponent as Me, normalizeStyle as Ue, reactive as re, withKeys as De } from "vue";
2
+ import { defineStore as ee } from "pinia";
3
+ import { createRouter as ae, createWebHistory as le, useRoute as ie, useRouter as j } from "vue-router";
4
+ import { Menu as Pe, SubMenu as Oe, MenuItem as fe, Tabs as Ve, TabPane as Ne } from "@xto/navigation";
5
+ import { Button as te } from "@xto/base";
6
+ import { Input as ne, Form as ze, FormItem as J, Checkbox as Be } from "@xto/form";
7
+ import { Message as D } from "@xto/feedback";
8
+ import Fe from "axios";
9
+ const K = "xto_", ye = (e) => ({
10
+ get(s) {
11
+ const t = e.getItem(K + s);
12
+ if (!t) return null;
13
+ try {
14
+ return JSON.parse(t);
15
+ } catch {
16
+ return t;
17
+ }
18
+ },
19
+ set(s, t) {
20
+ if (t == null) {
21
+ e.removeItem(K + s);
22
+ return;
23
+ }
24
+ const a = typeof t == "string" ? t : JSON.stringify(t);
25
+ e.setItem(K + s, a);
26
+ },
27
+ remove(s) {
28
+ e.removeItem(K + s);
29
+ },
30
+ clear() {
31
+ Object.keys(e).forEach((t) => {
32
+ t.startsWith(K) && e.removeItem(t);
33
+ });
34
+ }
35
+ }), Q = ye(window.localStorage), Z = ye(window.sessionStorage), m = {
36
+ get: Q.get,
37
+ set: Q.set,
38
+ remove: Q.remove,
39
+ clear: Q.clear
40
+ }, Cs = {
41
+ get: Z.get,
42
+ set: Z.set,
43
+ remove: Z.remove,
44
+ clear: Z.clear
45
+ }, se = ee("app", () => {
46
+ const e = p(m.get("appName") || "XTO App"), s = p(m.get("indexPath") || "/dashboard"), t = p(m.get("isDark") || !1), a = p(m.get("theme") || "light"), r = p(m.get("layout") || "sidebar"), c = p(m.get("isCollapsed") || !1), i = p(m.get("showTabs") ?? !0), o = p(m.get("showFooter") ?? !0), u = p(m.get("showBreadcrumb") ?? !0), d = p(m.get("primaryColor") || "#409eff"), y = p([]), x = b(() => t.value ? "dark" : "light"), l = (k) => {
47
+ e.value = k, m.set("appName", k);
48
+ }, C = (k) => {
49
+ s.value = k, m.set("indexPath", k);
50
+ }, I = () => {
51
+ t.value = !t.value, a.value = t.value ? "dark" : "light", L();
52
+ }, R = (k) => {
53
+ a.value = k, t.value = k === "dark", L();
54
+ }, L = () => {
55
+ const k = document.documentElement;
56
+ t.value ? k.classList.add("dark") : k.classList.remove("dark"), m.set("isDark", t.value), m.set("theme", a.value);
57
+ }, M = () => {
58
+ c.value = !c.value, m.set("isCollapsed", c.value);
59
+ }, H = (k) => {
60
+ r.value = k, m.set("layout", k);
61
+ }, U = () => {
62
+ i.value = !i.value, m.set("showTabs", i.value);
63
+ }, S = () => {
64
+ o.value = !o.value, m.set("showFooter", o.value);
65
+ }, T = () => {
66
+ u.value = !u.value, m.set("showBreadcrumb", u.value);
67
+ }, _ = (k) => {
68
+ d.value = k, document.documentElement.style.setProperty("--color-primary", k), m.set("primaryColor", k);
69
+ }, h = (k) => {
70
+ y.value.includes(k) || y.value.push(k);
71
+ }, X = (k) => {
72
+ const ve = y.value.indexOf(k);
73
+ ve > -1 && y.value.splice(ve, 1);
74
+ }, V = () => {
75
+ y.value = [];
76
+ }, Y = () => {
77
+ L(), d.value !== "#409eff" && document.documentElement.style.setProperty("--color-primary", d.value);
78
+ };
79
+ return $e(t, L), {
80
+ appName: e,
81
+ indexPath: s,
82
+ isDark: t,
83
+ theme: a,
84
+ layout: r,
85
+ isCollapsed: c,
86
+ showTabs: i,
87
+ showFooter: o,
88
+ showBreadcrumb: u,
89
+ primaryColor: d,
90
+ cachedViews: y,
91
+ themeClass: x,
92
+ setAppName: l,
93
+ setIndexPath: C,
94
+ toggleTheme: I,
95
+ toggleCollapse: M,
96
+ setTheme: R,
97
+ setLayout: H,
98
+ toggleTabs: U,
99
+ toggleFooter: S,
100
+ toggleBreadcrumb: T,
101
+ setPrimaryColor: _,
102
+ addCachedView: h,
103
+ removeCachedView: X,
104
+ clearCachedViews: V,
105
+ initTheme: Y
106
+ };
107
+ }), ke = "/vite.svg", je = (e, s, t) => {
108
+ const a = e[s];
109
+ return a ? typeof a == "function" ? a() : Promise.resolve(a) : new Promise((r, c) => {
110
+ (typeof queueMicrotask == "function" ? queueMicrotask : setTimeout)(
111
+ c.bind(
112
+ null,
113
+ new Error(
114
+ "Unknown variable dynamic import: " + s + (s.split("/").length !== t ? ". Note that variables only represent file names one level deep." : "")
115
+ )
116
+ )
117
+ );
118
+ });
119
+ }, be = [
120
+ {
121
+ path: "/login",
122
+ name: "Login",
123
+ component: () => Promise.resolve().then(() => ts),
124
+ meta: {
125
+ title: "登录",
126
+ hidden: !0
127
+ }
128
+ },
129
+ {
130
+ path: "/404",
131
+ name: "NotFound",
132
+ component: () => Promise.resolve().then(() => as),
133
+ meta: {
134
+ title: "404",
135
+ hidden: !0
136
+ }
137
+ },
138
+ {
139
+ path: "/403",
140
+ name: "Forbidden",
141
+ component: () => Promise.resolve().then(() => ds),
142
+ meta: {
143
+ title: "403",
144
+ hidden: !0
145
+ }
146
+ }
147
+ ], we = {
148
+ path: "/:pathMatch(.*)*",
149
+ redirect: "/404",
150
+ meta: {
151
+ hidden: !0
152
+ }
153
+ }, Se = {
154
+ path: "/",
155
+ name: "Layout",
156
+ component: () => Promise.resolve().then(() => jt),
157
+ redirect: "/dashboard",
158
+ children: [
159
+ {
160
+ path: "/dashboard",
161
+ name: "Dashboard",
162
+ component: () => import("./index-p3TbK44c.js"),
163
+ meta: {
164
+ title: "仪表盘",
165
+ icon: "dashboard",
166
+ keepAlive: !0,
167
+ affix: !0
168
+ }
169
+ },
170
+ {
171
+ path: "/system/user",
172
+ name: "SystemUser",
173
+ component: () => import("./index-CvDxK7Ab.js"),
174
+ meta: {
175
+ title: "用户管理",
176
+ icon: "user",
177
+ keepAlive: !0
178
+ }
179
+ },
180
+ {
181
+ path: "/system/role",
182
+ name: "SystemRole",
183
+ component: () => import("./index-B3PLzNB0.js"),
184
+ meta: {
185
+ title: "角色管理",
186
+ icon: "role",
187
+ keepAlive: !0
188
+ }
189
+ },
190
+ {
191
+ path: "/system/menu",
192
+ name: "SystemMenu",
193
+ component: () => import("./index-ZAJgA3XD.js"),
194
+ meta: {
195
+ title: "菜单管理",
196
+ icon: "menu",
197
+ keepAlive: !0
198
+ }
199
+ }
200
+ ]
201
+ }, Ts = [
202
+ {
203
+ path: "/dashboard",
204
+ name: "Dashboard",
205
+ component: () => import("./index-p3TbK44c.js"),
206
+ meta: {
207
+ title: "仪表盘",
208
+ icon: "dashboard",
209
+ keepAlive: !0,
210
+ affix: !0
211
+ }
212
+ },
213
+ {
214
+ path: "/system",
215
+ name: "System",
216
+ redirect: "/system/user",
217
+ meta: {
218
+ title: "系统管理",
219
+ icon: "setting"
220
+ },
221
+ children: [
222
+ {
223
+ path: "user",
224
+ name: "SystemUser",
225
+ component: () => import("./index-CvDxK7Ab.js"),
226
+ meta: {
227
+ title: "用户管理",
228
+ icon: "user",
229
+ keepAlive: !0
230
+ }
231
+ },
232
+ {
233
+ path: "role",
234
+ name: "SystemRole",
235
+ component: () => import("./index-B3PLzNB0.js"),
236
+ meta: {
237
+ title: "角色管理",
238
+ icon: "role",
239
+ keepAlive: !0
240
+ }
241
+ },
242
+ {
243
+ path: "menu",
244
+ name: "SystemMenu",
245
+ component: () => import("./index-ZAJgA3XD.js"),
246
+ meta: {
247
+ title: "菜单管理",
248
+ icon: "menu",
249
+ keepAlive: !0
250
+ }
251
+ }
252
+ ]
253
+ }
254
+ ], He = [
255
+ {
256
+ id: 1,
257
+ name: "Dashboard",
258
+ path: "/dashboard",
259
+ component: "dashboard/index",
260
+ icon: "dashboard",
261
+ title: "仪表盘",
262
+ keepAlive: !0,
263
+ affix: !0
264
+ },
265
+ {
266
+ id: 2,
267
+ name: "System",
268
+ path: "/system",
269
+ redirect: "/system/user",
270
+ icon: "setting",
271
+ title: "系统管理",
272
+ children: [
273
+ {
274
+ id: 21,
275
+ name: "SystemUser",
276
+ path: "/system/user",
277
+ component: "system/user/index",
278
+ icon: "user",
279
+ title: "用户管理",
280
+ keepAlive: !0
281
+ },
282
+ {
283
+ id: 22,
284
+ name: "SystemRole",
285
+ path: "/system/role",
286
+ component: "system/role/index",
287
+ icon: "role",
288
+ title: "角色管理",
289
+ keepAlive: !0
290
+ },
291
+ {
292
+ id: 23,
293
+ name: "SystemMenu",
294
+ path: "/system/menu",
295
+ component: "system/menu/index",
296
+ icon: "menu",
297
+ title: "菜单管理",
298
+ keepAlive: !0
299
+ }
300
+ ]
301
+ }
302
+ ], ce = "token", ue = "refresh_token", de = "token_expire", me = () => m.get(ce), Ke = (e) => {
303
+ m.set(ce, e);
304
+ }, $s = () => m.get(ue), qe = (e) => {
305
+ m.set(ue, e);
306
+ }, We = () => m.get(de), Xe = (e) => {
307
+ m.set(de, e);
308
+ }, Ye = (e) => {
309
+ Ke(e.token), qe(e.refreshToken), Xe(e.expireTime);
310
+ }, xe = () => {
311
+ m.remove(ce), m.remove(ue), m.remove(de);
312
+ }, Je = () => {
313
+ const e = We();
314
+ return e ? Date.now() > e : !0;
315
+ }, Ce = () => !!me() && !Je(), P = ee("user", () => {
316
+ const e = p(m.get("userInfo")), s = p(m.get("roles") || []), t = p(m.get("permissions") || []), a = b(() => !!e.value), r = b(() => {
317
+ var l;
318
+ return ((l = e.value) == null ? void 0 : l.username) || "";
319
+ }), c = b(() => {
320
+ var l;
321
+ return ((l = e.value) == null ? void 0 : l.nickname) || "";
322
+ }), i = b(() => {
323
+ var l;
324
+ return ((l = e.value) == null ? void 0 : l.avatar) || "";
325
+ }), o = b(() => {
326
+ var l;
327
+ return (l = e.value) == null ? void 0 : l.id;
328
+ });
329
+ return {
330
+ userInfo: e,
331
+ roles: s,
332
+ permissions: t,
333
+ isLoggedIn: a,
334
+ username: r,
335
+ nickname: c,
336
+ avatar: i,
337
+ userId: o,
338
+ setUserInfo: (l) => {
339
+ e.value = l, s.value = l.roles || [], t.value = l.permissions || [], m.set("userInfo", l), m.set("roles", l.roles || []), m.set("permissions", l.permissions || []);
340
+ },
341
+ clearUserInfo: () => {
342
+ e.value = null, s.value = [], t.value = [], m.remove("userInfo"), m.remove("roles"), m.remove("permissions");
343
+ },
344
+ hasPermission: (l) => Array.isArray(l) ? l.some((C) => t.value.includes(C)) : t.value.includes(l),
345
+ hasRole: (l) => Array.isArray(l) ? l.some((C) => s.value.includes(C)) : s.value.includes(l)
346
+ };
347
+ }), pe = ae({
348
+ history: le(),
349
+ routes: [...be, Se, we],
350
+ scrollBehavior: () => ({ left: 0, top: 0 })
351
+ }), Qe = ["/login", "/404", "/403"];
352
+ pe.beforeEach(async (e, s, t) => {
353
+ const a = se();
354
+ if (a.initTheme(), Ce())
355
+ if (e.path === "/login")
356
+ t({ path: "/" });
357
+ else {
358
+ const r = P();
359
+ r.isLoggedIn || (r.setUserInfo({
360
+ id: 1,
361
+ username: "admin",
362
+ nickname: "管理员",
363
+ avatar: "",
364
+ email: "admin@example.com",
365
+ phone: "13800138000",
366
+ status: 1,
367
+ roles: ["admin"],
368
+ permissions: ["*"],
369
+ createTime: (/* @__PURE__ */ new Date()).toISOString()
370
+ }), oe().setMenuList(He)), e.name && e.meta.keepAlive && a.addCachedView(e.name), t();
371
+ }
372
+ else
373
+ Qe.includes(e.path) ? t() : t("/login");
374
+ });
375
+ function Ls() {
376
+ const e = ae({
377
+ history: le(),
378
+ routes: [...be, Se, we]
379
+ });
380
+ pe.matcher = e.matcher;
381
+ }
382
+ const oe = ee("menu", () => {
383
+ const e = p(m.get("menuList") || []), s = b(() => e.value.length > 0), t = (i) => {
384
+ e.value = i, m.set("menuList", i);
385
+ }, a = () => {
386
+ e.value = [], m.remove("menuList");
387
+ }, r = (i) => i.filter((o) => !o.hidden).map((o) => {
388
+ const u = {
389
+ path: o.path,
390
+ name: o.name,
391
+ meta: {
392
+ title: o.title,
393
+ icon: o.icon,
394
+ keepAlive: o.keepAlive,
395
+ hidden: o.hidden
396
+ }
397
+ };
398
+ return o.redirect && (u.redirect = o.redirect), o.component && (u.component = () => je(/* @__PURE__ */ Object.assign({}), `../views/${o.component}.vue`, 3)), o.children && o.children.length > 0 && (u.children = r(o.children)), u;
399
+ });
400
+ return {
401
+ menuList: e,
402
+ hasMenu: s,
403
+ setMenuList: t,
404
+ clearMenu: a,
405
+ generateRoutes: r,
406
+ addRoutes: (i) => {
407
+ r(i).forEach((u) => {
408
+ pe.addRoute("Layout", u);
409
+ });
410
+ }
411
+ };
412
+ }), he = ee("auth", () => {
413
+ const e = p(me()), s = b(() => Ce()), t = p(""), a = p(""), r = p(""), c = p("/login");
414
+ return {
415
+ token: e,
416
+ isLoggedIn: s,
417
+ baseUrl: t,
418
+ appId: a,
419
+ clientId: r,
420
+ loginPath: c,
421
+ login: (l) => {
422
+ e.value = l.token, Ye(l);
423
+ },
424
+ logout: () => {
425
+ e.value = null, xe();
426
+ },
427
+ setBaseUrl: (l) => {
428
+ t.value = l;
429
+ },
430
+ setAppId: (l) => {
431
+ a.value = l;
432
+ },
433
+ setClientId: (l) => {
434
+ r.value = l;
435
+ },
436
+ setLoginPath: (l) => {
437
+ c.value = l;
438
+ }
439
+ };
440
+ }), Ze = { class: "sidebar" }, Ge = { class: "sidebar__logo" }, et = { class: "sidebar__logo-text" }, tt = {
441
+ key: 0,
442
+ class: "sidebar__search"
443
+ }, st = {
444
+ key: 0,
445
+ class: "sidebar__search-results"
446
+ }, ot = ["onClick"], nt = { class: "menu-icon" }, rt = { class: "sidebar__search-item-info" }, at = { class: "sidebar__search-item-title" }, lt = {
447
+ key: 0,
448
+ class: "sidebar__search-item-parent"
449
+ }, it = { class: "menu-icon" }, ct = { class: "menu-icon" }, ut = { class: "menu-icon" }, dt = {
450
+ key: 1,
451
+ class: "sidebar__user"
452
+ }, mt = { class: "sidebar__user-info" }, pt = { class: "sidebar__user-name" }, ht = { class: "sidebar__user-role" }, vt = /* @__PURE__ */ z({
453
+ __name: "Sidebar",
454
+ setup(e) {
455
+ const s = ie(), t = j(), a = oe(), r = P(), c = he(), i = se(), o = p(""), u = b(() => i.isCollapsed), d = b(() => s.path), y = b(() => i.isDark ? "#1d1e1f" : "#fff"), x = b(() => i.isDark ? "#cfd3dc" : "#303133"), l = b(() => "#409eff"), C = (S, T = "") => {
456
+ const _ = [];
457
+ return S.forEach((h) => {
458
+ h.children && h.children.length > 0 ? _.push(...C(h.children, h.title)) : _.push({ ...h, parentTitle: T });
459
+ }), _;
460
+ }, I = b(() => o.value.trim() ? C(a.menuList).filter(
461
+ (T) => T.title.toLowerCase().includes(o.value.toLowerCase())
462
+ ) : []), R = b(() => o.value.trim() ? a.menuList.map((S) => {
463
+ if (S.children && S.children.length > 0) {
464
+ const T = S.children.filter(
465
+ (_) => _.title.toLowerCase().includes(o.value.toLowerCase())
466
+ );
467
+ return T.length > 0 ? { ...S, children: T } : null;
468
+ }
469
+ return S.title.toLowerCase().includes(o.value.toLowerCase()) ? S : null;
470
+ }).filter(Boolean) : a.menuList), L = (S) => {
471
+ S && S !== s.path && (t.push(S), o.value = "");
472
+ }, M = (S) => {
473
+ t.push(S), o.value = "";
474
+ }, H = () => {
475
+ c.logout(), r.clearUserInfo(), a.clearMenu(), t.push("/login");
476
+ }, U = (S) => ({
477
+ dashboard: "📊",
478
+ system: "⚙️",
479
+ user: "👤",
480
+ role: "👥",
481
+ menu: "📋",
482
+ setting: "🔧"
483
+ })[S || ""] || "📄";
484
+ return (S, T) => (v(), f("div", Ze, [
485
+ n("div", Ge, [
486
+ T[1] || (T[1] = n("img", {
487
+ src: ke,
488
+ alt: "Logo",
489
+ class: "sidebar__logo-img"
490
+ }, null, -1)),
491
+ Le(n("span", et, "Xto Demo", 512), [
492
+ [Ae, !u.value]
493
+ ])
494
+ ]),
495
+ u.value ? N("", !0) : (v(), f("div", tt, [
496
+ $(g(ne), {
497
+ modelValue: o.value,
498
+ "onUpdate:modelValue": T[0] || (T[0] = (_) => o.value = _),
499
+ placeholder: "搜索菜单...",
500
+ size: "small",
501
+ clearable: ""
502
+ }, null, 8, ["modelValue"]),
503
+ I.value.length > 0 ? (v(), f("div", st, [
504
+ (v(!0), f(B, null, W(I.value, (_) => (v(), f("div", {
505
+ key: _.path,
506
+ class: "sidebar__search-item",
507
+ onClick: (h) => M(_.path)
508
+ }, [
509
+ n("span", nt, A(U(_.icon)), 1),
510
+ n("div", rt, [
511
+ n("span", at, A(_.title), 1),
512
+ _.parentTitle ? (v(), f("span", lt, A(_.parentTitle), 1)) : N("", !0)
513
+ ])
514
+ ], 8, ot))), 128))
515
+ ])) : N("", !0)
516
+ ])),
517
+ $(g(Pe), {
518
+ "default-active": d.value,
519
+ collapse: u.value,
520
+ "collapse-transition": !1,
521
+ "background-color": y.value,
522
+ "text-color": x.value,
523
+ "active-text-color": l.value,
524
+ class: "sidebar__menu",
525
+ onSelect: L
526
+ }, {
527
+ default: E(() => [
528
+ (v(!0), f(B, null, W(R.value, (_) => (v(), f(B, {
529
+ key: _.path
530
+ }, [
531
+ _.children && _.children.length > 0 ? (v(), G(g(Oe), {
532
+ key: 0,
533
+ index: _.path
534
+ }, {
535
+ title: E(() => [
536
+ n("span", it, A(U(_.icon)), 1),
537
+ n("span", null, A(_.title), 1)
538
+ ]),
539
+ default: E(() => [
540
+ (v(!0), f(B, null, W(_.children, (h) => (v(), G(g(fe), {
541
+ key: h.path,
542
+ index: h.path
543
+ }, {
544
+ default: E(() => [
545
+ n("span", ct, A(U(h.icon)), 1),
546
+ n("span", null, A(h.title), 1)
547
+ ]),
548
+ _: 2
549
+ }, 1032, ["index"]))), 128))
550
+ ]),
551
+ _: 2
552
+ }, 1032, ["index"])) : (v(), G(g(fe), {
553
+ key: 1,
554
+ index: _.path
555
+ }, {
556
+ default: E(() => [
557
+ n("span", ut, A(U(_.icon)), 1),
558
+ n("span", null, A(_.title), 1)
559
+ ]),
560
+ _: 2
561
+ }, 1032, ["index"]))
562
+ ], 64))), 128))
563
+ ]),
564
+ _: 1
565
+ }, 8, ["default-active", "collapse", "background-color", "text-color", "active-text-color"]),
566
+ u.value ? N("", !0) : (v(), f("div", dt, [
567
+ n("div", mt, [
568
+ n("span", pt, A(g(r).nickname), 1),
569
+ n("span", ht, A(g(r).roles.join(", ")), 1)
570
+ ]),
571
+ $(g(te), {
572
+ type: "text",
573
+ size: "small",
574
+ onClick: H
575
+ }, {
576
+ default: E(() => [...T[2] || (T[2] = [
577
+ F("退出", -1)
578
+ ])]),
579
+ _: 1
580
+ })
581
+ ]))
582
+ ]));
583
+ }
584
+ }), O = (e, s) => {
585
+ const t = e.__vccOpts || e;
586
+ for (const [a, r] of s)
587
+ t[a] = r;
588
+ return t;
589
+ }, _t = /* @__PURE__ */ O(vt, [["__scopeId", "data-v-1d224580"]]), ft = { class: "header" }, gt = { class: "header__left" }, yt = { key: 0 }, kt = { key: 1 }, bt = { class: "header__breadcrumb" }, wt = { key: 0 }, St = { class: "header__right" }, xt = ["title"], Ct = {
590
+ key: 0,
591
+ viewBox: "0 0 24 24",
592
+ width: "16",
593
+ height: "16",
594
+ fill: "currentColor"
595
+ }, Tt = {
596
+ key: 1,
597
+ viewBox: "0 0 24 24",
598
+ width: "16",
599
+ height: "16",
600
+ fill: "currentColor"
601
+ }, $t = { key: 0 }, Lt = { key: 1 }, At = { class: "header__avatar" }, Et = { class: "header__user-name" }, It = {
602
+ key: 0,
603
+ class: "header__dropdown"
604
+ }, Rt = { class: "header__dropdown-header" }, Mt = { class: "header__dropdown-avatar" }, Ut = { class: "header__dropdown-info" }, Dt = { class: "header__dropdown-name" }, Pt = { class: "header__dropdown-role" }, Ot = /* @__PURE__ */ z({
605
+ __name: "Header",
606
+ setup(e) {
607
+ const s = ie(), t = j(), a = se(), r = P(), c = he(), i = oe(), o = b(() => a.isCollapsed), u = p(!1), d = p(null), y = p(!1), x = b(() => s.matched.filter((h) => h.meta && h.meta.title).map((h) => ({
608
+ title: h.meta.title,
609
+ path: h.path
610
+ }))), l = () => {
611
+ a.toggleCollapse();
612
+ }, C = () => {
613
+ a.toggleTheme();
614
+ }, I = () => {
615
+ document.fullscreenElement ? document.exitFullscreen() : document.documentElement.requestFullscreen();
616
+ }, R = () => {
617
+ y.value = !!document.fullscreenElement;
618
+ }, L = () => {
619
+ u.value = !u.value;
620
+ }, M = () => {
621
+ u.value = !1;
622
+ }, H = () => {
623
+ M(), alert("个人信息功能开发中...");
624
+ }, U = () => {
625
+ M(), alert("修改密码功能开发中...");
626
+ }, S = () => {
627
+ M(), c.logout(), r.clearUserInfo(), i.clearMenu(), t.push("/login");
628
+ }, T = (_) => {
629
+ d.value && !d.value.contains(_.target) && M();
630
+ };
631
+ return Ee(() => {
632
+ document.addEventListener("click", T), document.addEventListener("fullscreenchange", R);
633
+ }), Ie(() => {
634
+ document.removeEventListener("click", T), document.removeEventListener("fullscreenchange", R);
635
+ }), (_, h) => {
636
+ var X;
637
+ return v(), f("div", ft, [
638
+ n("div", gt, [
639
+ n("div", {
640
+ class: "header__collapse",
641
+ onClick: l
642
+ }, [
643
+ o.value ? (v(), f("span", yt, "☰")) : (v(), f("span", kt, "☰"))
644
+ ]),
645
+ n("div", bt, [
646
+ (v(!0), f(B, null, W(x.value, (V, Y) => (v(), f("span", {
647
+ key: V.path
648
+ }, [
649
+ Y > 0 ? (v(), f("span", wt, " / ")) : N("", !0),
650
+ n("span", {
651
+ class: _e({ "is-current": Y === x.value.length - 1 })
652
+ }, A(V.title), 3)
653
+ ]))), 128))
654
+ ])
655
+ ]),
656
+ n("div", St, [
657
+ n("div", {
658
+ class: "header__action",
659
+ onClick: I,
660
+ title: y.value ? "Exit Fullscreen" : "Fullscreen"
661
+ }, [
662
+ y.value ? (v(), f("svg", Ct, [...h[0] || (h[0] = [
663
+ n("path", { d: "M5 16h3v3h2v-5H5v2zm3-8H5v2h5V5H8v3zm6 11h2v-3h3v-2h-5v5zm2-11V5h-2v5h5V8h-3z" }, null, -1)
664
+ ])])) : (v(), f("svg", Tt, [...h[1] || (h[1] = [
665
+ n("path", { d: "M7 14H5v5h5v-2H7v-3zm-2-4h2V7h3V5H5v5zm12 7h-3v2h5v-5h-2v3zM14 5v2h3v3h2V5h-5z" }, null, -1)
666
+ ])]))
667
+ ], 8, xt),
668
+ n("div", {
669
+ class: "header__action",
670
+ onClick: C,
671
+ title: "切换主题"
672
+ }, [
673
+ g(a).isDark ? (v(), f("span", $t, "🌙")) : (v(), f("span", Lt, "☀️"))
674
+ ]),
675
+ n("div", {
676
+ class: "header__user",
677
+ ref_key: "dropdownRef",
678
+ ref: d
679
+ }, [
680
+ n("div", {
681
+ class: "header__user-trigger",
682
+ onClick: ge(L, ["stop"])
683
+ }, [
684
+ n("div", At, [
685
+ n("span", null, A(((X = g(r).nickname) == null ? void 0 : X.charAt(0)) || "U"), 1)
686
+ ]),
687
+ n("span", Et, A(g(r).nickname), 1),
688
+ n("span", {
689
+ class: _e(["header__user-arrow", { "is-active": u.value }])
690
+ }, "▼", 2)
691
+ ]),
692
+ $(Re, { name: "dropdown" }, {
693
+ default: E(() => {
694
+ var V;
695
+ return [
696
+ u.value ? (v(), f("div", It, [
697
+ n("div", Rt, [
698
+ n("div", Mt, [
699
+ n("span", null, A(((V = g(r).nickname) == null ? void 0 : V.charAt(0)) || "U"), 1)
700
+ ]),
701
+ n("div", Ut, [
702
+ n("div", Dt, A(g(r).nickname), 1),
703
+ n("div", Pt, A(g(r).roles.join(", ")), 1)
704
+ ])
705
+ ]),
706
+ h[6] || (h[6] = n("div", { class: "header__dropdown-divider" }, null, -1)),
707
+ n("div", { class: "header__dropdown-menu" }, [
708
+ n("div", {
709
+ class: "header__dropdown-item",
710
+ onClick: H
711
+ }, [...h[2] || (h[2] = [
712
+ n("span", { class: "header__dropdown-icon" }, "👤", -1),
713
+ n("span", null, "个人信息", -1)
714
+ ])]),
715
+ n("div", {
716
+ class: "header__dropdown-item",
717
+ onClick: U
718
+ }, [...h[3] || (h[3] = [
719
+ n("span", { class: "header__dropdown-icon" }, "🔐", -1),
720
+ n("span", null, "修改密码", -1)
721
+ ])]),
722
+ h[5] || (h[5] = n("div", { class: "header__dropdown-divider" }, null, -1)),
723
+ n("div", {
724
+ class: "header__dropdown-item header__dropdown-item--danger",
725
+ onClick: S
726
+ }, [...h[4] || (h[4] = [
727
+ n("span", { class: "header__dropdown-icon" }, "🚪", -1),
728
+ n("span", null, "退出登录", -1)
729
+ ])])
730
+ ])
731
+ ])) : N("", !0)
732
+ ];
733
+ }),
734
+ _: 1
735
+ })
736
+ ], 512)
737
+ ])
738
+ ]);
739
+ };
740
+ }
741
+ }), Vt = /* @__PURE__ */ O(Ot, [["__scopeId", "data-v-7af82b67"]]), Nt = { class: "layout" }, zt = { class: "layout__main" }, Bt = { class: "layout__content" }, Ft = /* @__PURE__ */ z({
742
+ __name: "index",
743
+ setup(e) {
744
+ const s = se(), t = b(
745
+ () => s.isCollapsed ? "64px" : "210px"
746
+ );
747
+ return (a, r) => {
748
+ const c = Me("router-view");
749
+ return v(), f("div", Nt, [
750
+ n("aside", {
751
+ class: "layout__aside",
752
+ style: Ue({ width: t.value })
753
+ }, [
754
+ $(_t)
755
+ ], 4),
756
+ n("div", zt, [
757
+ $(Vt, { class: "layout__header" }),
758
+ n("main", Bt, [
759
+ $(c)
760
+ ])
761
+ ])
762
+ ]);
763
+ };
764
+ }
765
+ }), Te = /* @__PURE__ */ O(Ft, [["__scopeId", "data-v-0bcf8553"]]), jt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
766
+ __proto__: null,
767
+ default: Te
768
+ }, Symbol.toStringTag, { value: "Module" })), Ht = { class: "tabs-wrapper" }, Kt = { class: "tab-label" }, qt = ["onClick"], Wt = /* @__PURE__ */ z({
769
+ __name: "Tabs",
770
+ setup(e) {
771
+ const s = ie(), t = j(), a = b(() => {
772
+ const o = [];
773
+ return s.matched.forEach((u) => {
774
+ var d;
775
+ (d = u.meta) != null && d.affix && o.push({
776
+ name: u.name,
777
+ title: u.meta.title,
778
+ path: u.path,
779
+ affix: !0
780
+ });
781
+ }), o;
782
+ }), r = b(() => s.path), c = (o) => {
783
+ t.push(o);
784
+ }, i = (o) => {
785
+ const u = a.value.find((d) => d.path === o);
786
+ if (!(u != null && u.affix) && o === r.value) {
787
+ const d = a.value.findIndex((x) => x.path === o), y = a.value[d - 1] || a.value[d + 1];
788
+ y && t.push(y.path);
789
+ }
790
+ };
791
+ return (o, u) => (v(), f("div", Ht, [
792
+ $(g(Ve), {
793
+ modelValue: r.value,
794
+ "onUpdate:modelValue": u[0] || (u[0] = (d) => r.value = d),
795
+ type: "card",
796
+ onTabClick: c
797
+ }, {
798
+ default: E(() => [
799
+ (v(!0), f(B, null, W(a.value, (d) => (v(), G(g(Ne), {
800
+ key: d.path,
801
+ name: d.path,
802
+ label: d.title,
803
+ closable: !d.affix
804
+ }, {
805
+ label: E(() => [
806
+ n("span", Kt, [
807
+ F(A(d.title) + " ", 1),
808
+ d.affix ? N("", !0) : (v(), f("span", {
809
+ key: 0,
810
+ class: "tab-close",
811
+ onClick: ge((y) => i(d.path), ["stop"])
812
+ }, " ✕ ", 8, qt))
813
+ ])
814
+ ]),
815
+ _: 2
816
+ }, 1032, ["name", "label", "closable"]))), 128))
817
+ ]),
818
+ _: 1
819
+ }, 8, ["modelValue"])
820
+ ]));
821
+ }
822
+ }), As = /* @__PURE__ */ O(Wt, [["__scopeId", "data-v-9156d8cd"]]), Xt = {}, Yt = { class: "footer" };
823
+ function Jt(e, s) {
824
+ return v(), f("div", Yt, [...s[0] || (s[0] = [
825
+ n("span", null, "Copyright © 2024 Xto Demo. All Rights Reserved.", -1)
826
+ ])]);
827
+ }
828
+ const Es = /* @__PURE__ */ O(Xt, [["render", Jt], ["__scopeId", "data-v-4852826a"]]), Qt = { class: "login" }, Zt = { class: "login__container" }, Gt = /* @__PURE__ */ z({
829
+ __name: "index",
830
+ setup(e) {
831
+ const s = j(), t = he(), a = P(), r = oe(), c = p(!1), i = p(!1), o = re({
832
+ username: "admin",
833
+ password: "123456"
834
+ }), u = {
835
+ username: [
836
+ { required: !0, message: "请输入用户名", trigger: "blur" }
837
+ ],
838
+ password: [
839
+ { required: !0, message: "请输入密码", trigger: "blur" },
840
+ { min: 6, message: "密码长度至少6位", trigger: "blur" }
841
+ ]
842
+ }, d = p(), y = async () => {
843
+ var x;
844
+ try {
845
+ await ((x = d.value) == null ? void 0 : x.validate()), c.value = !0, setTimeout(() => {
846
+ t.login({
847
+ token: "mock_token_" + Date.now(),
848
+ refreshToken: "mock_refresh_token",
849
+ expireTime: Date.now() + 7 * 24 * 60 * 60 * 1e3
850
+ }), a.setUserInfo({
851
+ id: 1,
852
+ username: o.username,
853
+ nickname: "管理员",
854
+ avatar: "",
855
+ email: "admin@example.com",
856
+ phone: "13800138000",
857
+ status: 1,
858
+ roles: ["admin"],
859
+ permissions: ["*"],
860
+ createTime: (/* @__PURE__ */ new Date()).toISOString()
861
+ }), r.setMenuList([
862
+ {
863
+ id: 1,
864
+ name: "Dashboard",
865
+ path: "/dashboard",
866
+ component: "dashboard/index",
867
+ icon: "dashboard",
868
+ title: "仪表盘",
869
+ keepAlive: !0,
870
+ affix: !0
871
+ },
872
+ {
873
+ id: 2,
874
+ name: "System",
875
+ path: "/system",
876
+ redirect: "/system/user",
877
+ icon: "setting",
878
+ title: "系统管理",
879
+ children: [
880
+ {
881
+ id: 21,
882
+ name: "SystemUser",
883
+ path: "/system/user",
884
+ component: "system/user/index",
885
+ icon: "user",
886
+ title: "用户管理",
887
+ keepAlive: !0
888
+ },
889
+ {
890
+ id: 22,
891
+ name: "SystemRole",
892
+ path: "/system/role",
893
+ component: "system/role/index",
894
+ icon: "role",
895
+ title: "角色管理",
896
+ keepAlive: !0
897
+ },
898
+ {
899
+ id: 23,
900
+ name: "SystemMenu",
901
+ path: "/system/menu",
902
+ component: "system/menu/index",
903
+ icon: "menu",
904
+ title: "菜单管理",
905
+ keepAlive: !0
906
+ }
907
+ ]
908
+ }
909
+ ]), D.success("登录成功"), s.push("/"), c.value = !1;
910
+ }, 1e3);
911
+ } catch {
912
+ c.value = !1;
913
+ }
914
+ };
915
+ return (x, l) => (v(), f("div", Qt, [
916
+ n("div", Zt, [
917
+ l[5] || (l[5] = n("div", { class: "login__header" }, [
918
+ n("img", {
919
+ src: ke,
920
+ alt: "Logo",
921
+ class: "login__logo"
922
+ }),
923
+ n("h1", { class: "login__title" }, "Xto Demo"),
924
+ n("p", { class: "login__subtitle" }, "后台管理系统")
925
+ ], -1)),
926
+ $(g(ze), {
927
+ ref_key: "formRef",
928
+ ref: d,
929
+ model: o,
930
+ rules: u,
931
+ class: "login__form",
932
+ "label-width": "0"
933
+ }, {
934
+ default: E(() => [
935
+ $(g(J), { prop: "username" }, {
936
+ default: E(() => [
937
+ $(g(ne), {
938
+ modelValue: o.username,
939
+ "onUpdate:modelValue": l[0] || (l[0] = (C) => o.username = C),
940
+ placeholder: "用户名",
941
+ "prefix-icon": "👤",
942
+ size: "large"
943
+ }, null, 8, ["modelValue"])
944
+ ]),
945
+ _: 1
946
+ }),
947
+ $(g(J), { prop: "password" }, {
948
+ default: E(() => [
949
+ $(g(ne), {
950
+ modelValue: o.password,
951
+ "onUpdate:modelValue": l[1] || (l[1] = (C) => o.password = C),
952
+ type: "password",
953
+ placeholder: "密码",
954
+ "prefix-icon": "🔒",
955
+ size: "large",
956
+ "show-password": "",
957
+ onKeyup: De(y, ["enter"])
958
+ }, null, 8, ["modelValue"])
959
+ ]),
960
+ _: 1
961
+ }),
962
+ $(g(J), null, {
963
+ default: E(() => [
964
+ $(g(Be), {
965
+ modelValue: i.value,
966
+ "onUpdate:modelValue": l[2] || (l[2] = (C) => i.value = C)
967
+ }, {
968
+ default: E(() => [...l[3] || (l[3] = [
969
+ F("记住我", -1)
970
+ ])]),
971
+ _: 1
972
+ }, 8, ["modelValue"])
973
+ ]),
974
+ _: 1
975
+ }),
976
+ $(g(J), null, {
977
+ default: E(() => [
978
+ $(g(te), {
979
+ type: "primary",
980
+ size: "large",
981
+ loading: c.value,
982
+ class: "login__submit",
983
+ onClick: y
984
+ }, {
985
+ default: E(() => [...l[4] || (l[4] = [
986
+ F(" 登录 ", -1)
987
+ ])]),
988
+ _: 1
989
+ }, 8, ["loading"])
990
+ ]),
991
+ _: 1
992
+ })
993
+ ]),
994
+ _: 1
995
+ }, 8, ["model"]),
996
+ l[6] || (l[6] = n("div", { class: "login__footer" }, [
997
+ n("p", null, "提示: 任意用户名密码即可登录 (Mock 模式)")
998
+ ], -1))
999
+ ])
1000
+ ]));
1001
+ }
1002
+ }), es = /* @__PURE__ */ O(Gt, [["__scopeId", "data-v-cc0ffe99"]]), ts = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1003
+ __proto__: null,
1004
+ default: es
1005
+ }, Symbol.toStringTag, { value: "Module" })), ss = { class: "error-page" }, os = { class: "error-page__content" }, ns = /* @__PURE__ */ z({
1006
+ __name: "404",
1007
+ setup(e) {
1008
+ const s = j(), t = () => {
1009
+ s.push("/");
1010
+ };
1011
+ return (a, r) => (v(), f("div", ss, [
1012
+ n("div", os, [
1013
+ r[1] || (r[1] = n("div", { class: "error-page__code" }, "404", -1)),
1014
+ r[2] || (r[2] = n("div", { class: "error-page__title" }, "页面不存在", -1)),
1015
+ r[3] || (r[3] = n("div", { class: "error-page__desc" }, "抱歉,您访问的页面不存在或已被删除", -1)),
1016
+ $(g(te), {
1017
+ type: "primary",
1018
+ onClick: t
1019
+ }, {
1020
+ default: E(() => [...r[0] || (r[0] = [
1021
+ F("返回首页", -1)
1022
+ ])]),
1023
+ _: 1
1024
+ })
1025
+ ])
1026
+ ]));
1027
+ }
1028
+ }), rs = /* @__PURE__ */ O(ns, [["__scopeId", "data-v-c3c12c24"]]), as = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1029
+ __proto__: null,
1030
+ default: rs
1031
+ }, Symbol.toStringTag, { value: "Module" })), ls = { class: "error-page" }, is = { class: "error-page__content" }, cs = /* @__PURE__ */ z({
1032
+ __name: "403",
1033
+ setup(e) {
1034
+ const s = j(), t = () => {
1035
+ s.push("/");
1036
+ };
1037
+ return (a, r) => (v(), f("div", ls, [
1038
+ n("div", is, [
1039
+ r[1] || (r[1] = n("div", { class: "error-page__code" }, "403", -1)),
1040
+ r[2] || (r[2] = n("div", { class: "error-page__title" }, "无访问权限", -1)),
1041
+ r[3] || (r[3] = n("div", { class: "error-page__desc" }, "抱歉,您没有权限访问此页面", -1)),
1042
+ $(g(te), {
1043
+ type: "primary",
1044
+ onClick: t
1045
+ }, {
1046
+ default: E(() => [...r[0] || (r[0] = [
1047
+ F("返回首页", -1)
1048
+ ])]),
1049
+ _: 1
1050
+ })
1051
+ ])
1052
+ ]));
1053
+ }
1054
+ }), us = /* @__PURE__ */ O(cs, [["__scopeId", "data-v-dd5f2795"]]), ds = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1055
+ __proto__: null,
1056
+ default: us
1057
+ }, Symbol.toStringTag, { value: "Module" }));
1058
+ function Is() {
1059
+ const e = P(), s = (c) => {
1060
+ const i = e.permissions;
1061
+ return i.includes("*") ? !0 : Array.isArray(c) ? c.some((o) => i.includes(o)) : i.includes(c);
1062
+ }, t = (c) => {
1063
+ const i = e.roles;
1064
+ return i.includes("admin") ? !0 : Array.isArray(c) ? c.some((o) => i.includes(o)) : i.includes(c);
1065
+ }, a = b(() => e.roles.includes("admin")), r = b(() => e.isLoggedIn);
1066
+ return {
1067
+ hasPermission: s,
1068
+ hasRole: t,
1069
+ isAdmin: a,
1070
+ isLoggedIn: r
1071
+ };
1072
+ }
1073
+ function Rs(e, s = {}) {
1074
+ const { rules: t, onSubmit: a } = s, r = p(), c = re({ ...e }), i = p(!1), o = p(!1), u = p(!1), d = () => {
1075
+ l(), u.value = !1, o.value = !0;
1076
+ }, y = (I) => {
1077
+ Object.assign(c, I), u.value = !0, o.value = !0;
1078
+ }, x = () => {
1079
+ o.value = !1, l();
1080
+ }, l = () => {
1081
+ var I;
1082
+ Object.keys(e).forEach((R) => {
1083
+ c[R] = e[R];
1084
+ }), (I = r.value) == null || I.resetFields();
1085
+ };
1086
+ return {
1087
+ formRef: r,
1088
+ formData: c,
1089
+ rules: t,
1090
+ loading: i,
1091
+ visible: o,
1092
+ isEdit: u,
1093
+ openAdd: d,
1094
+ openEdit: y,
1095
+ close: x,
1096
+ resetForm: l,
1097
+ handleSubmit: async () => {
1098
+ var I;
1099
+ try {
1100
+ await ((I = r.value) == null ? void 0 : I.validate()), i.value = !0, await (a == null ? void 0 : a(c)), x();
1101
+ } catch (R) {
1102
+ console.error(R);
1103
+ } finally {
1104
+ i.value = !1;
1105
+ }
1106
+ }
1107
+ };
1108
+ }
1109
+ function Ms(e) {
1110
+ const { fetchData: s, defaultPageSize: t = 10 } = e, a = p(!1), r = p([]), c = p(0), i = p(1), o = p(t), u = re({}), d = async () => {
1111
+ a.value = !0;
1112
+ try {
1113
+ const L = {
1114
+ ...u,
1115
+ page: i.value,
1116
+ pageSize: o.value
1117
+ }, M = await s(L);
1118
+ r.value = M.list, c.value = M.total;
1119
+ } catch (L) {
1120
+ console.error(L);
1121
+ } finally {
1122
+ a.value = !1;
1123
+ }
1124
+ }, y = () => {
1125
+ i.value = 1, d();
1126
+ }, x = () => {
1127
+ Object.keys(u).forEach((L) => {
1128
+ u[L] = void 0;
1129
+ }), i.value = 1, d();
1130
+ }, l = (L) => {
1131
+ i.value = L, d();
1132
+ }, C = (L) => {
1133
+ o.value = L, i.value = 1, d();
1134
+ }, I = () => {
1135
+ d();
1136
+ }, R = b(() => ({
1137
+ current: i.value,
1138
+ pageSize: o.value,
1139
+ total: c.value
1140
+ }));
1141
+ return {
1142
+ loading: a,
1143
+ data: r,
1144
+ total: c,
1145
+ currentPage: i,
1146
+ pageSize: o,
1147
+ searchParams: u,
1148
+ pagination: R,
1149
+ getData: d,
1150
+ handleSearch: y,
1151
+ handleReset: x,
1152
+ handlePageChange: l,
1153
+ handleSizeChange: C,
1154
+ refresh: I
1155
+ };
1156
+ }
1157
+ function Us(e) {
1158
+ const t = P().permissions;
1159
+ return Array.isArray(e) ? e.some((a) => t.includes(a)) : t.includes(e);
1160
+ }
1161
+ function ms(e) {
1162
+ const t = P().roles;
1163
+ return Array.isArray(e) ? e.some((a) => t.includes(a)) : t.includes(e);
1164
+ }
1165
+ function Ds() {
1166
+ return ms("admin");
1167
+ }
1168
+ const ps = () => {
1169
+ const e = Fe.create({
1170
+ baseURL: void 0,
1171
+ timeout: 3e4,
1172
+ headers: {
1173
+ "Content-Type": "application/json"
1174
+ }
1175
+ });
1176
+ return e.interceptors.request.use(
1177
+ (s) => {
1178
+ const t = me();
1179
+ return t && (s.headers.Authorization = `Bearer ${t}`), s;
1180
+ },
1181
+ (s) => Promise.reject(s)
1182
+ ), e.interceptors.response.use(
1183
+ (s) => {
1184
+ const { data: t } = s;
1185
+ return t.code === 200 || t.code === 0 ? t.data : (D.error(t.message || "请求失败"), Promise.reject(new Error(t.message || "请求失败")));
1186
+ },
1187
+ (s) => {
1188
+ var a;
1189
+ const { response: t } = s;
1190
+ if (t)
1191
+ switch (t.status) {
1192
+ case 401:
1193
+ D.error("登录已过期,请重新登录"), xe(), window.location.href = "/login";
1194
+ break;
1195
+ case 403:
1196
+ D.error("没有权限访问");
1197
+ break;
1198
+ case 404:
1199
+ D.error("请求资源不存在");
1200
+ break;
1201
+ case 500:
1202
+ D.error("服务器错误");
1203
+ break;
1204
+ default:
1205
+ D.error(((a = t.data) == null ? void 0 : a.message) || "请求失败");
1206
+ }
1207
+ else
1208
+ D.error("网络连接失败");
1209
+ return Promise.reject(s);
1210
+ }
1211
+ ), e;
1212
+ }, q = ps(), w = {
1213
+ get(e, s) {
1214
+ return q.get(e, s);
1215
+ },
1216
+ post(e, s, t) {
1217
+ return q.post(e, s, t);
1218
+ },
1219
+ put(e, s, t) {
1220
+ return q.put(e, s, t);
1221
+ },
1222
+ patch(e, s, t) {
1223
+ return q.patch(e, s, t);
1224
+ },
1225
+ delete(e, s) {
1226
+ return q.delete(e, s);
1227
+ }
1228
+ };
1229
+ function Ps(e, s = {}) {
1230
+ const t = s.indexPath || "/dashboard";
1231
+ return {
1232
+ path: "/",
1233
+ name: "Layout",
1234
+ component: Te,
1235
+ redirect: t,
1236
+ children: e
1237
+ };
1238
+ }
1239
+ function Os(e) {
1240
+ return ae({
1241
+ history: le(),
1242
+ routes: e,
1243
+ scrollBehavior: () => ({ left: 0, top: 0 })
1244
+ });
1245
+ }
1246
+ function Vs(e) {
1247
+ return w.post("/auth/login", e);
1248
+ }
1249
+ function Ns() {
1250
+ return w.post("/auth/logout");
1251
+ }
1252
+ function zs() {
1253
+ return w.get("/user/info");
1254
+ }
1255
+ function Bs(e) {
1256
+ return w.post("/auth/refresh", { refreshToken: e });
1257
+ }
1258
+ function Fs(e) {
1259
+ return w.get("/role/list", { params: e });
1260
+ }
1261
+ function js(e) {
1262
+ return w.get(`/role/${e}`);
1263
+ }
1264
+ function Hs(e) {
1265
+ return w.post("/role", e);
1266
+ }
1267
+ function Ks(e, s) {
1268
+ return w.put(`/role/${e}`, s);
1269
+ }
1270
+ function qs(e) {
1271
+ return w.delete(`/role/${e}`);
1272
+ }
1273
+ function Ws(e, s) {
1274
+ return w.patch(`/role/${e}/status`, { status: s });
1275
+ }
1276
+ function Xs() {
1277
+ return w.get("/menu/list");
1278
+ }
1279
+ function Ys() {
1280
+ return w.get("/menu/tree");
1281
+ }
1282
+ function Js(e) {
1283
+ return w.post("/menu", e);
1284
+ }
1285
+ function Qs(e, s) {
1286
+ return w.put(`/menu/${e}`, s);
1287
+ }
1288
+ function Zs(e) {
1289
+ return w.delete(`/menu/${e}`);
1290
+ }
1291
+ function Gs(e) {
1292
+ return w.get("/user/list", { params: e });
1293
+ }
1294
+ function eo(e) {
1295
+ return w.get(`/user/${e}`);
1296
+ }
1297
+ function to(e) {
1298
+ return w.post("/user", e);
1299
+ }
1300
+ function so(e, s) {
1301
+ return w.put(`/user/${e}`, s);
1302
+ }
1303
+ function oo(e) {
1304
+ return w.delete(`/user/${e}`);
1305
+ }
1306
+ function no(e) {
1307
+ return w.post("/user/batch-delete", { ids: e });
1308
+ }
1309
+ function ro(e, s) {
1310
+ return w.patch(`/user/${e}/status`, { status: s });
1311
+ }
1312
+ function ao(e) {
1313
+ return w.post(`/user/${e}/reset-password`);
1314
+ }
1315
+ var hs = /* @__PURE__ */ ((e) => (e[e.ENABLED = 1] = "ENABLED", e[e.DISABLED = 0] = "DISABLED", e))(hs || {}), vs = /* @__PURE__ */ ((e) => (e[e.UNKNOWN = 0] = "UNKNOWN", e[e.MALE = 1] = "MALE", e[e.FEMALE = 2] = "FEMALE", e))(vs || {}), _s = /* @__PURE__ */ ((e) => (e[e.DIRECTORY = 0] = "DIRECTORY", e[e.MENU = 1] = "MENU", e[e.BUTTON = 2] = "BUTTON", e))(_s || {});
1316
+ const lo = {
1317
+ 1: "启用",
1318
+ 0: "禁用"
1319
+ }, io = {
1320
+ 0: "未知",
1321
+ 1: "男",
1322
+ 2: "女"
1323
+ }, co = {
1324
+ 0: "目录",
1325
+ 1: "菜单",
1326
+ 2: "按钮"
1327
+ }, uo = [
1328
+ {
1329
+ label: "启用",
1330
+ value: 1
1331
+ /* ENABLED */
1332
+ },
1333
+ {
1334
+ label: "禁用",
1335
+ value: 0
1336
+ /* DISABLED */
1337
+ }
1338
+ ], mo = [
1339
+ {
1340
+ label: "未知",
1341
+ value: 0
1342
+ /* UNKNOWN */
1343
+ },
1344
+ {
1345
+ label: "男",
1346
+ value: 1
1347
+ /* MALE */
1348
+ },
1349
+ {
1350
+ label: "女",
1351
+ value: 2
1352
+ /* FEMALE */
1353
+ }
1354
+ ], po = [
1355
+ {
1356
+ label: "目录",
1357
+ value: 0
1358
+ /* DIRECTORY */
1359
+ },
1360
+ {
1361
+ label: "菜单",
1362
+ value: 1
1363
+ /* MENU */
1364
+ },
1365
+ {
1366
+ label: "按钮",
1367
+ value: 2
1368
+ /* BUTTON */
1369
+ }
1370
+ ], ho = {
1371
+ mounted(e, s) {
1372
+ var i;
1373
+ const t = P(), { value: a } = s;
1374
+ if (!a) return;
1375
+ const r = t.permissions;
1376
+ let c = !1;
1377
+ Array.isArray(a) ? c = a.some((o) => r.includes(o) || r.includes("*")) : c = r.includes(a) || r.includes("*"), c || (i = e.parentNode) == null || i.removeChild(e);
1378
+ }
1379
+ };
1380
+ export {
1381
+ Bs as $,
1382
+ Fs as A,
1383
+ me as B,
1384
+ We as C,
1385
+ eo as D,
1386
+ zs as E,
1387
+ Es as F,
1388
+ vs as G,
1389
+ Vt as H,
1390
+ Gs as I,
1391
+ Us as J,
1392
+ ms as K,
1393
+ Te as L,
1394
+ _s as M,
1395
+ Ce as N,
1396
+ w as O,
1397
+ Ds as P,
1398
+ Je as Q,
1399
+ Se as R,
1400
+ hs as S,
1401
+ As as T,
1402
+ m as U,
1403
+ Q as V,
1404
+ Vs as W,
1405
+ Ns as X,
1406
+ He as Y,
1407
+ ho as Z,
1408
+ O as _,
1409
+ uo as a,
1410
+ ao as a0,
1411
+ Ls as a1,
1412
+ pe as a2,
1413
+ Cs as a3,
1414
+ Z as a4,
1415
+ qe as a5,
1416
+ Ke as a6,
1417
+ Xe as a7,
1418
+ Ye as a8,
1419
+ be as a9,
1420
+ Qs as aa,
1421
+ Ks as ab,
1422
+ Ws as ac,
1423
+ so as ad,
1424
+ ro as ae,
1425
+ se as af,
1426
+ Is as ag,
1427
+ he as ah,
1428
+ Rs as ai,
1429
+ oe as aj,
1430
+ Ms as ak,
1431
+ P as al,
1432
+ po as b,
1433
+ us as c,
1434
+ mo as d,
1435
+ io as e,
1436
+ co as f,
1437
+ rs as g,
1438
+ _t as h,
1439
+ es as i,
1440
+ lo as j,
1441
+ no as k,
1442
+ xe as l,
1443
+ Ps as m,
1444
+ Js as n,
1445
+ Hs as o,
1446
+ Os as p,
1447
+ to as q,
1448
+ Ts as r,
1449
+ Zs as s,
1450
+ qs as t,
1451
+ oo as u,
1452
+ we as v,
1453
+ Xs as w,
1454
+ Ys as x,
1455
+ $s as y,
1456
+ js as z
1457
+ };