xto-fronted 0.1.7 → 0.1.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.
Files changed (86) hide show
  1. package/README.md +23 -0
  2. package/dist/components/Login/index.vue.d.ts +15 -0
  3. package/dist/config/index.d.ts +25 -5
  4. package/dist/index.d.ts +17 -4
  5. package/dist/index.es.js +1272 -55
  6. package/dist/index.umd.js +1 -1
  7. package/dist/router/dynamicRoutes.d.ts +19 -25
  8. package/dist/router/index.d.ts +24 -4
  9. package/dist/router/staticRoutes.d.ts +15 -2
  10. package/dist/stores/menu.d.ts +14 -8
  11. package/dist/style.css +1 -1
  12. package/dist/utils/request.d.ts +8 -0
  13. package/package.json +2 -10
  14. package/.env.development +0 -3
  15. package/.env.production +0 -3
  16. package/dist/403-DM5wfQkM.js +0 -31
  17. package/dist/404-BurAu5LC.js +0 -31
  18. package/dist/index-BNiEld34.js +0 -15
  19. package/dist/index-Be9RiEfo.js +0 -98
  20. package/dist/index-BqRv1bdN.js +0 -1185
  21. package/dist/index-CQLVXvNJ.js +0 -15
  22. package/dist/index-CyiE8n2V.js +0 -15
  23. package/dist/index-xauR1bOL.js +0 -15
  24. package/dist/views/dashboard/index.vue.d.ts +0 -2
  25. package/dist/views/login/index.vue.d.ts +0 -4
  26. package/dist/views/system/menu/index.vue.d.ts +0 -2
  27. package/dist/views/system/role/index.vue.d.ts +0 -2
  28. package/dist/views/system/user/index.vue.d.ts +0 -2
  29. package/index.html +0 -13
  30. package/public/vite.svg +0 -10
  31. package/src/App.vue +0 -20
  32. package/src/api/auth.ts +0 -35
  33. package/src/api/menu.ts +0 -13
  34. package/src/api/system.ts +0 -65
  35. package/src/api/user.ts +0 -12
  36. package/src/assets/styles/_dark.scss +0 -407
  37. package/src/assets/styles/_reset.scss +0 -126
  38. package/src/assets/styles/_root.scss +0 -140
  39. package/src/assets/styles/_transition.scss +0 -119
  40. package/src/assets/styles/_variables.scss +0 -45
  41. package/src/assets/styles/index.scss +0 -187
  42. package/src/components/Layout/Footer.vue +0 -17
  43. package/src/components/Layout/Header.vue +0 -335
  44. package/src/components/Layout/Sidebar.vue +0 -213
  45. package/src/components/Layout/Tabs.vue +0 -20
  46. package/src/components/Layout/index.vue +0 -62
  47. package/src/composables/index.ts +0 -9
  48. package/src/composables/useApp.ts +0 -170
  49. package/src/composables/useAuth.ts +0 -70
  50. package/src/composables/useForm.ts +0 -79
  51. package/src/composables/useMenu.ts +0 -141
  52. package/src/composables/useTable.ts +0 -97
  53. package/src/config/index.ts +0 -19
  54. package/src/directives/permission.ts +0 -41
  55. package/src/enums/index.ts +0 -63
  56. package/src/env.d.ts +0 -17
  57. package/src/index.ts +0 -44
  58. package/src/main.ts +0 -29
  59. package/src/router/dynamicRoutes.ts +0 -163
  60. package/src/router/index.ts +0 -71
  61. package/src/router/staticRoutes.ts +0 -43
  62. package/src/stores/app.ts +0 -145
  63. package/src/stores/auth.ts +0 -45
  64. package/src/stores/index.ts +0 -15
  65. package/src/stores/menu.ts +0 -158
  66. package/src/stores/user.ts +0 -41
  67. package/src/types/api.d.ts +0 -103
  68. package/src/types/global.d.ts +0 -45
  69. package/src/types/router.d.ts +0 -48
  70. package/src/types/xto.d.ts +0 -149
  71. package/src/utils/auth.ts +0 -86
  72. package/src/utils/permission.ts +0 -30
  73. package/src/utils/request.ts +0 -126
  74. package/src/utils/storage.ts +0 -72
  75. package/src/views/dashboard/index.vue +0 -32
  76. package/src/views/error/403.vue +0 -57
  77. package/src/views/error/404.vue +0 -57
  78. package/src/views/login/index.vue +0 -141
  79. package/src/views/system/menu/index.vue +0 -32
  80. package/src/views/system/role/index.vue +0 -32
  81. package/src/views/system/user/index.vue +0 -32
  82. package/tsconfig.json +0 -26
  83. package/tsconfig.node.json +0 -11
  84. package/vite.config.ts +0 -139
  85. /package/dist/{views/error → components/Error}/403.vue.d.ts +0 -0
  86. /package/dist/{views/error → components/Error}/404.vue.d.ts +0 -0
package/dist/index.es.js CHANGED
@@ -1,57 +1,1274 @@
1
- import { F as a, G as t, b as o, c as r, H as n, i as u, M as i, d as p, e as g, S as l, f as T, g as S, h as d, T as c, j as f, k as y, l as U, m, n as M, o as h, p as k, q as A, r as I, s as R, t as x, v as C, w as b, x as D, y as G, z as L, A as O, B as F, C as v, D as B, E as H, I as P, J as j, K as q, L as w, N as z, O as E, P as J, Q as K, R as N, U as Q, u as V, V as W, W as X, X as Y, Y as Z, Z as $, $ as _, a0 as ss, a1 as es } from "./index-BqRv1bdN.js";
1
+ import ye from "axios";
2
+ import { Message as R } from "@xto/feedback";
3
+ import { ref as w, computed as b, watch as we, reactive as ae, defineComponent as D, openBlock as k, createElementBlock as L, createElementVNode as c, withDirectives as be, toDisplayString as x, unref as _, vShow as Ce, createVNode as T, isRef as ke, Fragment as q, renderList as se, createCommentVNode as V, withCtx as E, createBlock as ne, createTextVNode as X, onMounted as Ie, onUnmounted as Le, withModifiers as Se, normalizeClass as $e, Transition as xe, resolveComponent as Te, normalizeStyle as Ee, withKeys as Ue } from "vue";
4
+ import { defineStore as J } from "pinia";
5
+ import { useRouter as Q, useRoute as ue, createRouter as de, createWebHistory as he } from "vue-router";
6
+ import { Menu as Ne, SubMenu as Pe, MenuItem as ie } from "@xto/navigation";
7
+ import { Button as Z } from "@xto/base";
8
+ import { Input as re, Form as Re, FormItem as oe } from "@xto/form";
9
+ const Me = {
10
+ appName: "XTO App",
11
+ baseUrl: "",
12
+ appId: "",
13
+ clientId: "",
14
+ indexPath: "/dashboard",
15
+ loginPath: "/login"
16
+ };
17
+ let F = { ...Me };
18
+ function Ae(e) {
19
+ F = { ...F, ...e };
20
+ }
21
+ function P() {
22
+ return F;
23
+ }
24
+ function ds(e) {
25
+ return F[e];
26
+ }
27
+ const H = () => `tooyu-cloud:${F.appId}:`, pe = (e) => ({
28
+ get(s) {
29
+ const t = H(), n = e.getItem(t + s);
30
+ if (!n) return null;
31
+ try {
32
+ return JSON.parse(n);
33
+ } catch {
34
+ return n;
35
+ }
36
+ },
37
+ set(s, t) {
38
+ const n = H();
39
+ if (t == null) {
40
+ e.removeItem(n + s);
41
+ return;
42
+ }
43
+ const o = typeof t == "string" ? t : JSON.stringify(t);
44
+ e.setItem(n + s, o);
45
+ },
46
+ remove(s) {
47
+ const t = H();
48
+ e.removeItem(t + s);
49
+ },
50
+ clear() {
51
+ const s = H();
52
+ Object.keys(e).forEach((n) => {
53
+ n.startsWith(s) && e.removeItem(n);
54
+ });
55
+ }
56
+ }), W = pe(window.localStorage), j = pe(window.sessionStorage), g = {
57
+ get: W.get,
58
+ set: W.set,
59
+ remove: W.remove,
60
+ clear: W.clear
61
+ }, hs = {
62
+ get: j.get,
63
+ set: j.set,
64
+ remove: j.remove,
65
+ clear: j.clear
66
+ }, le = "login_info", G = "user_info", O = () => g.get(le), Be = (e) => {
67
+ const s = {
68
+ accessToken: e.access_token,
69
+ refreshToken: e.refresh_token,
70
+ expiresTime: e.expires_time,
71
+ refreshTime: e.refresh_time,
72
+ tokenType: e.token_type,
73
+ code: e.code
74
+ };
75
+ g.set(le, s);
76
+ }, _e = () => {
77
+ const e = O();
78
+ return (e == null ? void 0 : e.accessToken) || null;
79
+ }, Fe = () => {
80
+ const e = O();
81
+ return (e == null ? void 0 : e.tokenType) || "Bearer";
82
+ }, ps = () => {
83
+ const e = O();
84
+ return (e == null ? void 0 : e.code) || null;
85
+ }, me = () => {
86
+ g.remove(le), g.remove(G);
87
+ }, fe = () => !!_e(), _s = (e) => {
88
+ g.set(G, e);
89
+ }, ms = () => g.get(G), fs = () => {
90
+ g.remove(G);
91
+ }, De = () => {
92
+ const e = P(), s = ye.create({
93
+ baseURL: e.baseUrl,
94
+ timeout: 15e3,
95
+ headers: {
96
+ "Content-Type": "application/json"
97
+ }
98
+ });
99
+ return s.interceptors.request.use(
100
+ (t) => {
101
+ const n = _e();
102
+ if (n) {
103
+ const o = Fe();
104
+ t.headers.Authorization = `${o} ${n}`;
105
+ }
106
+ return t;
107
+ },
108
+ (t) => Promise.reject(t)
109
+ ), s.interceptors.response.use(
110
+ (t) => {
111
+ const { data: n } = t;
112
+ return n.code === 200 || n.code === 0 ? t : (R.error(n.message || "请求失败"), Promise.reject(new Error(n.message || "请求失败")));
113
+ },
114
+ (t) => {
115
+ var o;
116
+ const { response: n } = t;
117
+ if (n)
118
+ switch (n.status) {
119
+ case 401:
120
+ case 403:
121
+ R.error("登录已过期,请重新登录"), me(), window.location.href = "/login";
122
+ break;
123
+ case 404:
124
+ R.error("请求资源不存在");
125
+ break;
126
+ case 500:
127
+ R.error("服务器错误");
128
+ break;
129
+ default:
130
+ R.error(((o = n.data) == null ? void 0 : o.message) || "请求失败");
131
+ }
132
+ else
133
+ R.error("网络连接失败");
134
+ return Promise.reject(t);
135
+ }
136
+ ), s;
137
+ };
138
+ let Y = null;
139
+ function B() {
140
+ return Y || (Y = De()), Y;
141
+ }
142
+ function Ve() {
143
+ Y = null;
144
+ }
145
+ new Proxy({}, {
146
+ get(e, s) {
147
+ return B()[s];
148
+ }
149
+ });
150
+ const z = {
151
+ get(e, s) {
152
+ return B().get(e, s).then((t) => t.data);
153
+ },
154
+ post(e, s, t) {
155
+ return B().post(e, s, t).then((n) => n.data);
156
+ },
157
+ put(e, s, t) {
158
+ return B().put(e, s, t).then((n) => n.data);
159
+ },
160
+ patch(e, s, t) {
161
+ return B().patch(e, s, t).then((n) => n.data);
162
+ },
163
+ delete(e, s) {
164
+ return B().delete(e, s).then((t) => t.data);
165
+ }
166
+ }, ee = J("app", () => {
167
+ const e = w(g.get("isDark") || !1), s = w(g.get("theme") || "light"), t = w(g.get("layout") || "sidebar"), n = w(g.get("isCollapsed") || !1), o = w(g.get("showTabs") ?? !0), d = w(g.get("showFooter") ?? !0), a = w(g.get("showBreadcrumb") ?? !0), r = w(g.get("primaryColor") || "#409eff"), h = w([]), y = b(() => e.value ? "dark" : "light"), f = () => {
168
+ e.value = !e.value, s.value = e.value ? "dark" : "light", p();
169
+ }, u = ($) => {
170
+ s.value = $, e.value = $ === "dark", p();
171
+ }, p = () => {
172
+ const $ = document.documentElement;
173
+ e.value ? $.classList.add("dark") : $.classList.remove("dark"), g.set("isDark", e.value), g.set("theme", s.value);
174
+ }, C = () => {
175
+ n.value = !n.value, g.set("isCollapsed", n.value);
176
+ }, l = ($) => {
177
+ t.value = $, g.set("layout", $);
178
+ }, I = () => {
179
+ o.value = !o.value, g.set("showTabs", o.value);
180
+ }, i = () => {
181
+ d.value = !d.value, g.set("showFooter", d.value);
182
+ }, v = () => {
183
+ a.value = !a.value, g.set("showBreadcrumb", a.value);
184
+ }, m = ($) => {
185
+ r.value = $, document.documentElement.style.setProperty("--color-primary", $), g.set("primaryColor", $);
186
+ }, S = ($) => {
187
+ h.value.includes($) || h.value.push($);
188
+ }, U = ($) => {
189
+ const ce = h.value.indexOf($);
190
+ ce > -1 && h.value.splice(ce, 1);
191
+ }, N = () => {
192
+ h.value = [];
193
+ }, A = () => {
194
+ p(), r.value !== "#409eff" && document.documentElement.style.setProperty("--color-primary", r.value);
195
+ };
196
+ return we(e, p), {
197
+ isDark: e,
198
+ theme: s,
199
+ layout: t,
200
+ isCollapsed: n,
201
+ showTabs: o,
202
+ showFooter: d,
203
+ showBreadcrumb: a,
204
+ primaryColor: r,
205
+ cachedViews: h,
206
+ themeClass: y,
207
+ toggleTheme: f,
208
+ toggleCollapse: C,
209
+ setTheme: u,
210
+ setLayout: l,
211
+ toggleTabs: I,
212
+ toggleFooter: i,
213
+ toggleBreadcrumb: v,
214
+ setPrimaryColor: m,
215
+ addCachedView: S,
216
+ removeCachedView: U,
217
+ clearCachedViews: N,
218
+ initTheme: A
219
+ };
220
+ }), Oe = "/vite.svg", ve = J("auth", () => {
221
+ const e = w(O()), s = b(() => fe()), t = (r) => {
222
+ Be(r), e.value = O();
223
+ }, n = () => {
224
+ e.value = null, me();
225
+ }, o = b(() => {
226
+ var r;
227
+ return ((r = e.value) == null ? void 0 : r.accessToken) || null;
228
+ }), d = b(() => {
229
+ var r;
230
+ return ((r = e.value) == null ? void 0 : r.tokenType) || "Bearer";
231
+ }), a = b(() => {
232
+ var r;
233
+ return ((r = e.value) == null ? void 0 : r.code) || null;
234
+ });
235
+ return {
236
+ loginInfo: e,
237
+ isLoggedIn: s,
238
+ accessToken: o,
239
+ tokenType: d,
240
+ code: a,
241
+ login: t,
242
+ logout: n
243
+ };
244
+ }), ge = J("user", () => {
245
+ const e = w(g.get("user_info")), s = b(() => !!e.value), t = b(() => {
246
+ var r;
247
+ return ((r = e.value) == null ? void 0 : r.userName) || "";
248
+ }), n = b(() => {
249
+ var r;
250
+ return ((r = e.value) == null ? void 0 : r.avatar) || "";
251
+ }), o = b(() => {
252
+ var r;
253
+ return (r = e.value) == null ? void 0 : r.userId;
254
+ });
255
+ return {
256
+ userInfo: e,
257
+ isLoggedIn: s,
258
+ userName: t,
259
+ avatar: n,
260
+ userId: o,
261
+ setUserInfo: (r) => {
262
+ e.value = r, g.set("user_info", r);
263
+ },
264
+ clearUserInfo: () => {
265
+ e.value = null, g.remove("user_info");
266
+ }
267
+ };
268
+ }), K = J("menu", () => {
269
+ const e = "menu_list", s = "menu_btn_list", t = w(g.get(e) || []), n = w(g.get(s) || {}), o = b(() => t.value.length > 0), d = b(() => {
270
+ const u = P();
271
+ function p(l) {
272
+ if (l && l.length > 0)
273
+ for (let I = 0; I < l.length; I++) {
274
+ const i = l[I];
275
+ if (i.default)
276
+ return i.path;
277
+ {
278
+ const v = p(i.children || []);
279
+ if (v)
280
+ return v;
281
+ }
282
+ }
283
+ return null;
284
+ }
285
+ return p(t.value) || u.indexPath || "/dashboard";
286
+ }), a = (u, p) => {
287
+ const C = [];
288
+ return !u || u.length <= 0 || u.forEach((l) => {
289
+ if (l.type === 1) {
290
+ const I = {
291
+ code: l.menuCode,
292
+ name: l.menuName,
293
+ path: "",
294
+ title: l.menuName
295
+ }, i = p || "";
296
+ let v = n.value[i] || [];
297
+ v.push(I), n.value[i] = v;
298
+ } else {
299
+ const I = [];
300
+ let i = l.menuUrl, v = l.isOut || !1;
301
+ !v && l.menuUrl && (l.menuUrl.startsWith("http") ? i = "/iframe/" + encodeURIComponent(i) : l.menuUrl.startsWith("keep-alive:") && (i = "/iframe/keep-alive/" + encodeURIComponent(i.split("keep-alive:")[1])));
302
+ const m = {
303
+ code: l.menuCode,
304
+ name: l.menuName,
305
+ path: i,
306
+ icon: l.icon,
307
+ closable: l.closable,
308
+ default: l.isDefault,
309
+ out: v,
310
+ children: I,
311
+ title: l.menuName
312
+ };
313
+ if (C.push(m), l.children && l.children.length > 0) {
314
+ const S = a(l.children, l.menuUrl);
315
+ m.children = S;
316
+ }
317
+ }
318
+ }), C;
319
+ }, r = (u) => {
320
+ t.value = u, g.set(e, u);
321
+ }, h = (u) => {
322
+ const p = t.value.findIndex((C) => C.code === "home");
323
+ p > -1 && t.value.splice(p, 1), t.value.unshift({
324
+ ...u,
325
+ code: "home",
326
+ name: "首页"
327
+ }), g.set(e, t.value);
328
+ }, y = (u, p) => {
329
+ if (f(), !(p != null && p.skipIndexMenu)) {
330
+ const l = P();
331
+ t.value.push({
332
+ code: "home",
333
+ name: "首页",
334
+ icon: "home",
335
+ closable: !1,
336
+ default: !1,
337
+ out: !1,
338
+ path: l.indexPath || "/dashboard",
339
+ title: "首页"
340
+ });
341
+ }
342
+ const C = a(u);
343
+ t.value.push(...C), g.set(e, t.value), g.set(s, n.value);
344
+ }, f = () => {
345
+ t.value = [], n.value = {}, g.remove(e), g.remove(s);
346
+ };
347
+ return {
348
+ menuList: t,
349
+ menuBtnListMap: n,
350
+ hasMenu: o,
351
+ index: d,
352
+ setMenuList: r,
353
+ setIndexMenu: h,
354
+ setMenuFromRemote: y,
355
+ clearMenu: f
356
+ };
357
+ });
358
+ function ze(e) {
359
+ const s = P();
360
+ return z.post("/user/v1.0/login/by-domain", {
361
+ appId: s.appId,
362
+ clientId: s.clientId,
363
+ uid: e.uid,
364
+ password: e.password,
365
+ code: !0
366
+ });
367
+ }
368
+ function Ke() {
369
+ return z.put("/user/v1.0/user/logout");
370
+ }
371
+ function vs(e, s) {
372
+ return z.get(`/user/v1.0/login/by-code?appId=${e}&code=${s}`);
373
+ }
374
+ function qe() {
375
+ return z.get("/user/v1.0/user/get-me");
376
+ }
377
+ function He() {
378
+ return z.get(`/user/v1.0/menu/get-menu?appId=${F.appId}`);
379
+ }
380
+ function te() {
381
+ const e = Q(), s = ue(), t = ve(), n = ge(), o = K(), d = w(!1), a = b(() => t.isLoggedIn), r = b(() => n.userInfo), h = b(() => n.userName || ""), y = b(() => o.menuList), f = b(() => o.index), u = async (v, m) => {
382
+ d.value = !0;
383
+ try {
384
+ i();
385
+ const U = (await ze({ uid: v, password: m })).data;
386
+ t.login(U), await C(), await l();
387
+ const N = s.query.redirectUrl;
388
+ if (N) {
389
+ const A = decodeURIComponent(N);
390
+ if (A.startsWith("http")) {
391
+ const $ = U.code;
392
+ location.href = A.includes("?") ? `${A}&code=${$}` : `${A}?code=${$}`;
393
+ } else
394
+ await e.replace(A);
395
+ } else
396
+ await e.replace(f.value || "/");
397
+ return R.success("登录成功"), { success: !0, data: U };
398
+ } catch (S) {
399
+ return R.error((S == null ? void 0 : S.message) || "登录失败"), { success: !1, error: S };
400
+ } finally {
401
+ d.value = !1;
402
+ }
403
+ }, p = async (v = !0) => {
404
+ const m = P();
405
+ try {
406
+ await Ke();
407
+ } catch (S) {
408
+ console.error("退出登录接口失败", S);
409
+ } finally {
410
+ i(), e.push(m.loginPath || "/login"), v && R.success("退出登录成功");
411
+ }
412
+ }, C = async () => {
413
+ const v = await qe();
414
+ return n.setUserInfo(v.data), v.data;
415
+ }, l = async () => {
416
+ const v = await He();
417
+ return o.setMenuFromRemote(v.data), o.menuList;
418
+ }, I = async () => {
419
+ if (!t.isLoggedIn)
420
+ return !1;
421
+ try {
422
+ return n.userInfo || await C(), o.hasMenu || await l(), !0;
423
+ } catch (v) {
424
+ return console.error("初始化应用失败", v), i(), !1;
425
+ }
426
+ }, i = () => {
427
+ t.logout(), n.clearUserInfo(), o.clearMenu();
428
+ };
429
+ return {
430
+ // 状态
431
+ loading: d,
432
+ isLoggedIn: a,
433
+ userInfo: r,
434
+ userName: h,
435
+ menuList: y,
436
+ indexPath: f,
437
+ // 方法
438
+ login: u,
439
+ logout: p,
440
+ loadUserInfo: C,
441
+ loadMenu: l,
442
+ initApp: I,
443
+ clearAllState: i
444
+ };
445
+ }
446
+ function gs() {
447
+ const e = K(), s = ve(), t = ge(), n = b(() => s.isLoggedIn), o = b(() => t.userName), d = b(() => t.userInfo), a = (f) => {
448
+ const u = window.location.pathname, C = (e.menuBtnListMap[u] || []).map((l) => l.code);
449
+ return Array.isArray(f) ? f.some((l) => C.includes(l)) : C.includes(f);
450
+ };
451
+ return {
452
+ // 状态
453
+ isLoggedIn: n,
454
+ userName: o,
455
+ userInfo: d,
456
+ // 方法
457
+ hasPermission: a,
458
+ hasAnyPermission: (f) => f.some((u) => a(u)),
459
+ hasAllPermissions: (f) => f.every((u) => a(u)),
460
+ getCurrentPagePermissions: () => {
461
+ const f = window.location.pathname;
462
+ return (e.menuBtnListMap[f] || []).map((p) => p.code);
463
+ }
464
+ };
465
+ }
466
+ const We = {
467
+ home: "🏠",
468
+ dashboard: "📊",
469
+ system: "⚙️",
470
+ user: "👤",
471
+ role: "👥",
472
+ menu: "📋",
473
+ setting: "🔧"
474
+ };
475
+ function je(e) {
476
+ const s = ue(), t = Q(), n = K(), o = ee(), d = { ...We, ...e }, a = w(""), r = b(() => s.path), h = b(() => o.isCollapsed), y = b(() => n.menuList), f = b(() => n.hasMenu), u = (m, S = "") => {
477
+ const U = [];
478
+ return m.forEach((N) => {
479
+ N.children && N.children.length > 0 ? U.push(...u(N.children, N.title)) : U.push({ ...N, parentTitle: S });
480
+ }), U;
481
+ }, p = b(() => a.value.trim() ? u(y.value).filter(
482
+ (S) => S.title.toLowerCase().includes(a.value.toLowerCase())
483
+ ) : []), C = b(() => a.value.trim() ? y.value.map((m) => {
484
+ if (m.children && m.children.length > 0) {
485
+ const S = m.children.filter(
486
+ (U) => U.title.toLowerCase().includes(a.value.toLowerCase())
487
+ );
488
+ return S.length > 0 ? { ...m, children: S } : null;
489
+ }
490
+ return m.title.toLowerCase().includes(a.value.toLowerCase()) ? m : null;
491
+ }).filter(Boolean) : y.value);
492
+ return {
493
+ // 状态
494
+ searchKeyword: a,
495
+ activeMenu: r,
496
+ isCollapsed: h,
497
+ menuList: y,
498
+ hasMenu: f,
499
+ searchResults: p,
500
+ filteredMenuList: C,
501
+ // 方法
502
+ flattenMenus: u,
503
+ getMenuIcon: (m) => d[m || ""] || "📄",
504
+ handleMenuSelect: (m) => {
505
+ m && m !== s.path && (t.push(m), a.value = "");
506
+ },
507
+ handleSearchItemClick: (m) => {
508
+ t.push(m), a.value = "";
509
+ },
510
+ clearSearch: () => {
511
+ a.value = "";
512
+ }
513
+ };
514
+ }
515
+ function ys(e, s = {}) {
516
+ const { rules: t, onSubmit: n } = s, o = w(), d = ae({ ...e }), a = w(!1), r = w(!1), h = w(!1), y = () => {
517
+ p(), h.value = !1, r.value = !0;
518
+ }, f = (l) => {
519
+ Object.assign(d, l), h.value = !0, r.value = !0;
520
+ }, u = () => {
521
+ r.value = !1, p();
522
+ }, p = () => {
523
+ var l;
524
+ Object.keys(e).forEach((I) => {
525
+ d[I] = e[I];
526
+ }), (l = o.value) == null || l.resetFields();
527
+ };
528
+ return {
529
+ formRef: o,
530
+ formData: d,
531
+ rules: t,
532
+ loading: a,
533
+ visible: r,
534
+ isEdit: h,
535
+ openAdd: y,
536
+ openEdit: f,
537
+ close: u,
538
+ resetForm: p,
539
+ handleSubmit: async () => {
540
+ var l;
541
+ try {
542
+ await ((l = o.value) == null ? void 0 : l.validate()), a.value = !0, await (n == null ? void 0 : n(d)), u();
543
+ } catch (I) {
544
+ console.error(I);
545
+ } finally {
546
+ a.value = !1;
547
+ }
548
+ }
549
+ };
550
+ }
551
+ function ws(e) {
552
+ const { fetchData: s, defaultPageSize: t = 10 } = e, n = w(!1), o = w([]), d = w(0), a = w(1), r = w(t), h = ae({}), y = async () => {
553
+ n.value = !0;
554
+ try {
555
+ const i = {
556
+ ...h,
557
+ page: a.value,
558
+ pageSize: r.value
559
+ }, v = await s(i);
560
+ o.value = v.list, d.value = v.total;
561
+ } catch (i) {
562
+ console.error(i);
563
+ } finally {
564
+ n.value = !1;
565
+ }
566
+ }, f = () => {
567
+ a.value = 1, y();
568
+ }, u = () => {
569
+ Object.keys(h).forEach((i) => {
570
+ h[i] = void 0;
571
+ }), a.value = 1, y();
572
+ }, p = (i) => {
573
+ a.value = i, y();
574
+ }, C = (i) => {
575
+ r.value = i, a.value = 1, y();
576
+ }, l = () => {
577
+ y();
578
+ }, I = b(() => ({
579
+ current: a.value,
580
+ pageSize: r.value,
581
+ total: d.value
582
+ }));
583
+ return {
584
+ loading: n,
585
+ data: o,
586
+ total: d,
587
+ currentPage: a,
588
+ pageSize: r,
589
+ searchParams: h,
590
+ pagination: I,
591
+ getData: y,
592
+ handleSearch: f,
593
+ handleReset: u,
594
+ handlePageChange: p,
595
+ handleSizeChange: C,
596
+ refresh: l
597
+ };
598
+ }
599
+ const Ye = { class: "sidebar" }, Xe = { class: "sidebar__logo" }, Je = {
600
+ key: 0,
601
+ class: "sidebar__search"
602
+ }, Qe = {
603
+ key: 0,
604
+ class: "sidebar__search-results"
605
+ }, Ze = ["onClick"], Ge = { class: "menu-icon" }, et = { class: "sidebar__search-item-info" }, tt = { class: "sidebar__search-item-title" }, st = {
606
+ key: 0,
607
+ class: "sidebar__search-item-parent"
608
+ }, nt = { class: "menu-icon" }, ot = { class: "menu-icon" }, rt = { class: "menu-icon" }, at = {
609
+ key: 1,
610
+ class: "sidebar__user"
611
+ }, lt = { class: "sidebar__user-info" }, ct = { class: "sidebar__user-name" }, it = { class: "sidebar__user-role" }, ut = /* @__PURE__ */ D({
612
+ __name: "Sidebar",
613
+ setup(e) {
614
+ const { logout: s, userName: t, userInfo: n } = te(), o = P(), {
615
+ searchKeyword: d,
616
+ activeMenu: a,
617
+ isCollapsed: r,
618
+ searchResults: h,
619
+ filteredMenuList: y,
620
+ getMenuIcon: f,
621
+ handleMenuSelect: u,
622
+ handleSearchItemClick: p
623
+ } = je();
624
+ return (C, l) => {
625
+ var I;
626
+ return k(), L("div", Ye, [
627
+ c("div", Xe, [
628
+ l[1] || (l[1] = c("img", {
629
+ src: Oe,
630
+ alt: "Logo",
631
+ class: "sidebar__logo-img"
632
+ }, null, -1)),
633
+ be(c("span", { class: "sidebar__logo-text" }, x(_(o).appName), 513), [
634
+ [Ce, !_(r)]
635
+ ])
636
+ ]),
637
+ _(r) ? V("", !0) : (k(), L("div", Je, [
638
+ T(_(re), {
639
+ modelValue: _(d),
640
+ "onUpdate:modelValue": l[0] || (l[0] = (i) => ke(d) ? d.value = i : null),
641
+ placeholder: "搜索菜单...",
642
+ size: "small",
643
+ clearable: ""
644
+ }, null, 8, ["modelValue"]),
645
+ _(h).length > 0 ? (k(), L("div", Qe, [
646
+ (k(!0), L(q, null, se(_(h), (i) => (k(), L("div", {
647
+ key: i.path,
648
+ class: "sidebar__search-item",
649
+ onClick: (v) => _(p)(i.path)
650
+ }, [
651
+ c("span", Ge, x(_(f)(i.icon)), 1),
652
+ c("div", et, [
653
+ c("span", tt, x(i.title), 1),
654
+ i.parentTitle ? (k(), L("span", st, x(i.parentTitle), 1)) : V("", !0)
655
+ ])
656
+ ], 8, Ze))), 128))
657
+ ])) : V("", !0)
658
+ ])),
659
+ T(_(Ne), {
660
+ "default-active": _(a),
661
+ collapse: _(r),
662
+ "collapse-transition": !1,
663
+ class: "sidebar__menu",
664
+ onSelect: _(u)
665
+ }, {
666
+ default: E(() => [
667
+ (k(!0), L(q, null, se(_(y), (i) => (k(), L(q, {
668
+ key: i.path
669
+ }, [
670
+ i.children && i.children.length > 0 ? (k(), ne(_(Pe), {
671
+ key: 0,
672
+ index: i.path
673
+ }, {
674
+ title: E(() => [
675
+ c("span", nt, x(_(f)(i.icon)), 1),
676
+ c("span", null, x(i.title), 1)
677
+ ]),
678
+ default: E(() => [
679
+ (k(!0), L(q, null, se(i.children, (v) => (k(), ne(_(ie), {
680
+ key: v.path,
681
+ index: v.path
682
+ }, {
683
+ default: E(() => [
684
+ c("span", ot, x(_(f)(v.icon)), 1),
685
+ c("span", null, x(v.title), 1)
686
+ ]),
687
+ _: 2
688
+ }, 1032, ["index"]))), 128))
689
+ ]),
690
+ _: 2
691
+ }, 1032, ["index"])) : (k(), ne(_(ie), {
692
+ key: 1,
693
+ index: i.path
694
+ }, {
695
+ default: E(() => [
696
+ c("span", rt, x(_(f)(i.icon)), 1),
697
+ c("span", null, x(i.title), 1)
698
+ ]),
699
+ _: 2
700
+ }, 1032, ["index"]))
701
+ ], 64))), 128))
702
+ ]),
703
+ _: 1
704
+ }, 8, ["default-active", "collapse", "onSelect"]),
705
+ _(r) ? V("", !0) : (k(), L("div", at, [
706
+ c("div", lt, [
707
+ c("span", ct, x(_(t) || "用户"), 1),
708
+ c("span", it, x(((I = _(n)) == null ? void 0 : I.departmentName) || ""), 1)
709
+ ]),
710
+ T(_(Z), {
711
+ type: "text",
712
+ size: "small",
713
+ onClick: _(s)
714
+ }, {
715
+ default: E(() => [...l[2] || (l[2] = [
716
+ X("退出", -1)
717
+ ])]),
718
+ _: 1
719
+ }, 8, ["onClick"])
720
+ ]))
721
+ ]);
722
+ };
723
+ }
724
+ }), M = (e, s) => {
725
+ const t = e.__vccOpts || e;
726
+ for (const [n, o] of s)
727
+ t[n] = o;
728
+ return t;
729
+ }, dt = /* @__PURE__ */ M(ut, [["__scopeId", "data-v-5560e0bb"]]), ht = { class: "header" }, pt = { class: "header__right" }, _t = ["title"], mt = {
730
+ key: 0,
731
+ viewBox: "0 0 24 24",
732
+ width: "16",
733
+ height: "16",
734
+ fill: "currentColor"
735
+ }, ft = {
736
+ key: 1,
737
+ viewBox: "0 0 24 24",
738
+ width: "16",
739
+ height: "16",
740
+ fill: "currentColor"
741
+ }, vt = { key: 0 }, gt = { key: 1 }, yt = { class: "header__avatar" }, wt = { class: "header__user-name" }, bt = {
742
+ key: 0,
743
+ class: "header__dropdown"
744
+ }, Ct = { class: "header__dropdown-header" }, kt = { class: "header__dropdown-avatar" }, It = { class: "header__dropdown-info" }, Lt = { class: "header__dropdown-name" }, St = { class: "header__dropdown-role" }, $t = /* @__PURE__ */ D({
745
+ __name: "Header",
746
+ setup(e) {
747
+ const s = ee(), { logout: t, userName: n, userInfo: o } = te(), d = w(!1), a = w(null), r = w(!1), h = b(() => n.value || "用户"), y = () => {
748
+ s.toggleCollapse();
749
+ }, f = () => {
750
+ s.toggleTheme();
751
+ }, u = () => {
752
+ document.fullscreenElement ? document.exitFullscreen() : document.documentElement.requestFullscreen();
753
+ }, p = () => {
754
+ r.value = !!document.fullscreenElement;
755
+ }, C = () => {
756
+ d.value = !d.value;
757
+ }, l = () => {
758
+ d.value = !1;
759
+ }, I = async () => {
760
+ l(), await t();
761
+ }, i = (v) => {
762
+ a.value && !a.value.contains(v.target) && l();
763
+ };
764
+ return Ie(() => {
765
+ document.addEventListener("click", i), document.addEventListener("fullscreenchange", p);
766
+ }), Le(() => {
767
+ document.removeEventListener("click", i), document.removeEventListener("fullscreenchange", p);
768
+ }), (v, m) => (k(), L("div", ht, [
769
+ c("div", { class: "header__left" }, [
770
+ c("div", {
771
+ class: "header__collapse",
772
+ onClick: y
773
+ }, [...m[0] || (m[0] = [
774
+ c("span", null, "☰", -1)
775
+ ])])
776
+ ]),
777
+ c("div", pt, [
778
+ c("div", {
779
+ class: "header__action",
780
+ onClick: u,
781
+ title: r.value ? "退出全屏" : "全屏"
782
+ }, [
783
+ r.value ? (k(), L("svg", mt, [...m[1] || (m[1] = [
784
+ c("path", { d: "M5 16h3v3h2v-5H5v2zm3-8H5v2h5V5H8v3zm6 11h2v-3h3v-2h-5v5zm2-11V5h-2v5h5V8h-3z" }, null, -1)
785
+ ])])) : (k(), L("svg", ft, [...m[2] || (m[2] = [
786
+ c("path", { d: "M7 14H5v5h5v-2H7v-3zm-2-4h2V7h3V5H5v5zm12 7h-3v2h5v-5h-2v3zM14 5v2h3v3h2V5h-5z" }, null, -1)
787
+ ])]))
788
+ ], 8, _t),
789
+ c("div", {
790
+ class: "header__action",
791
+ onClick: f,
792
+ title: "切换主题"
793
+ }, [
794
+ _(s).isDark ? (k(), L("span", vt, "🌙")) : (k(), L("span", gt, "☀️"))
795
+ ]),
796
+ c("div", {
797
+ class: "header__user",
798
+ ref_key: "dropdownRef",
799
+ ref: a
800
+ }, [
801
+ c("div", {
802
+ class: "header__user-trigger",
803
+ onClick: Se(C, ["stop"])
804
+ }, [
805
+ c("div", yt, [
806
+ c("span", null, x(h.value.charAt(0)), 1)
807
+ ]),
808
+ c("span", wt, x(h.value), 1),
809
+ c("span", {
810
+ class: $e(["header__user-arrow", { "is-active": d.value }])
811
+ }, "▼", 2)
812
+ ]),
813
+ T(xe, { name: "dropdown" }, {
814
+ default: E(() => {
815
+ var S;
816
+ return [
817
+ d.value ? (k(), L("div", bt, [
818
+ c("div", Ct, [
819
+ c("div", kt, [
820
+ c("span", null, x(h.value.charAt(0)), 1)
821
+ ]),
822
+ c("div", It, [
823
+ c("div", Lt, x(h.value), 1),
824
+ c("div", St, x(((S = _(o)) == null ? void 0 : S.departmentName) || ""), 1)
825
+ ])
826
+ ]),
827
+ m[4] || (m[4] = c("div", { class: "header__dropdown-divider" }, null, -1)),
828
+ c("div", { class: "header__dropdown-menu" }, [
829
+ c("div", {
830
+ class: "header__dropdown-item header__dropdown-item--danger",
831
+ onClick: I
832
+ }, [...m[3] || (m[3] = [
833
+ c("span", { class: "header__dropdown-icon" }, "🚪", -1),
834
+ c("span", null, "退出登录", -1)
835
+ ])])
836
+ ])
837
+ ])) : V("", !0)
838
+ ];
839
+ }),
840
+ _: 1
841
+ })
842
+ ], 512)
843
+ ])
844
+ ]));
845
+ }
846
+ }), xt = /* @__PURE__ */ M($t, [["__scopeId", "data-v-2bf8f3d2"]]), Tt = { class: "layout" }, Et = { class: "layout__main" }, Ut = { class: "layout__content" }, Nt = /* @__PURE__ */ D({
847
+ __name: "index",
848
+ setup(e) {
849
+ const s = ee(), t = b(
850
+ () => s.isCollapsed ? "64px" : "210px"
851
+ );
852
+ return (n, o) => {
853
+ const d = Te("router-view");
854
+ return k(), L("div", Tt, [
855
+ c("aside", {
856
+ class: "layout__aside",
857
+ style: Ee({ width: t.value })
858
+ }, [
859
+ T(dt)
860
+ ], 4),
861
+ c("div", Et, [
862
+ T(xt, { class: "layout__header" }),
863
+ c("main", Ut, [
864
+ T(d)
865
+ ])
866
+ ])
867
+ ]);
868
+ };
869
+ }
870
+ }), Pt = /* @__PURE__ */ M(Nt, [["__scopeId", "data-v-1a24e6d0"]]), Rt = {}, Mt = { class: "tabs-wrapper" };
871
+ function At(e, s) {
872
+ return k(), L("div", Mt);
873
+ }
874
+ const bs = /* @__PURE__ */ M(Rt, [["render", At], ["__scopeId", "data-v-3b1e382a"]]), Bt = {}, Ft = { class: "footer" };
875
+ function Dt(e, s) {
876
+ return k(), L("div", Ft, [...s[0] || (s[0] = [
877
+ c("span", null, "Copyright © 2024 Xto Demo. All Rights Reserved.", -1)
878
+ ])]);
879
+ }
880
+ const Cs = /* @__PURE__ */ M(Bt, [["render", Dt], ["__scopeId", "data-v-317ae311"]]), Vt = { class: "login" }, Ot = { class: "login__container" }, zt = { class: "login__header" }, Kt = ["src"], qt = { class: "login__title" }, Ht = { class: "login__subtitle" }, Wt = /* @__PURE__ */ D({
881
+ __name: "index",
882
+ props: {
883
+ logo: {},
884
+ title: {},
885
+ subtitle: {}
886
+ },
887
+ emits: ["success", "error"],
888
+ setup(e, { emit: s }) {
889
+ const t = s, { login: n, loading: o } = te(), d = P(), a = ae({
890
+ uid: "",
891
+ password: ""
892
+ }), r = {
893
+ uid: [
894
+ { required: !0, message: "请输入账号", trigger: "blur" }
895
+ ],
896
+ password: [
897
+ { required: !0, message: "请输入密码", trigger: "blur" }
898
+ ]
899
+ }, h = w(), y = async () => {
900
+ var f;
901
+ try {
902
+ await ((f = h.value) == null ? void 0 : f.validate());
903
+ const u = await n(a.uid, a.password);
904
+ u.success ? t("success", u.data) : t("error", u.error);
905
+ } catch (u) {
906
+ console.error("登录失败", u), t("error", u);
907
+ }
908
+ };
909
+ return (f, u) => (k(), L("div", Vt, [
910
+ c("div", Ot, [
911
+ c("div", zt, [
912
+ c("img", {
913
+ src: e.logo || "/vite.svg",
914
+ alt: "Logo",
915
+ class: "login__logo"
916
+ }, null, 8, Kt),
917
+ c("h1", qt, x(e.title || _(d).appName), 1),
918
+ c("p", Ht, x(e.subtitle || "后台管理系统"), 1)
919
+ ]),
920
+ T(_(Re), {
921
+ ref_key: "formRef",
922
+ ref: h,
923
+ model: a,
924
+ rules: r,
925
+ class: "login__form",
926
+ "label-width": "0"
927
+ }, {
928
+ default: E(() => [
929
+ T(_(oe), { prop: "uid" }, {
930
+ default: E(() => [
931
+ T(_(re), {
932
+ modelValue: a.uid,
933
+ "onUpdate:modelValue": u[0] || (u[0] = (p) => a.uid = p),
934
+ placeholder: "请输入账号",
935
+ size: "large"
936
+ }, null, 8, ["modelValue"])
937
+ ]),
938
+ _: 1
939
+ }),
940
+ T(_(oe), { prop: "password" }, {
941
+ default: E(() => [
942
+ T(_(re), {
943
+ modelValue: a.password,
944
+ "onUpdate:modelValue": u[1] || (u[1] = (p) => a.password = p),
945
+ type: "password",
946
+ placeholder: "请输入密码",
947
+ size: "large",
948
+ "show-password": "",
949
+ onKeyup: Ue(y, ["enter"])
950
+ }, null, 8, ["modelValue"])
951
+ ]),
952
+ _: 1
953
+ }),
954
+ T(_(oe), null, {
955
+ default: E(() => [
956
+ T(_(Z), {
957
+ type: "primary",
958
+ size: "large",
959
+ loading: _(o),
960
+ class: "login__submit",
961
+ onClick: y
962
+ }, {
963
+ default: E(() => [...u[2] || (u[2] = [
964
+ X(" 登录 ", -1)
965
+ ])]),
966
+ _: 1
967
+ }, 8, ["loading"])
968
+ ]),
969
+ _: 1
970
+ })
971
+ ]),
972
+ _: 1
973
+ }, 8, ["model"])
974
+ ])
975
+ ]));
976
+ }
977
+ }), ks = /* @__PURE__ */ M(Wt, [["__scopeId", "data-v-fdb37509"]]), jt = { class: "error-page" }, Yt = { class: "error-page__content" }, Xt = /* @__PURE__ */ D({
978
+ __name: "404",
979
+ setup(e) {
980
+ const s = Q(), t = () => {
981
+ s.push("/");
982
+ };
983
+ return (n, o) => (k(), L("div", jt, [
984
+ c("div", Yt, [
985
+ o[1] || (o[1] = c("div", { class: "error-page__code" }, "404", -1)),
986
+ o[2] || (o[2] = c("div", { class: "error-page__title" }, "页面不存在", -1)),
987
+ o[3] || (o[3] = c("div", { class: "error-page__desc" }, "抱歉,您访问的页面不存在或已被删除", -1)),
988
+ T(_(Z), {
989
+ type: "primary",
990
+ onClick: t
991
+ }, {
992
+ default: E(() => [...o[0] || (o[0] = [
993
+ X("返回首页", -1)
994
+ ])]),
995
+ _: 1
996
+ })
997
+ ])
998
+ ]));
999
+ }
1000
+ }), Is = /* @__PURE__ */ M(Xt, [["__scopeId", "data-v-6fc8a81b"]]), Jt = { class: "error-page" }, Qt = { class: "error-page__content" }, Zt = /* @__PURE__ */ D({
1001
+ __name: "403",
1002
+ setup(e) {
1003
+ const s = Q(), t = () => {
1004
+ s.push("/");
1005
+ };
1006
+ return (n, o) => (k(), L("div", Jt, [
1007
+ c("div", Qt, [
1008
+ o[1] || (o[1] = c("div", { class: "error-page__code" }, "403", -1)),
1009
+ o[2] || (o[2] = c("div", { class: "error-page__title" }, "无访问权限", -1)),
1010
+ o[3] || (o[3] = c("div", { class: "error-page__desc" }, "抱歉,您没有权限访问此页面", -1)),
1011
+ T(_(Z), {
1012
+ type: "primary",
1013
+ onClick: t
1014
+ }, {
1015
+ default: E(() => [...o[0] || (o[0] = [
1016
+ X("返回首页", -1)
1017
+ ])]),
1018
+ _: 1
1019
+ })
1020
+ ])
1021
+ ]));
1022
+ }
1023
+ }), Ls = /* @__PURE__ */ M(Zt, [["__scopeId", "data-v-f9466667"]]);
1024
+ function Ss(e) {
1025
+ const s = K(), t = window.location.pathname, o = (s.menuBtnListMap[t] || []).map((d) => d.code);
1026
+ return Array.isArray(e) ? e.some((d) => o.includes(d)) : o.includes(e);
1027
+ }
1028
+ function $s() {
1029
+ return !0;
1030
+ }
1031
+ const Gt = ["/login", "/404", "/403"];
1032
+ function xs(e, s) {
1033
+ const t = P(), n = de({
1034
+ history: he((s == null ? void 0 : s.base) || ""),
1035
+ routes: e,
1036
+ scrollBehavior: (s == null ? void 0 : s.scrollBehavior) || (() => ({ left: 0, top: 0 }))
1037
+ });
1038
+ return n.beforeEach(async (o, d, a) => {
1039
+ const r = ee();
1040
+ if (r.initTheme(), fe())
1041
+ if (o.path === t.loginPath)
1042
+ a({ path: t.indexPath || "/" });
1043
+ else {
1044
+ const { initApp: h, isLoggedIn: y } = te();
1045
+ if (!y.value && !await h()) {
1046
+ a(t.loginPath || "/login");
1047
+ return;
1048
+ }
1049
+ o.name && o.meta.keepAlive && r.addCachedView(o.name), a();
1050
+ }
1051
+ else
1052
+ Gt.includes(o.path) ? a() : a({
1053
+ path: t.loginPath || "/login",
1054
+ query: { redirectUrl: encodeURIComponent(o.fullPath) }
1055
+ });
1056
+ }), n;
1057
+ }
1058
+ function Ts(e, s) {
1059
+ const t = de({
1060
+ history: he(),
1061
+ routes: s
1062
+ });
1063
+ e.matcher = t.matcher;
1064
+ }
1065
+ function Es(e) {
1066
+ const s = P();
1067
+ return [
1068
+ {
1069
+ path: (e == null ? void 0 : e.loginPath) || s.loginPath || "/login",
1070
+ name: "Login",
1071
+ component: e == null ? void 0 : e.loginComponent,
1072
+ meta: {
1073
+ title: "登录",
1074
+ hidden: !0
1075
+ }
1076
+ },
1077
+ {
1078
+ path: "/404",
1079
+ name: "NotFound",
1080
+ component: e == null ? void 0 : e.notFoundComponent,
1081
+ meta: {
1082
+ title: "404",
1083
+ hidden: !0
1084
+ }
1085
+ },
1086
+ {
1087
+ path: "/403",
1088
+ name: "Forbidden",
1089
+ component: e == null ? void 0 : e.forbiddenComponent,
1090
+ meta: {
1091
+ title: "403",
1092
+ hidden: !0
1093
+ }
1094
+ },
1095
+ {
1096
+ path: "/:pathMatch(.*)*",
1097
+ redirect: "/404",
1098
+ meta: {
1099
+ hidden: !0
1100
+ }
1101
+ }
1102
+ ];
1103
+ }
1104
+ function Us(e, s = {}) {
1105
+ const t = s.indexPath || "/dashboard";
1106
+ return {
1107
+ path: "/",
1108
+ name: "Layout",
1109
+ component: s.layoutComponent || Pt,
1110
+ redirect: t,
1111
+ children: e
1112
+ };
1113
+ }
1114
+ function Ns(e = {}) {
1115
+ return [
1116
+ {
1117
+ path: "/404",
1118
+ name: "NotFound",
1119
+ component: e.notFoundComponent,
1120
+ meta: {
1121
+ title: "404",
1122
+ hidden: !0
1123
+ }
1124
+ },
1125
+ {
1126
+ path: "/403",
1127
+ name: "Forbidden",
1128
+ component: e.forbiddenComponent,
1129
+ meta: {
1130
+ title: "403",
1131
+ hidden: !0
1132
+ }
1133
+ },
1134
+ {
1135
+ path: "/:pathMatch(.*)*",
1136
+ redirect: "/404",
1137
+ meta: {
1138
+ hidden: !0
1139
+ }
1140
+ }
1141
+ ];
1142
+ }
1143
+ var es = /* @__PURE__ */ ((e) => (e[e.ENABLED = 1] = "ENABLED", e[e.DISABLED = 0] = "DISABLED", e))(es || {}), ts = /* @__PURE__ */ ((e) => (e[e.UNKNOWN = 0] = "UNKNOWN", e[e.MALE = 1] = "MALE", e[e.FEMALE = 2] = "FEMALE", e))(ts || {}), ss = /* @__PURE__ */ ((e) => (e[e.DIRECTORY = 0] = "DIRECTORY", e[e.MENU = 1] = "MENU", e[e.BUTTON = 2] = "BUTTON", e))(ss || {});
1144
+ const Ps = {
1145
+ 1: "启用",
1146
+ 0: "禁用"
1147
+ }, Rs = {
1148
+ 0: "未知",
1149
+ 1: "男",
1150
+ 2: "女"
1151
+ }, Ms = {
1152
+ 0: "目录",
1153
+ 1: "菜单",
1154
+ 2: "按钮"
1155
+ }, As = [
1156
+ {
1157
+ label: "启用",
1158
+ value: 1
1159
+ /* ENABLED */
1160
+ },
1161
+ {
1162
+ label: "禁用",
1163
+ value: 0
1164
+ /* DISABLED */
1165
+ }
1166
+ ], Bs = [
1167
+ {
1168
+ label: "未知",
1169
+ value: 0
1170
+ /* UNKNOWN */
1171
+ },
1172
+ {
1173
+ label: "男",
1174
+ value: 1
1175
+ /* MALE */
1176
+ },
1177
+ {
1178
+ label: "女",
1179
+ value: 2
1180
+ /* FEMALE */
1181
+ }
1182
+ ], Fs = [
1183
+ {
1184
+ label: "目录",
1185
+ value: 0
1186
+ /* DIRECTORY */
1187
+ },
1188
+ {
1189
+ label: "菜单",
1190
+ value: 1
1191
+ /* MENU */
1192
+ },
1193
+ {
1194
+ label: "按钮",
1195
+ value: 2
1196
+ /* BUTTON */
1197
+ }
1198
+ ], Ds = {
1199
+ mounted(e, s) {
1200
+ var h;
1201
+ const t = K(), { value: n } = s;
1202
+ if (!n) return;
1203
+ const o = window.location.pathname, a = (t.menuBtnListMap[o] || []).map((y) => y.code);
1204
+ let r = !1;
1205
+ Array.isArray(n) ? r = n.some((y) => a.includes(y)) : r = a.includes(n), r || (h = e.parentNode) == null || h.removeChild(e);
1206
+ }
1207
+ };
1208
+ function Vs(e) {
1209
+ return Ae(e), Ve(), {
1210
+ config: P()
1211
+ };
1212
+ }
2
1213
  export {
3
- a as Footer,
4
- t as Gender,
5
- o as GenderOptions,
6
- r as GenderText,
7
- n as Header,
8
- u as Layout,
9
- i as MenuType,
10
- p as MenuTypeOptions,
11
- g as MenuTypeText,
12
- l as Sidebar,
13
- T as Status,
14
- S as StatusOptions,
15
- d as StatusText,
16
- c as Tabs,
17
- f as appConfig,
18
- y as clearToken,
19
- U as clearUserInfo,
20
- m as defaultDynamicRoutes,
21
- M as errorRoute,
22
- h as getCode,
23
- k as getCurrentUser,
24
- A as getLoginInfo,
25
- I as getToken,
26
- R as getTokenType,
27
- x as getUserInfo,
28
- C as getUserMenu,
29
- b as hasPermission,
30
- D as hasToken,
31
- G as http,
32
- L as isAdmin,
33
- O as layoutRoute,
34
- F as local,
35
- v as localStorageUtil,
36
- B as login,
37
- H as loginByCode,
38
- P as logout,
39
- j as mockMenuData,
40
- q as permissionDirective,
41
- w as resetRouter,
42
- z as router,
43
- E as session,
44
- J as sessionStorageUtil,
45
- K as setLoginInfo,
46
- N as setUserInfo,
47
- Q as staticRoutes,
48
- V as useApp,
49
- W as useAppStore,
50
- X as useAuth,
51
- Y as useAuthStore,
52
- Z as useForm,
53
- $ as useMenu,
54
- _ as useMenuStore,
55
- ss as useTable,
56
- es as useUserStore
1214
+ Cs as Footer,
1215
+ Ls as Forbidden,
1216
+ ts as Gender,
1217
+ Bs as GenderOptions,
1218
+ Rs as GenderText,
1219
+ xt as Header,
1220
+ Pt as Layout,
1221
+ ks as Login,
1222
+ ss as MenuType,
1223
+ Fs as MenuTypeOptions,
1224
+ Ms as MenuTypeText,
1225
+ Is as NotFound,
1226
+ dt as Sidebar,
1227
+ es as Status,
1228
+ As as StatusOptions,
1229
+ Ps as StatusText,
1230
+ bs as Tabs,
1231
+ me as clearToken,
1232
+ fs as clearUserInfo,
1233
+ Ns as createErrorRoutes,
1234
+ Us as createLayoutRoute,
1235
+ xs as createRouter,
1236
+ Es as createStaticRoutes,
1237
+ Vs as createXtoApp,
1238
+ ps as getCode,
1239
+ P as getConfig,
1240
+ ds as getConfigValue,
1241
+ qe as getCurrentUser,
1242
+ O as getLoginInfo,
1243
+ B as getRequest,
1244
+ _e as getToken,
1245
+ Fe as getTokenType,
1246
+ ms as getUserInfo,
1247
+ He as getUserMenu,
1248
+ Ss as hasPermission,
1249
+ fe as hasToken,
1250
+ z as http,
1251
+ $s as isAdmin,
1252
+ g as local,
1253
+ W as localStorageUtil,
1254
+ ze as login,
1255
+ vs as loginByCode,
1256
+ Ke as logout,
1257
+ Ds as permissionDirective,
1258
+ Ve as resetRequest,
1259
+ Ts as resetRouter,
1260
+ hs as session,
1261
+ j as sessionStorageUtil,
1262
+ Ae as setConfig,
1263
+ Be as setLoginInfo,
1264
+ _s as setUserInfo,
1265
+ te as useApp,
1266
+ ee as useAppStore,
1267
+ gs as useAuth,
1268
+ ve as useAuthStore,
1269
+ ys as useForm,
1270
+ je as useMenu,
1271
+ K as useMenuStore,
1272
+ ws as useTable,
1273
+ ge as useUserStore
57
1274
  };