xto-fronted 0.4.6 → 0.4.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 (160) hide show
  1. package/.env.development +7 -7
  2. package/.env.production +7 -7
  3. package/dist/assets/403-AFBQifUI.js +1 -0
  4. package/dist/assets/403-BHEXXbt2.css +1 -0
  5. package/dist/assets/404-Ct_A1n7S.css +1 -0
  6. package/dist/assets/404-WFvpcD2_.js +1 -0
  7. package/dist/assets/_plugin-vue_export-helper-DlAUqK2U.js +1 -0
  8. package/dist/assets/index-1juADvYN.js +2 -0
  9. package/dist/assets/index-B-sX4Ru0.js +1 -0
  10. package/dist/assets/index-BMcziU5a.css +1 -0
  11. package/dist/assets/index-BRR97dc6.js +1 -0
  12. package/dist/assets/index-BZA0ksjx.css +1 -0
  13. package/dist/assets/index-BpV_8nl0.js +1 -0
  14. package/dist/assets/index-BvzhR4zp.js +1 -0
  15. package/dist/assets/index-CUh_s55Z.css +1 -0
  16. package/dist/assets/index-CVjdnIgR.css +1 -0
  17. package/dist/assets/index-CYq57-zj.js +1 -0
  18. package/dist/assets/index-CkL3sVAQ.js +2 -0
  19. package/dist/assets/index-CtrKVYJb.css +1 -0
  20. package/dist/assets/index-Cz2P_bsS.js +1 -0
  21. package/dist/assets/index-D9wlAuR_.js +1 -0
  22. package/dist/assets/index-DawJb02s.css +1 -0
  23. package/dist/assets/index-DfFR6NLf.js +1 -0
  24. package/dist/assets/index-DwVgMO8e.js +1 -0
  25. package/dist/assets/index-GDP-IkXE.css +1 -0
  26. package/dist/assets/index-Iaz1ZzPC.js +2 -0
  27. package/dist/assets/index-PfV8pzQz.css +1 -0
  28. package/dist/assets/index-Swfu6yvD.css +1 -0
  29. package/dist/assets/index-Te8_PRgJ.js +1 -0
  30. package/dist/assets/index-WyZ91RLx.css +1 -0
  31. package/dist/assets/index-tFYRoFdE.js +1 -0
  32. package/dist/assets/vendor-42ANG6Sg.js +6 -0
  33. package/dist/assets/vite-Dw-pgLOX.js +1 -0
  34. package/dist/assets/vue-vendor-Br-l7wbK.js +29 -0
  35. package/dist/assets/xto-base-C-IBqjVs.js +1 -0
  36. package/dist/assets/xto-base-C6eqMPdO.css +1 -0
  37. package/dist/assets/xto-business--V1F5Gwb.css +1 -0
  38. package/dist/assets/xto-core-DZK7Cyg0.js +1 -0
  39. package/dist/assets/xto-data-BFpiDgJi.js +1 -0
  40. package/dist/assets/xto-data-CnAQAQH2.css +1 -0
  41. package/dist/assets/xto-feedback-B7ipsTfz.js +1 -0
  42. package/dist/assets/xto-feedback-DBwJzoTj.css +1 -0
  43. package/dist/assets/xto-form-CrsyAjyr.css +1 -0
  44. package/dist/assets/xto-form-NRjKKNcY.js +1 -0
  45. package/dist/assets/xto-layout-BqU8RuWL.css +1 -0
  46. package/dist/assets/xto-navigation-BiSaXPfr.js +1 -0
  47. package/dist/assets/xto-navigation-C1cnSL2E.css +1 -0
  48. package/dist/assets/xto-navigation-CBPg4dCc.css +1 -0
  49. package/dist/assets/xto-navigation-CKabFu9d.js +1 -0
  50. package/dist/index-54irhCHL.js +1830 -0
  51. package/dist/{index-15Bu0M8D.js → index-BzRf1eoJ.js} +1 -1
  52. package/dist/{index-BO2Zf9u6.js → index-DH4aoCZb.js} +1 -1
  53. package/dist/{index-BBqvHkzE.js → index-Kqa7iZ9E.js} +1 -1
  54. package/dist/{index-BQqo0ZIb.js → index-pxkZlvBw.js} +1 -1
  55. package/dist/index.es.js +1 -1
  56. package/dist/index.html +28 -0
  57. package/dist/index.umd.js +1 -1
  58. package/dist/style.css +1 -1
  59. package/package.json +85 -86
  60. package/src/api/auth.ts +25 -25
  61. package/src/api/system.ts +66 -66
  62. package/src/assets/styles/_dark.scss +406 -406
  63. package/src/components/Layout/Header.vue +973 -973
  64. package/src/components/Layout/Sidebar.vue +273 -212
  65. package/src/components/Layout/index.vue +443 -63
  66. package/src/composables/useApp.ts +61 -61
  67. package/src/composables/useAuth.ts +16 -16
  68. package/src/directives/permission.ts +27 -27
  69. package/src/env.d.ts +18 -18
  70. package/src/index.ts +47 -47
  71. package/src/router/dynamicRoutes.ts +162 -162
  72. package/src/router/guards.ts +128 -128
  73. package/src/router/index.ts +79 -79
  74. package/src/stores/auth.ts +65 -65
  75. package/src/stores/menu.ts +48 -48
  76. package/src/stores/user.ts +50 -50
  77. package/src/types/api.d.ts +80 -80
  78. package/src/utils/auth.ts +99 -99
  79. package/src/utils/config.ts +80 -80
  80. package/src/utils/permission.ts +32 -32
  81. package/src/utils/request.ts +124 -124
  82. package/src/views/login/index.vue +194 -188
  83. package/vite.config.ts +135 -135
  84. package/dist/index-B3PLzNB0.js +0 -345
  85. package/dist/index-B6DTsC6l.js +0 -1715
  86. package/dist/index-B7etKk33.js +0 -372
  87. package/dist/index-B7mpL6Zf.js +0 -475
  88. package/dist/index-BC2PGkkJ.js +0 -1644
  89. package/dist/index-BGgbfcmf.js +0 -475
  90. package/dist/index-BGmUwemj.js +0 -372
  91. package/dist/index-BQFfQj5Q.js +0 -142
  92. package/dist/index-BkRneTya.js +0 -142
  93. package/dist/index-BlRrngsc.js +0 -475
  94. package/dist/index-BmVvM7sm.js +0 -345
  95. package/dist/index-Bn4ThpX9.js +0 -142
  96. package/dist/index-BwfjwDKr.js +0 -1477
  97. package/dist/index-BxIL2hrt.js +0 -475
  98. package/dist/index-C-3fhbN2.js +0 -1644
  99. package/dist/index-C0VN9nFF.js +0 -142
  100. package/dist/index-C0xyGOsz.js +0 -475
  101. package/dist/index-C3c8NAZq.js +0 -1477
  102. package/dist/index-C42VtP71.js +0 -142
  103. package/dist/index-C6Nm0r9k.js +0 -475
  104. package/dist/index-C6w0-8xN.js +0 -1648
  105. package/dist/index-CD364XjV.js +0 -142
  106. package/dist/index-CHww99-i.js +0 -345
  107. package/dist/index-CIgWYERJ.js +0 -1644
  108. package/dist/index-CTs6DTuQ.js +0 -345
  109. package/dist/index-CWRs4WMN.js +0 -372
  110. package/dist/index-Cb-SxHJp.js +0 -345
  111. package/dist/index-CeCysOnl.js +0 -345
  112. package/dist/index-Cg1UpC8D.js +0 -1644
  113. package/dist/index-Cgkqpyx2.js +0 -345
  114. package/dist/index-CiuDEfo-.js +0 -142
  115. package/dist/index-CmQfZC8r.js +0 -372
  116. package/dist/index-CmkjhpX_.js +0 -475
  117. package/dist/index-CpxpXTQX.js +0 -1462
  118. package/dist/index-CqXFk_ET.js +0 -345
  119. package/dist/index-Cqix1YLE.js +0 -1697
  120. package/dist/index-CtvB5J9E.js +0 -372
  121. package/dist/index-Cu3Z2-PY.js +0 -345
  122. package/dist/index-CvDxK7Ab.js +0 -372
  123. package/dist/index-D-FER0vJ.js +0 -372
  124. package/dist/index-D2fQ8TK8.js +0 -475
  125. package/dist/index-D3xVcFvg.js +0 -372
  126. package/dist/index-D4crnrO6.js +0 -142
  127. package/dist/index-D7EzwTM5.js +0 -372
  128. package/dist/index-D7TZamyY.js +0 -1664
  129. package/dist/index-D88fiqXR.js +0 -475
  130. package/dist/index-DEbpF-M4.js +0 -1457
  131. package/dist/index-DFXuyPge.js +0 -1627
  132. package/dist/index-DLgimJYb.js +0 -1667
  133. package/dist/index-DPEVEyik.js +0 -475
  134. package/dist/index-DWy_UGhI.js +0 -345
  135. package/dist/index-DYVtddfw.js +0 -142
  136. package/dist/index-DYnXaqYf.js +0 -142
  137. package/dist/index-DcvRPHuy.js +0 -372
  138. package/dist/index-DdC1uV2v.js +0 -1700
  139. package/dist/index-Dga14ZN7.js +0 -1774
  140. package/dist/index-Dk2V44uP.js +0 -372
  141. package/dist/index-DnJ481u1.js +0 -475
  142. package/dist/index-Do1CBqg8.js +0 -345
  143. package/dist/index-DqQRSPeF.js +0 -345
  144. package/dist/index-Jb4VMHIS.js +0 -142
  145. package/dist/index-MC3wWjNt.js +0 -475
  146. package/dist/index-MG0JePmx.js +0 -142
  147. package/dist/index-PRFGBLWt.js +0 -475
  148. package/dist/index-QgkT42dc.js +0 -372
  149. package/dist/index-TrLCW5xL.js +0 -372
  150. package/dist/index-YDlNLFVk.js +0 -142
  151. package/dist/index-ZAJgA3XD.js +0 -475
  152. package/dist/index-a_ilWAvi.js +0 -345
  153. package/dist/index-bi1TMGid.js +0 -372
  154. package/dist/index-fyarVCog.js +0 -475
  155. package/dist/index-mnTZtPFa.js +0 -345
  156. package/dist/index-orZCyV6I.js +0 -345
  157. package/dist/index-p3TbK44c.js +0 -142
  158. package/dist/index-sRwZYbZ4.js +0 -372
  159. package/dist/index-wATqKEcF.js +0 -142
  160. package/dist/setup.d.ts +0 -17
@@ -1,1774 +0,0 @@
1
- import { ref as _, computed as f, watch as We, defineComponent as X, openBlock as h, createElementBlock as m, normalizeClass as Y, createElementVNode as t, withDirectives as Re, toDisplayString as S, unref as g, vShow as Ye, createCommentVNode as R, createVNode as C, Fragment as V, renderList as q, withCtx as z, createBlock as ie, createTextVNode as Q, onMounted as Xe, onUnmounted as Je, withModifiers as _e, Transition as me, normalizeStyle as fe, withKeys as De, vModelText as Qe, resolveComponent as Ze, reactive as ye } from "vue";
2
- import { defineStore as ue } from "pinia";
3
- import { createRouter as ke, createWebHistory as be, useRoute as we, useRouter as Z } from "vue-router";
4
- import { Menu as Ge, SubMenu as et, MenuItem as Ae, Tabs as tt, TabPane as st } from "@xto/navigation";
5
- import { Button as ce } from "@xto/base";
6
- import { Input as ge, Form as ot, FormItem as ae, Checkbox as at } from "@xto/form";
7
- import { Message as K } from "@xto/feedback";
8
- import nt from "axios";
9
- const Ce = "/vite.svg", te = "xto_", Ue = (e) => ({
10
- get(o) {
11
- const s = e.getItem(te + o);
12
- if (!s) return null;
13
- try {
14
- return JSON.parse(s);
15
- } catch {
16
- return s;
17
- }
18
- },
19
- set(o, s) {
20
- if (s == null) {
21
- e.removeItem(te + o);
22
- return;
23
- }
24
- const a = typeof s == "string" ? s : JSON.stringify(s);
25
- e.setItem(te + o, a);
26
- },
27
- remove(o) {
28
- e.removeItem(te + o);
29
- },
30
- clear() {
31
- Object.keys(e).forEach((s) => {
32
- s.startsWith(te) && e.removeItem(s);
33
- });
34
- }
35
- }), ne = Ue(window.localStorage), re = Ue(window.sessionStorage), v = {
36
- get: ne.get,
37
- set: ne.set,
38
- remove: ne.remove,
39
- clear: ne.clear
40
- }, vo = {
41
- get: re.get,
42
- set: re.set,
43
- remove: re.remove,
44
- clear: re.clear
45
- }, oe = ue("app", () => {
46
- const e = _(v.get("appName") || "XTO App"), o = _(v.get("indexPath") || "/dashboard"), s = _(v.get("isDark") || !1), a = _(v.get("theme") || "light"), r = _(v.get("layout") || "sidebar"), c = _(v.get("isCollapsed") || !1), d = _(v.get("showTabs") ?? !0), n = _(v.get("showFooter") ?? !0), i = _(v.get("showBreadcrumb") ?? !0), u = _(v.get("primaryColor") || "#409eff"), b = _([]), T = f(() => s.value ? "dark" : "light"), l = (k) => {
47
- e.value = k, v.set("appName", k);
48
- }, M = (k) => {
49
- o.value = k, v.set("indexPath", k);
50
- }, A = () => {
51
- s.value = !s.value, a.value = s.value ? "dark" : "light", E();
52
- }, D = (k) => {
53
- a.value = k, s.value = k === "dark", E();
54
- }, E = () => {
55
- const k = document.documentElement;
56
- s.value ? k.classList.add("dark") : k.classList.remove("dark"), v.set("isDark", s.value), v.set("theme", a.value);
57
- }, P = () => {
58
- c.value = !c.value, v.set("isCollapsed", c.value);
59
- }, H = (k) => {
60
- r.value = k, v.set("layout", k);
61
- }, G = () => {
62
- d.value = !d.value, v.set("showTabs", d.value);
63
- }, F = () => {
64
- n.value = !n.value, v.set("showFooter", n.value);
65
- }, O = () => {
66
- i.value = !i.value, v.set("showBreadcrumb", i.value);
67
- }, ee = (k) => {
68
- u.value = k, document.documentElement.style.setProperty("--color-primary", k), v.set("primaryColor", k);
69
- }, $ = (k) => {
70
- b.value.includes(k) || b.value.push(k);
71
- }, I = (k) => {
72
- const j = b.value.indexOf(k);
73
- j > -1 && b.value.splice(j, 1);
74
- }, U = () => {
75
- b.value = [];
76
- }, w = () => {
77
- E(), u.value !== "#409eff" && document.documentElement.style.setProperty("--color-primary", u.value);
78
- };
79
- return We(s, E), {
80
- appName: e,
81
- indexPath: o,
82
- isDark: s,
83
- theme: a,
84
- layout: r,
85
- isCollapsed: c,
86
- showTabs: d,
87
- showFooter: n,
88
- showBreadcrumb: i,
89
- primaryColor: u,
90
- cachedViews: b,
91
- themeClass: T,
92
- setAppName: l,
93
- setIndexPath: M,
94
- toggleTheme: A,
95
- toggleCollapse: P,
96
- setTheme: D,
97
- setLayout: H,
98
- toggleTabs: G,
99
- toggleFooter: F,
100
- toggleBreadcrumb: O,
101
- setPrimaryColor: ee,
102
- addCachedView: $,
103
- removeCachedView: I,
104
- clearCachedViews: U,
105
- initTheme: w
106
- };
107
- }), rt = (e, o, s) => {
108
- const a = e[o];
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: " + o + (o.split("/").length !== s ? ". Note that variables only represent file names one level deep." : "")
115
- )
116
- )
117
- );
118
- });
119
- }, Ve = [
120
- {
121
- path: "/login",
122
- name: "Login",
123
- component: () => Promise.resolve().then(() => Fs),
124
- meta: {
125
- title: "登录",
126
- hidden: !0
127
- }
128
- },
129
- {
130
- path: "/404",
131
- name: "NotFound",
132
- component: () => Promise.resolve().then(() => Ys),
133
- meta: {
134
- title: "404",
135
- hidden: !0
136
- }
137
- },
138
- {
139
- path: "/403",
140
- name: "Forbidden",
141
- component: () => Promise.resolve().then(() => Gs),
142
- meta: {
143
- title: "403",
144
- hidden: !0
145
- }
146
- }
147
- ], Pe = {
148
- path: "/:pathMatch(.*)*",
149
- redirect: "/404",
150
- meta: {
151
- hidden: !0
152
- }
153
- }, Oe = {
154
- path: "/",
155
- name: "Layout",
156
- component: () => Promise.resolve().then(() => Es),
157
- redirect: "/dashboard",
158
- children: [
159
- {
160
- path: "/dashboard",
161
- name: "Dashboard",
162
- component: () => import("./index-Bn4ThpX9.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-CmQfZC8r.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-orZCyV6I.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-fyarVCog.js"),
194
- meta: {
195
- title: "菜单管理",
196
- icon: "menu",
197
- keepAlive: !0
198
- }
199
- }
200
- ]
201
- }, _o = [
202
- {
203
- path: "/dashboard",
204
- name: "Dashboard",
205
- component: () => import("./index-Bn4ThpX9.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-CmQfZC8r.js"),
226
- meta: {
227
- title: "用户管理",
228
- icon: "user",
229
- keepAlive: !0
230
- }
231
- },
232
- {
233
- path: "role",
234
- name: "SystemRole",
235
- component: () => import("./index-orZCyV6I.js"),
236
- meta: {
237
- title: "角色管理",
238
- icon: "role",
239
- keepAlive: !0
240
- }
241
- },
242
- {
243
- path: "menu",
244
- name: "SystemMenu",
245
- component: () => import("./index-fyarVCog.js"),
246
- meta: {
247
- title: "菜单管理",
248
- icon: "menu",
249
- keepAlive: !0
250
- }
251
- }
252
- ]
253
- }
254
- ], lt = [
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
- ], Se = "token", xe = "refresh_token", Le = "token_expire", $e = () => v.get(Se), it = (e) => {
303
- v.set(Se, e);
304
- }, fo = () => v.get(xe), ut = (e) => {
305
- v.set(xe, e);
306
- }, ct = () => v.get(Le), dt = (e) => {
307
- v.set(Le, e);
308
- }, ht = (e) => {
309
- it(e.token), ut(e.refreshToken), dt(e.expireTime);
310
- }, Be = () => {
311
- v.remove(Se), v.remove(xe), v.remove(Le);
312
- }, pt = () => {
313
- const e = ct();
314
- return e ? Date.now() > e : !0;
315
- }, Ne = () => !!$e() && !pt(), N = ue("user", () => {
316
- const e = _(v.get("userInfo")), o = _(v.get("roles") || []), s = _(v.get("permissions") || []), a = f(() => !!e.value), r = f(() => {
317
- var l;
318
- return ((l = e.value) == null ? void 0 : l.username) || "";
319
- }), c = f(() => {
320
- var l;
321
- return ((l = e.value) == null ? void 0 : l.nickname) || "";
322
- }), d = f(() => {
323
- var l;
324
- return ((l = e.value) == null ? void 0 : l.avatar) || "";
325
- }), n = f(() => {
326
- var l;
327
- return (l = e.value) == null ? void 0 : l.id;
328
- });
329
- return {
330
- userInfo: e,
331
- roles: o,
332
- permissions: s,
333
- isLoggedIn: a,
334
- username: r,
335
- nickname: c,
336
- avatar: d,
337
- userId: n,
338
- setUserInfo: (l) => {
339
- e.value = l, o.value = l.roles || [], s.value = l.permissions || [], v.set("userInfo", l), v.set("roles", l.roles || []), v.set("permissions", l.permissions || []);
340
- },
341
- clearUserInfo: () => {
342
- e.value = null, o.value = [], s.value = [], v.remove("userInfo"), v.remove("roles"), v.remove("permissions");
343
- },
344
- hasPermission: (l) => Array.isArray(l) ? l.some((M) => s.value.includes(M)) : s.value.includes(l),
345
- hasRole: (l) => Array.isArray(l) ? l.some((M) => o.value.includes(M)) : o.value.includes(l)
346
- };
347
- }), Te = ke({
348
- history: be(),
349
- routes: [...Ve, Oe, Pe],
350
- scrollBehavior: () => ({ left: 0, top: 0 })
351
- }), mt = ["/login", "/404", "/403"];
352
- Te.beforeEach(async (e, o, s) => {
353
- const a = oe();
354
- if (a.initTheme(), Ne())
355
- if (e.path === "/login")
356
- s({ path: "/" });
357
- else {
358
- const r = N();
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
- }), de().setMenuList(lt)), e.name && e.meta.keepAlive && a.addCachedView(e.name), s();
371
- }
372
- else
373
- mt.includes(e.path) ? s() : s("/login");
374
- });
375
- function go() {
376
- const e = ke({
377
- history: be(),
378
- routes: [...Ve, Oe, Pe]
379
- });
380
- Te.matcher = e.matcher;
381
- }
382
- const de = ue("menu", () => {
383
- const e = _(v.get("menuList") || []), o = f(() => e.value.length > 0), s = (d) => {
384
- e.value = d, v.set("menuList", d);
385
- }, a = () => {
386
- e.value = [], v.remove("menuList");
387
- }, r = (d) => d.filter((n) => !n.hidden).map((n) => {
388
- const i = {
389
- path: n.path,
390
- name: n.name,
391
- meta: {
392
- title: n.title,
393
- icon: n.icon,
394
- keepAlive: n.keepAlive,
395
- hidden: n.hidden
396
- }
397
- };
398
- return n.redirect && (i.redirect = n.redirect), n.component && (i.component = () => rt(/* @__PURE__ */ Object.assign({}), `../views/${n.component}.vue`, 3)), n.children && n.children.length > 0 && (i.children = r(n.children)), i;
399
- });
400
- return {
401
- menuList: e,
402
- hasMenu: o,
403
- setMenuList: s,
404
- clearMenu: a,
405
- generateRoutes: r,
406
- addRoutes: (d) => {
407
- r(d).forEach((i) => {
408
- Te.addRoute("Layout", i);
409
- });
410
- }
411
- };
412
- }), he = ue("auth", () => {
413
- const e = _($e()), o = f(() => Ne()), s = _(""), a = _(""), r = _(""), c = _("/login");
414
- return {
415
- token: e,
416
- isLoggedIn: o,
417
- baseUrl: s,
418
- appId: a,
419
- clientId: r,
420
- loginPath: c,
421
- login: (l) => {
422
- e.value = l.token, ht(l);
423
- },
424
- logout: () => {
425
- e.value = null, Be();
426
- },
427
- setBaseUrl: (l) => {
428
- s.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
- }), vt = {
441
- key: 0,
442
- class: "sidebar__logo"
443
- }, _t = {
444
- key: 1,
445
- class: "sidebar__search"
446
- }, ft = {
447
- key: 0,
448
- class: "sidebar__search-results"
449
- }, gt = ["onClick"], yt = { class: "menu-icon" }, kt = { class: "sidebar__search-item-info" }, bt = { class: "sidebar__search-item-title" }, wt = {
450
- key: 0,
451
- class: "sidebar__search-item-parent"
452
- }, Ct = { class: "menu-icon" }, St = { class: "menu-icon" }, xt = { class: "menu-icon" }, Lt = {
453
- key: 2,
454
- class: "sidebar__user"
455
- }, $t = { class: "sidebar__user-info" }, Tt = { class: "sidebar__user-name" }, Mt = { class: "sidebar__user-role" }, zt = /* @__PURE__ */ X({
456
- __name: "Sidebar",
457
- props: {
458
- mode: { default: "vertical" },
459
- showLogo: { type: Boolean, default: !0 }
460
- },
461
- setup(e) {
462
- const o = e, s = we(), a = Z(), r = de(), c = N(), d = he(), n = oe(), i = _(""), u = f(() => n.isCollapsed), b = f(() => s.path), T = f(() => n.isDark ? "#1d1e1f" : "#fff"), l = f(() => n.isDark ? "#cfd3dc" : "#303133"), M = f(() => "#409eff"), A = ($, I = "") => {
463
- const U = [];
464
- return $.forEach((w) => {
465
- w.children && w.children.length > 0 ? U.push(...A(w.children, w.title)) : U.push({ ...w, parentTitle: I });
466
- }), U;
467
- }, D = f(() => i.value.trim() ? A(r.menuList).filter(
468
- (I) => I.title.toLowerCase().includes(i.value.toLowerCase())
469
- ) : []), E = f(() => i.value.trim() ? r.menuList.map(($) => {
470
- if ($.children && $.children.length > 0) {
471
- const I = $.children.filter(
472
- (U) => U.title.toLowerCase().includes(i.value.toLowerCase())
473
- );
474
- return I.length > 0 ? { ...$, children: I } : null;
475
- }
476
- return $.title.toLowerCase().includes(i.value.toLowerCase()) ? $ : null;
477
- }).filter(Boolean) : r.menuList), P = ($) => {
478
- $ && $ !== s.path && (a.push($), i.value = "");
479
- }, H = ($) => {
480
- a.push($), i.value = "";
481
- }, G = () => {
482
- d.logout(), c.clearUserInfo(), r.clearMenu(), a.push("/login");
483
- }, F = ($) => ({
484
- dashboard: "📊",
485
- system: "⚙️",
486
- user: "👤",
487
- role: "👥",
488
- menu: "📋",
489
- setting: "🔧"
490
- })[$ || ""] || "📄", O = f(() => o.mode === "vertical"), ee = f(() => o.mode === "horizontal");
491
- return ($, I) => {
492
- var U;
493
- return h(), m("div", {
494
- class: Y(["sidebar", [
495
- `sidebar--${e.mode}`,
496
- { "sidebar--collapsed": u.value && O.value },
497
- { "sidebar--horizontal": ee.value }
498
- ]])
499
- }, [
500
- e.showLogo && O.value ? (h(), m("div", vt, [
501
- I[1] || (I[1] = t("img", {
502
- src: Ce,
503
- alt: "Logo",
504
- class: "sidebar__logo-img"
505
- }, null, -1)),
506
- Re(t("span", { class: "sidebar__logo-text" }, S(g(n).appName), 513), [
507
- [Ye, !u.value]
508
- ])
509
- ])) : R("", !0),
510
- O.value && !u.value ? (h(), m("div", _t, [
511
- C(g(ge), {
512
- modelValue: i.value,
513
- "onUpdate:modelValue": I[0] || (I[0] = (w) => i.value = w),
514
- placeholder: "搜索菜单...",
515
- size: "small",
516
- clearable: ""
517
- }, null, 8, ["modelValue"]),
518
- D.value.length > 0 ? (h(), m("div", ft, [
519
- (h(!0), m(V, null, q(D.value, (w) => (h(), m("div", {
520
- key: w.path,
521
- class: "sidebar__search-item",
522
- onClick: (k) => H(w.path)
523
- }, [
524
- t("span", yt, S(F(w.icon)), 1),
525
- t("div", kt, [
526
- t("span", bt, S(w.title), 1),
527
- w.parentTitle ? (h(), m("span", wt, S(w.parentTitle), 1)) : R("", !0)
528
- ])
529
- ], 8, gt))), 128))
530
- ])) : R("", !0)
531
- ])) : R("", !0),
532
- C(g(Ge), {
533
- "default-active": b.value,
534
- mode: e.mode,
535
- collapse: u.value && O.value,
536
- "collapse-transition": !1,
537
- "background-color": T.value,
538
- "text-color": l.value,
539
- "active-text-color": M.value,
540
- class: "sidebar__menu",
541
- onSelect: P
542
- }, {
543
- default: z(() => [
544
- (h(!0), m(V, null, q(E.value, (w) => (h(), m(V, {
545
- key: w.path
546
- }, [
547
- w.children && w.children.length > 0 ? (h(), ie(g(et), {
548
- key: 0,
549
- index: w.path
550
- }, {
551
- title: z(() => [
552
- t("span", Ct, S(F(w.icon)), 1),
553
- t("span", null, S(w.title), 1)
554
- ]),
555
- default: z(() => [
556
- (h(!0), m(V, null, q(w.children, (k) => (h(), ie(g(Ae), {
557
- key: k.path,
558
- index: k.path
559
- }, {
560
- default: z(() => [
561
- t("span", St, S(F(k.icon)), 1),
562
- t("span", null, S(k.title), 1)
563
- ]),
564
- _: 2
565
- }, 1032, ["index"]))), 128))
566
- ]),
567
- _: 2
568
- }, 1032, ["index"])) : (h(), ie(g(Ae), {
569
- key: 1,
570
- index: w.path
571
- }, {
572
- default: z(() => [
573
- t("span", xt, S(F(w.icon)), 1),
574
- t("span", null, S(w.title), 1)
575
- ]),
576
- _: 2
577
- }, 1032, ["index"]))
578
- ], 64))), 128))
579
- ]),
580
- _: 1
581
- }, 8, ["default-active", "mode", "collapse", "background-color", "text-color", "active-text-color"]),
582
- O.value && !u.value ? (h(), m("div", Lt, [
583
- t("div", $t, [
584
- t("span", Tt, S(g(c).nickname), 1),
585
- t("span", Mt, S((U = g(c).roles) == null ? void 0 : U.join(", ")), 1)
586
- ]),
587
- C(g(ce), {
588
- type: "text",
589
- size: "small",
590
- onClick: G
591
- }, {
592
- default: z(() => [...I[2] || (I[2] = [
593
- Q("退出", -1)
594
- ])]),
595
- _: 1
596
- })
597
- ])) : R("", !0)
598
- ], 2);
599
- };
600
- }
601
- }), W = (e, o) => {
602
- const s = e.__vccOpts || e;
603
- for (const [a, r] of o)
604
- s[a] = r;
605
- return s;
606
- }, le = /* @__PURE__ */ W(zt, [["__scopeId", "data-v-c12b0ee4"]]), Et = { class: "header" }, It = { class: "header__left" }, At = {
607
- viewBox: "0 0 24 24",
608
- width: "18",
609
- height: "18",
610
- fill: "currentColor"
611
- }, Rt = {
612
- key: 0,
613
- d: "M3 18h18v-2H3v2zm0-5h18v-2H3v2zm0-7v2h18V6H3z"
614
- }, Dt = {
615
- key: 1,
616
- d: "M3 18h18v-2H3v2zm0-5h18v-2H3v2zm0-7v2h18V6H3z"
617
- }, Ut = {
618
- key: 0,
619
- class: "header__breadcrumb"
620
- }, Vt = {
621
- key: 0,
622
- class: "breadcrumb-separator"
623
- }, Pt = { class: "header__right" }, Ot = ["title"], Bt = {
624
- key: 0,
625
- viewBox: "0 0 24 24",
626
- width: "16",
627
- height: "16",
628
- fill: "currentColor"
629
- }, Nt = {
630
- key: 1,
631
- viewBox: "0 0 24 24",
632
- width: "16",
633
- height: "16",
634
- fill: "currentColor"
635
- }, Ht = {
636
- key: 0,
637
- class: "header__layout-dropdown"
638
- }, Ft = { class: "header__layout-options" }, jt = ["onClick"], Kt = { class: "layout-icon" }, qt = { class: "header__color-options" }, Wt = ["title", "onClick"], Yt = {
639
- key: 0,
640
- viewBox: "0 0 24 24",
641
- width: "16",
642
- height: "16",
643
- fill: "currentColor"
644
- }, Xt = {
645
- key: 1,
646
- viewBox: "0 0 24 24",
647
- width: "16",
648
- height: "16",
649
- fill: "currentColor"
650
- }, Jt = { class: "header__avatar" }, Qt = { class: "header__user-name" }, Zt = {
651
- key: 0,
652
- class: "header__dropdown"
653
- }, Gt = { class: "header__dropdown-header" }, es = { class: "header__dropdown-avatar" }, ts = { class: "header__dropdown-info" }, ss = { class: "header__dropdown-name" }, os = { class: "header__dropdown-role" }, as = { class: "search-container" }, ns = { class: "search-input-wrapper" }, rs = {
654
- key: 0,
655
- class: "search-results"
656
- }, ls = ["onClick"], is = { class: "search-result-icon" }, us = { class: "search-result-info" }, cs = { class: "search-result-title" }, ds = {
657
- key: 0,
658
- class: "search-result-parent"
659
- }, hs = {
660
- key: 1,
661
- class: "search-empty"
662
- }, ps = /* @__PURE__ */ X({
663
- __name: "Header",
664
- setup(e) {
665
- const o = we(), s = Z(), a = oe(), r = N(), c = he(), d = de(), n = _(!1), i = _(!1), u = _(null), b = _(!1), T = _(!1), l = _(""), M = _(null), A = [
666
- { value: "sidebar", label: "左侧菜单", icon: "📋" },
667
- { value: "top", label: "顶部菜单", icon: "☰" },
668
- { value: "mix", label: "混合菜单", icon: "⚡" }
669
- ], D = [
670
- { value: "#409eff", label: "默认蓝" },
671
- { value: "#1890ff", label: "科技蓝" },
672
- { value: "#52c41a", label: "极光绿" },
673
- { value: "#faad14", label: "日落橙" },
674
- { value: "#f5222d", label: "薄暮红" },
675
- { value: "#722ed1", label: "酱紫" }
676
- ], E = f(() => o.matched.filter((p) => p.meta && p.meta.title).map((p) => ({
677
- title: p.meta.title,
678
- path: p.path
679
- }))), P = (x, p = "") => {
680
- const J = [];
681
- return x.forEach((y) => {
682
- y.children && y.children.length > 0 ? J.push(...P(y.children, y.title)) : J.push({ ...y, parentTitle: p });
683
- }), J;
684
- }, H = f(() => l.value.trim() ? P(d.menuList).filter(
685
- (p) => p.title.toLowerCase().includes(l.value.toLowerCase())
686
- ) : []), G = f(() => a.layout), F = () => {
687
- a.toggleCollapse();
688
- }, O = () => {
689
- a.toggleTheme();
690
- }, ee = (x) => {
691
- a.setLayout(x), i.value = !1;
692
- }, $ = () => {
693
- const x = document.documentElement;
694
- x.classList.contains("grey-mode") ? x.classList.remove("grey-mode") : x.classList.add("grey-mode");
695
- }, I = () => {
696
- document.fullscreenElement ? document.exitFullscreen() : document.documentElement.requestFullscreen();
697
- }, U = () => {
698
- b.value = !!document.fullscreenElement;
699
- }, w = () => {
700
- n.value = !n.value, i.value = !1;
701
- }, k = () => {
702
- i.value = !i.value, n.value = !1;
703
- }, j = () => {
704
- n.value = !1, i.value = !1;
705
- }, Me = () => {
706
- T.value = !0;
707
- }, pe = () => {
708
- T.value = !1, l.value = "";
709
- }, ze = (x) => {
710
- s.push(x), pe();
711
- }, Fe = (x) => {
712
- a.setPrimaryColor(x);
713
- }, je = () => {
714
- j(), s.push("/profile");
715
- }, Ke = () => {
716
- j(), s.push("/change-password");
717
- }, qe = () => {
718
- j(), c.logout(), r.clearUserInfo(), d.clearMenu(), s.push("/login");
719
- }, Ee = (x) => {
720
- u.value && !u.value.contains(x.target) && j(), M.value && !M.value.contains(x.target) && pe();
721
- }, Ie = (x) => {
722
- x.key === "Escape" && (pe(), j()), (x.ctrlKey || x.metaKey) && x.key === "k" && (x.preventDefault(), Me());
723
- };
724
- return Xe(() => {
725
- document.addEventListener("click", Ee), document.addEventListener("fullscreenchange", U), document.addEventListener("keydown", Ie), a.initTheme();
726
- }), Je(() => {
727
- document.removeEventListener("click", Ee), document.removeEventListener("fullscreenchange", U), document.removeEventListener("keydown", Ie);
728
- }), (x, p) => {
729
- var J;
730
- return h(), m("div", Et, [
731
- t("div", It, [
732
- t("div", {
733
- class: "header__collapse",
734
- onClick: F
735
- }, [
736
- (h(), m("svg", At, [
737
- g(a).isCollapsed ? (h(), m("path", Rt)) : (h(), m("path", Dt))
738
- ]))
739
- ]),
740
- g(a).showBreadcrumb ? (h(), m("div", Ut, [
741
- (h(!0), m(V, null, q(E.value, (y, B) => (h(), m("span", {
742
- key: y.path
743
- }, [
744
- B > 0 ? (h(), m("span", Vt, "/")) : R("", !0),
745
- t("span", {
746
- class: Y({ "is-current": B === E.value.length - 1 })
747
- }, S(y.title), 3)
748
- ]))), 128))
749
- ])) : R("", !0)
750
- ]),
751
- t("div", Pt, [
752
- t("div", {
753
- class: "header__action",
754
- onClick: Me,
755
- title: "搜索 (Ctrl+K)"
756
- }, [...p[2] || (p[2] = [
757
- t("svg", {
758
- viewBox: "0 0 24 24",
759
- width: "16",
760
- height: "16",
761
- fill: "currentColor"
762
- }, [
763
- t("path", { d: "M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z" })
764
- ], -1)
765
- ])]),
766
- t("div", {
767
- class: "header__action",
768
- onClick: I,
769
- title: b.value ? "退出全屏" : "全屏"
770
- }, [
771
- b.value ? (h(), m("svg", Bt, [...p[3] || (p[3] = [
772
- t("path", { d: "M5 16h3v3h2v-5H5v2zm3-8H5v2h5V5H8v3zm6 11h2v-3h3v-2h-5v5zm2-11V5h-2v5h5V8h-3z" }, null, -1)
773
- ])])) : (h(), m("svg", Nt, [...p[4] || (p[4] = [
774
- t("path", { d: "M7 14H5v5h5v-2H7v-3zm-2-4h2V7h3V5H5v5zm12 7h-3v2h5v-5h-2v3zM14 5v2h3v3h2V5h-5z" }, null, -1)
775
- ])]))
776
- ], 8, Ot),
777
- t("div", {
778
- class: "header__action header__layout",
779
- ref_key: "dropdownRef",
780
- ref: u
781
- }, [
782
- t("div", {
783
- class: "header__action-trigger",
784
- onClick: _e(k, ["stop"])
785
- }, [...p[5] || (p[5] = [
786
- t("svg", {
787
- viewBox: "0 0 24 24",
788
- width: "16",
789
- height: "16",
790
- fill: "currentColor"
791
- }, [
792
- t("path", { d: "M3 3h18v18H3V3zm2 2v6h14V5H5zm0 8v6h6v-6H5zm8 0v6h6v-6h-6z" })
793
- ], -1)
794
- ])]),
795
- C(me, { name: "dropdown" }, {
796
- default: z(() => [
797
- i.value ? (h(), m("div", Ht, [
798
- p[7] || (p[7] = t("div", { class: "header__layout-title" }, "布局模式", -1)),
799
- t("div", Ft, [
800
- (h(), m(V, null, q(A, (y) => t("div", {
801
- key: y.value,
802
- class: Y(["header__layout-option", { "is-active": G.value === y.value }]),
803
- onClick: (B) => ee(y.value)
804
- }, [
805
- t("span", Kt, S(y.icon), 1),
806
- t("span", null, S(y.label), 1)
807
- ], 10, jt)), 64))
808
- ]),
809
- p[8] || (p[8] = t("div", { class: "header__layout-divider" }, null, -1)),
810
- p[9] || (p[9] = t("div", { class: "header__layout-title" }, "主题色", -1)),
811
- t("div", qt, [
812
- (h(), m(V, null, q(D, (y) => t("div", {
813
- key: y.value,
814
- class: Y(["header__color-option", { "is-active": g(a).primaryColor === y.value }]),
815
- style: fe({ backgroundColor: y.value }),
816
- title: y.label,
817
- onClick: (B) => Fe(y.value)
818
- }, null, 14, Wt)), 64))
819
- ]),
820
- p[10] || (p[10] = t("div", { class: "header__layout-divider" }, null, -1)),
821
- t("div", {
822
- class: "header__layout-item",
823
- onClick: $
824
- }, [...p[6] || (p[6] = [
825
- t("span", { class: "layout-icon" }, "🌫️", -1),
826
- t("span", null, "灰色模式", -1)
827
- ])])
828
- ])) : R("", !0)
829
- ]),
830
- _: 1
831
- })
832
- ], 512),
833
- t("div", {
834
- class: "header__action",
835
- onClick: O,
836
- title: "切换主题"
837
- }, [
838
- g(a).isDark ? (h(), m("svg", Yt, [...p[11] || (p[11] = [
839
- t("path", { d: "M12 3c-4.97 0-9 4.03-9 9s4.03 9 9 9 9-4.03 9-9c0-.46-.04-.92-.1-1.36-.98 1.37-2.58 2.26-4.4 2.26-3.03 0-5.5-2.47-5.5-5.5 0-1.82.89-3.42 2.26-4.4-.44-.06-.9-.1-1.36-.1z" }, null, -1)
840
- ])])) : (h(), m("svg", Xt, [...p[12] || (p[12] = [
841
- t("path", { d: "M6.76 4.84l-1.4-1.4-1.41 1.41 1.4 1.4 1.41-1.41zm10.49 10.49l-1.4-1.4-1.41 1.41 1.4 1.4 1.41-1.41zM12 4c-4.97 0-9 4.03-9 9s4.03 9 9 9 9-4.03 9-9-4.03-9-9-9zm0 16c-3.87 0-7-3.13-7-7s3.13-7 7-7 7 3.13 7 7-3.13 7-7 7zm1-9h-2v4h2v-4zm0-6h-2v2h2V5zM4.84 17.24l-1.41 1.41 1.4 1.4 1.41-1.41-1.4-1.4z" }, null, -1)
842
- ])]))
843
- ]),
844
- t("div", {
845
- class: "header__user",
846
- ref_key: "dropdownRef",
847
- ref: u
848
- }, [
849
- t("div", {
850
- class: "header__user-trigger",
851
- onClick: _e(w, ["stop"])
852
- }, [
853
- t("div", Jt, [
854
- t("span", null, S(((J = g(r).nickname) == null ? void 0 : J.charAt(0)) || "U"), 1)
855
- ]),
856
- t("span", Qt, S(g(r).nickname), 1),
857
- t("span", {
858
- class: Y(["header__user-arrow", { "is-active": n.value }])
859
- }, "▼", 2)
860
- ]),
861
- C(me, { name: "dropdown" }, {
862
- default: z(() => {
863
- var y, B;
864
- return [
865
- n.value ? (h(), m("div", Zt, [
866
- t("div", Gt, [
867
- t("div", es, [
868
- t("span", null, S(((y = g(r).nickname) == null ? void 0 : y.charAt(0)) || "U"), 1)
869
- ]),
870
- t("div", ts, [
871
- t("div", ss, S(g(r).nickname), 1),
872
- t("div", os, S((B = g(r).roles) == null ? void 0 : B.join(", ")), 1)
873
- ])
874
- ]),
875
- p[17] || (p[17] = t("div", { class: "header__dropdown-divider" }, null, -1)),
876
- t("div", { class: "header__dropdown-menu" }, [
877
- t("div", {
878
- class: "header__dropdown-item",
879
- onClick: je
880
- }, [...p[13] || (p[13] = [
881
- t("span", { class: "header__dropdown-icon" }, "👤", -1),
882
- t("span", null, "个人信息", -1)
883
- ])]),
884
- t("div", {
885
- class: "header__dropdown-item",
886
- onClick: Ke
887
- }, [...p[14] || (p[14] = [
888
- t("span", { class: "header__dropdown-icon" }, "🔐", -1),
889
- t("span", null, "修改密码", -1)
890
- ])]),
891
- p[16] || (p[16] = t("div", { class: "header__dropdown-divider" }, null, -1)),
892
- t("div", {
893
- class: "header__dropdown-item header__dropdown-item--danger",
894
- onClick: qe
895
- }, [...p[15] || (p[15] = [
896
- t("span", { class: "header__dropdown-icon" }, "🚪", -1),
897
- t("span", null, "退出登录", -1)
898
- ])])
899
- ])
900
- ])) : R("", !0)
901
- ];
902
- }),
903
- _: 1
904
- })
905
- ], 512)
906
- ]),
907
- C(me, { name: "search" }, {
908
- default: z(() => [
909
- T.value ? (h(), m("div", {
910
- key: 0,
911
- class: "header__search-modal",
912
- ref_key: "searchRef",
913
- ref: M
914
- }, [
915
- t("div", as, [
916
- t("div", ns, [
917
- p[18] || (p[18] = t("svg", {
918
- class: "search-icon",
919
- viewBox: "0 0 24 24",
920
- width: "20",
921
- height: "20",
922
- fill: "currentColor"
923
- }, [
924
- t("path", { d: "M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z" })
925
- ], -1)),
926
- Re(t("input", {
927
- "onUpdate:modelValue": p[0] || (p[0] = (y) => l.value = y),
928
- type: "text",
929
- class: "search-input",
930
- placeholder: "搜索菜单...",
931
- autofocus: "",
932
- onKeyup: p[1] || (p[1] = De((y) => H.value[0] && ze(H.value[0].path), ["enter"]))
933
- }, null, 544), [
934
- [Qe, l.value]
935
- ]),
936
- p[19] || (p[19] = t("span", { class: "search-shortcut" }, "ESC 关闭", -1))
937
- ]),
938
- H.value.length > 0 ? (h(), m("div", rs, [
939
- (h(!0), m(V, null, q(H.value, (y, B) => (h(), m("div", {
940
- key: y.path,
941
- class: Y(["search-result-item", { "is-first": B === 0 }]),
942
- onClick: (no) => ze(y.path)
943
- }, [
944
- t("span", is, S(y.icon || "📄"), 1),
945
- t("div", us, [
946
- t("span", cs, S(y.title), 1),
947
- y.parentTitle ? (h(), m("span", ds, S(y.parentTitle), 1)) : R("", !0)
948
- ])
949
- ], 10, ls))), 128))
950
- ])) : l.value ? (h(), m("div", hs, " 未找到匹配的菜单 ")) : R("", !0)
951
- ])
952
- ], 512)) : R("", !0)
953
- ]),
954
- _: 1
955
- })
956
- ]);
957
- };
958
- }
959
- }), ve = /* @__PURE__ */ W(ps, [["__scopeId", "data-v-7095203b"]]), ms = { class: "layout__header-top" }, vs = { class: "layout__header-logo" }, _s = { class: "layout__logo-text" }, fs = { class: "layout__header-right" }, gs = { class: "layout__content" }, ys = { class: "layout__header-mix" }, ks = { class: "layout__header-left" }, bs = {
960
- viewBox: "0 0 24 24",
961
- width: "18",
962
- height: "18",
963
- fill: "currentColor"
964
- }, ws = {
965
- key: 0,
966
- d: "M3 18h18v-2H3v2zm0-5h18v-2H3v2zm0-7v2h18V6H3z"
967
- }, Cs = {
968
- key: 1,
969
- d: "M3 18h18v-2H3v2zm0-5h18v-2H3v2zm0-7v2h18V6H3z"
970
- }, Ss = { class: "layout__header-right" }, xs = { class: "layout__body" }, Ls = { class: "layout__content" }, $s = { class: "layout__main" }, Ts = { class: "layout__header" }, Ms = { class: "layout__content" }, zs = /* @__PURE__ */ X({
971
- __name: "index",
972
- setup(e) {
973
- const o = oe(), s = f(
974
- () => o.isCollapsed ? "64px" : "210px"
975
- ), a = f(() => o.layout), r = f(() => a.value === "sidebar"), c = f(() => a.value === "top"), d = f(() => a.value === "mix");
976
- return (n, i) => {
977
- const u = Ze("router-view");
978
- return h(), m("div", {
979
- class: Y(["layout", `layout--${a.value}`])
980
- }, [
981
- c.value ? (h(), m(V, { key: 0 }, [
982
- t("header", ms, [
983
- t("div", vs, [
984
- i[1] || (i[1] = t("img", {
985
- src: Ce,
986
- alt: "Logo",
987
- class: "layout__logo-img"
988
- }, null, -1)),
989
- t("span", _s, S(g(o).appName), 1)
990
- ]),
991
- C(le, {
992
- class: "layout__top-menu",
993
- mode: "horizontal"
994
- }),
995
- t("div", fs, [
996
- C(ve, {
997
- "show-breadcrumb": !1,
998
- "show-collapse": !1
999
- })
1000
- ])
1001
- ]),
1002
- t("main", gs, [
1003
- C(u)
1004
- ])
1005
- ], 64)) : d.value ? (h(), m(V, { key: 1 }, [
1006
- t("header", ys, [
1007
- t("div", ks, [
1008
- t("div", {
1009
- class: "layout__collapse",
1010
- onClick: i[0] || (i[0] = //@ts-ignore
1011
- (...b) => g(o).toggleCollapse && g(o).toggleCollapse(...b))
1012
- }, [
1013
- (h(), m("svg", bs, [
1014
- g(o).isCollapsed ? (h(), m("path", ws)) : (h(), m("path", Cs))
1015
- ]))
1016
- ]),
1017
- C(le, {
1018
- class: "layout__top-menu",
1019
- mode: "horizontal"
1020
- })
1021
- ]),
1022
- t("div", Ss, [
1023
- C(ve, {
1024
- "show-breadcrumb": !1,
1025
- "show-collapse": !1
1026
- })
1027
- ])
1028
- ]),
1029
- t("div", xs, [
1030
- t("aside", {
1031
- class: "layout__aside",
1032
- style: fe({ width: s.value })
1033
- }, [
1034
- C(le, {
1035
- mode: "vertical",
1036
- "show-logo": !1
1037
- })
1038
- ], 4),
1039
- t("main", Ls, [
1040
- C(u)
1041
- ])
1042
- ])
1043
- ], 64)) : r.value ? (h(), m(V, { key: 2 }, [
1044
- t("aside", {
1045
- class: "layout__aside",
1046
- style: fe({ width: s.value })
1047
- }, [
1048
- C(le)
1049
- ], 4),
1050
- t("div", $s, [
1051
- t("header", Ts, [
1052
- C(ve)
1053
- ]),
1054
- t("main", Ms, [
1055
- C(u)
1056
- ])
1057
- ])
1058
- ], 64)) : R("", !0)
1059
- ], 2);
1060
- };
1061
- }
1062
- }), He = /* @__PURE__ */ W(zs, [["__scopeId", "data-v-129cb9dc"]]), Es = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1063
- __proto__: null,
1064
- default: He
1065
- }, Symbol.toStringTag, { value: "Module" })), Is = { class: "tabs-wrapper" }, As = { class: "tab-label" }, Rs = ["onClick"], Ds = /* @__PURE__ */ X({
1066
- __name: "Tabs",
1067
- setup(e) {
1068
- const o = we(), s = Z(), a = f(() => {
1069
- const n = [];
1070
- return o.matched.forEach((i) => {
1071
- var u;
1072
- (u = i.meta) != null && u.affix && n.push({
1073
- name: i.name,
1074
- title: i.meta.title,
1075
- path: i.path,
1076
- affix: !0
1077
- });
1078
- }), n;
1079
- }), r = f(() => o.path), c = (n) => {
1080
- s.push(n);
1081
- }, d = (n) => {
1082
- const i = a.value.find((u) => u.path === n);
1083
- if (!(i != null && i.affix) && n === r.value) {
1084
- const u = a.value.findIndex((T) => T.path === n), b = a.value[u - 1] || a.value[u + 1];
1085
- b && s.push(b.path);
1086
- }
1087
- };
1088
- return (n, i) => (h(), m("div", Is, [
1089
- C(g(tt), {
1090
- modelValue: r.value,
1091
- "onUpdate:modelValue": i[0] || (i[0] = (u) => r.value = u),
1092
- type: "card",
1093
- onTabClick: c
1094
- }, {
1095
- default: z(() => [
1096
- (h(!0), m(V, null, q(a.value, (u) => (h(), ie(g(st), {
1097
- key: u.path,
1098
- name: u.path,
1099
- label: u.title,
1100
- closable: !u.affix
1101
- }, {
1102
- label: z(() => [
1103
- t("span", As, [
1104
- Q(S(u.title) + " ", 1),
1105
- u.affix ? R("", !0) : (h(), m("span", {
1106
- key: 0,
1107
- class: "tab-close",
1108
- onClick: _e((b) => d(u.path), ["stop"])
1109
- }, " ✕ ", 8, Rs))
1110
- ])
1111
- ]),
1112
- _: 2
1113
- }, 1032, ["name", "label", "closable"]))), 128))
1114
- ]),
1115
- _: 1
1116
- }, 8, ["modelValue"])
1117
- ]));
1118
- }
1119
- }), yo = /* @__PURE__ */ W(Ds, [["__scopeId", "data-v-9156d8cd"]]), Us = {}, Vs = { class: "footer" };
1120
- function Ps(e, o) {
1121
- return h(), m("div", Vs, [...o[0] || (o[0] = [
1122
- t("span", null, "Copyright © 2024 Xto Demo. All Rights Reserved.", -1)
1123
- ])]);
1124
- }
1125
- const ko = /* @__PURE__ */ W(Us, [["render", Ps], ["__scopeId", "data-v-4852826a"]]), Os = { class: "login" }, Bs = { class: "login__container" }, Ns = /* @__PURE__ */ X({
1126
- __name: "index",
1127
- setup(e) {
1128
- const o = Z(), s = he(), a = N(), r = de(), c = _(!1), d = _(!1), n = ye({
1129
- username: "admin",
1130
- password: "123456"
1131
- }), i = {
1132
- username: [
1133
- { required: !0, message: "请输入用户名", trigger: "blur" }
1134
- ],
1135
- password: [
1136
- { required: !0, message: "请输入密码", trigger: "blur" },
1137
- { min: 6, message: "密码长度至少6位", trigger: "blur" }
1138
- ]
1139
- }, u = _(), b = async () => {
1140
- var T;
1141
- try {
1142
- await ((T = u.value) == null ? void 0 : T.validate()), c.value = !0, setTimeout(() => {
1143
- s.login({
1144
- token: "mock_token_" + Date.now(),
1145
- refreshToken: "mock_refresh_token",
1146
- expireTime: Date.now() + 7 * 24 * 60 * 60 * 1e3
1147
- }), a.setUserInfo({
1148
- id: 1,
1149
- username: n.username,
1150
- nickname: "管理员",
1151
- avatar: "",
1152
- email: "admin@example.com",
1153
- phone: "13800138000",
1154
- status: 1,
1155
- roles: ["admin"],
1156
- permissions: ["*"],
1157
- createTime: (/* @__PURE__ */ new Date()).toISOString()
1158
- }), r.setMenuList([
1159
- {
1160
- id: 1,
1161
- name: "Dashboard",
1162
- path: "/dashboard",
1163
- component: "dashboard/index",
1164
- icon: "dashboard",
1165
- title: "仪表盘",
1166
- keepAlive: !0,
1167
- affix: !0
1168
- },
1169
- {
1170
- id: 2,
1171
- name: "System",
1172
- path: "/system",
1173
- redirect: "/system/user",
1174
- icon: "setting",
1175
- title: "系统管理",
1176
- children: [
1177
- {
1178
- id: 21,
1179
- name: "SystemUser",
1180
- path: "/system/user",
1181
- component: "system/user/index",
1182
- icon: "user",
1183
- title: "用户管理",
1184
- keepAlive: !0
1185
- },
1186
- {
1187
- id: 22,
1188
- name: "SystemRole",
1189
- path: "/system/role",
1190
- component: "system/role/index",
1191
- icon: "role",
1192
- title: "角色管理",
1193
- keepAlive: !0
1194
- },
1195
- {
1196
- id: 23,
1197
- name: "SystemMenu",
1198
- path: "/system/menu",
1199
- component: "system/menu/index",
1200
- icon: "menu",
1201
- title: "菜单管理",
1202
- keepAlive: !0
1203
- }
1204
- ]
1205
- }
1206
- ]), K.success("登录成功"), o.push("/"), c.value = !1;
1207
- }, 1e3);
1208
- } catch {
1209
- c.value = !1;
1210
- }
1211
- };
1212
- return (T, l) => (h(), m("div", Os, [
1213
- t("div", Bs, [
1214
- l[5] || (l[5] = t("div", { class: "login__header" }, [
1215
- t("img", {
1216
- src: Ce,
1217
- alt: "Logo",
1218
- class: "login__logo"
1219
- }),
1220
- t("h1", { class: "login__title" }, "Xto Demo"),
1221
- t("p", { class: "login__subtitle" }, "后台管理系统")
1222
- ], -1)),
1223
- C(g(ot), {
1224
- ref_key: "formRef",
1225
- ref: u,
1226
- model: n,
1227
- rules: i,
1228
- class: "login__form",
1229
- "label-width": "0"
1230
- }, {
1231
- default: z(() => [
1232
- C(g(ae), { prop: "username" }, {
1233
- default: z(() => [
1234
- C(g(ge), {
1235
- modelValue: n.username,
1236
- "onUpdate:modelValue": l[0] || (l[0] = (M) => n.username = M),
1237
- placeholder: "用户名",
1238
- "prefix-icon": "👤",
1239
- size: "large"
1240
- }, null, 8, ["modelValue"])
1241
- ]),
1242
- _: 1
1243
- }),
1244
- C(g(ae), { prop: "password" }, {
1245
- default: z(() => [
1246
- C(g(ge), {
1247
- modelValue: n.password,
1248
- "onUpdate:modelValue": l[1] || (l[1] = (M) => n.password = M),
1249
- type: "password",
1250
- placeholder: "密码",
1251
- "prefix-icon": "🔒",
1252
- size: "large",
1253
- "show-password": "",
1254
- onKeyup: De(b, ["enter"])
1255
- }, null, 8, ["modelValue"])
1256
- ]),
1257
- _: 1
1258
- }),
1259
- C(g(ae), null, {
1260
- default: z(() => [
1261
- C(g(at), {
1262
- modelValue: d.value,
1263
- "onUpdate:modelValue": l[2] || (l[2] = (M) => d.value = M)
1264
- }, {
1265
- default: z(() => [...l[3] || (l[3] = [
1266
- Q("记住我", -1)
1267
- ])]),
1268
- _: 1
1269
- }, 8, ["modelValue"])
1270
- ]),
1271
- _: 1
1272
- }),
1273
- C(g(ae), null, {
1274
- default: z(() => [
1275
- C(g(ce), {
1276
- type: "primary",
1277
- size: "large",
1278
- loading: c.value,
1279
- class: "login__submit",
1280
- onClick: b
1281
- }, {
1282
- default: z(() => [...l[4] || (l[4] = [
1283
- Q(" 登录 ", -1)
1284
- ])]),
1285
- _: 1
1286
- }, 8, ["loading"])
1287
- ]),
1288
- _: 1
1289
- })
1290
- ]),
1291
- _: 1
1292
- }, 8, ["model"]),
1293
- l[6] || (l[6] = t("div", { class: "login__footer" }, [
1294
- t("p", null, "提示: 任意用户名密码即可登录 (Mock 模式)")
1295
- ], -1))
1296
- ])
1297
- ]));
1298
- }
1299
- }), Hs = /* @__PURE__ */ W(Ns, [["__scopeId", "data-v-40e9f7eb"]]), Fs = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1300
- __proto__: null,
1301
- default: Hs
1302
- }, Symbol.toStringTag, { value: "Module" })), js = { class: "error-page" }, Ks = { class: "error-page__content" }, qs = /* @__PURE__ */ X({
1303
- __name: "404",
1304
- setup(e) {
1305
- const o = Z(), s = () => {
1306
- o.push("/");
1307
- };
1308
- return (a, r) => (h(), m("div", js, [
1309
- t("div", Ks, [
1310
- r[1] || (r[1] = t("div", { class: "error-page__code" }, "404", -1)),
1311
- r[2] || (r[2] = t("div", { class: "error-page__title" }, "页面不存在", -1)),
1312
- r[3] || (r[3] = t("div", { class: "error-page__desc" }, "抱歉,您访问的页面不存在或已被删除", -1)),
1313
- C(g(ce), {
1314
- type: "primary",
1315
- onClick: s
1316
- }, {
1317
- default: z(() => [...r[0] || (r[0] = [
1318
- Q("返回首页", -1)
1319
- ])]),
1320
- _: 1
1321
- })
1322
- ])
1323
- ]));
1324
- }
1325
- }), Ws = /* @__PURE__ */ W(qs, [["__scopeId", "data-v-c3c12c24"]]), Ys = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1326
- __proto__: null,
1327
- default: Ws
1328
- }, Symbol.toStringTag, { value: "Module" })), Xs = { class: "error-page" }, Js = { class: "error-page__content" }, Qs = /* @__PURE__ */ X({
1329
- __name: "403",
1330
- setup(e) {
1331
- const o = Z(), s = () => {
1332
- o.push("/");
1333
- };
1334
- return (a, r) => (h(), m("div", Xs, [
1335
- t("div", Js, [
1336
- r[1] || (r[1] = t("div", { class: "error-page__code" }, "403", -1)),
1337
- r[2] || (r[2] = t("div", { class: "error-page__title" }, "无访问权限", -1)),
1338
- r[3] || (r[3] = t("div", { class: "error-page__desc" }, "抱歉,您没有权限访问此页面", -1)),
1339
- C(g(ce), {
1340
- type: "primary",
1341
- onClick: s
1342
- }, {
1343
- default: z(() => [...r[0] || (r[0] = [
1344
- Q("返回首页", -1)
1345
- ])]),
1346
- _: 1
1347
- })
1348
- ])
1349
- ]));
1350
- }
1351
- }), Zs = /* @__PURE__ */ W(Qs, [["__scopeId", "data-v-dd5f2795"]]), Gs = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1352
- __proto__: null,
1353
- default: Zs
1354
- }, Symbol.toStringTag, { value: "Module" }));
1355
- function bo() {
1356
- const e = oe(), o = N(), s = he(), a = f(() => o.nickname || o.username || ""), r = f(() => o.userInfo), c = f(() => e.appName), d = f(() => s.isLoggedIn), n = f(() => e.isDark), i = f(() => e.theme), u = f(() => e.isCollapsed), b = f(() => e.layout);
1357
- return {
1358
- userName: a,
1359
- userInfo: r,
1360
- appName: c,
1361
- isLoggedIn: d,
1362
- isDark: n,
1363
- theme: i,
1364
- isCollapsed: u,
1365
- layout: b,
1366
- toggleTheme: () => {
1367
- e.toggleTheme();
1368
- },
1369
- toggleCollapse: () => {
1370
- e.toggleCollapse();
1371
- }
1372
- };
1373
- }
1374
- function wo() {
1375
- const e = N(), o = (c) => {
1376
- const d = e.permissions;
1377
- return d.includes("*") ? !0 : Array.isArray(c) ? c.some((n) => d.includes(n)) : d.includes(c);
1378
- }, s = (c) => {
1379
- const d = e.roles;
1380
- return d.includes("admin") ? !0 : Array.isArray(c) ? c.some((n) => d.includes(n)) : d.includes(c);
1381
- }, a = f(() => e.roles.includes("admin")), r = f(() => e.isLoggedIn);
1382
- return {
1383
- hasPermission: o,
1384
- hasRole: s,
1385
- isAdmin: a,
1386
- isLoggedIn: r
1387
- };
1388
- }
1389
- function Co(e, o = {}) {
1390
- const { rules: s, onSubmit: a } = o, r = _(), c = ye({ ...e }), d = _(!1), n = _(!1), i = _(!1), u = () => {
1391
- l(), i.value = !1, n.value = !0;
1392
- }, b = (A) => {
1393
- Object.assign(c, A), i.value = !0, n.value = !0;
1394
- }, T = () => {
1395
- n.value = !1, l();
1396
- }, l = () => {
1397
- var A;
1398
- Object.keys(e).forEach((D) => {
1399
- c[D] = e[D];
1400
- }), (A = r.value) == null || A.resetFields();
1401
- };
1402
- return {
1403
- formRef: r,
1404
- formData: c,
1405
- rules: s,
1406
- loading: d,
1407
- visible: n,
1408
- isEdit: i,
1409
- openAdd: u,
1410
- openEdit: b,
1411
- close: T,
1412
- resetForm: l,
1413
- handleSubmit: async () => {
1414
- var A;
1415
- try {
1416
- await ((A = r.value) == null ? void 0 : A.validate()), d.value = !0, await (a == null ? void 0 : a(c)), T();
1417
- } catch (D) {
1418
- console.error(D);
1419
- } finally {
1420
- d.value = !1;
1421
- }
1422
- }
1423
- };
1424
- }
1425
- function So(e) {
1426
- const { fetchData: o, defaultPageSize: s = 10 } = e, a = _(!1), r = _([]), c = _(0), d = _(1), n = _(s), i = ye({}), u = async () => {
1427
- a.value = !0;
1428
- try {
1429
- const E = {
1430
- ...i,
1431
- page: d.value,
1432
- pageSize: n.value
1433
- }, P = await o(E);
1434
- r.value = P.list, c.value = P.total;
1435
- } catch (E) {
1436
- console.error(E);
1437
- } finally {
1438
- a.value = !1;
1439
- }
1440
- }, b = () => {
1441
- d.value = 1, u();
1442
- }, T = () => {
1443
- Object.keys(i).forEach((E) => {
1444
- i[E] = void 0;
1445
- }), d.value = 1, u();
1446
- }, l = (E) => {
1447
- d.value = E, u();
1448
- }, M = (E) => {
1449
- n.value = E, d.value = 1, u();
1450
- }, A = () => {
1451
- u();
1452
- }, D = f(() => ({
1453
- current: d.value,
1454
- pageSize: n.value,
1455
- total: c.value
1456
- }));
1457
- return {
1458
- loading: a,
1459
- data: r,
1460
- total: c,
1461
- currentPage: d,
1462
- pageSize: n,
1463
- searchParams: i,
1464
- pagination: D,
1465
- getData: u,
1466
- handleSearch: b,
1467
- handleReset: T,
1468
- handlePageChange: l,
1469
- handleSizeChange: M,
1470
- refresh: A
1471
- };
1472
- }
1473
- function xo(e) {
1474
- const s = N().permissions;
1475
- return Array.isArray(e) ? e.some((a) => s.includes(a)) : s.includes(e);
1476
- }
1477
- function eo(e) {
1478
- const s = N().roles;
1479
- return Array.isArray(e) ? e.some((a) => s.includes(a)) : s.includes(e);
1480
- }
1481
- function Lo() {
1482
- return eo("admin");
1483
- }
1484
- const to = () => {
1485
- const e = nt.create({
1486
- baseURL: void 0,
1487
- timeout: 3e4,
1488
- headers: {
1489
- "Content-Type": "application/json"
1490
- }
1491
- });
1492
- return e.interceptors.request.use(
1493
- (o) => {
1494
- const s = $e();
1495
- return s && (o.headers.Authorization = `Bearer ${s}`), o;
1496
- },
1497
- (o) => Promise.reject(o)
1498
- ), e.interceptors.response.use(
1499
- (o) => {
1500
- const { data: s } = o;
1501
- return s.code === 200 || s.code === 0 ? s.data : (K.error(s.message || "请求失败"), Promise.reject(new Error(s.message || "请求失败")));
1502
- },
1503
- (o) => {
1504
- var a;
1505
- const { response: s } = o;
1506
- if (s)
1507
- switch (s.status) {
1508
- case 401:
1509
- K.error("登录已过期,请重新登录"), Be(), window.location.href = "/login";
1510
- break;
1511
- case 403:
1512
- K.error("没有权限访问");
1513
- break;
1514
- case 404:
1515
- K.error("请求资源不存在");
1516
- break;
1517
- case 500:
1518
- K.error("服务器错误");
1519
- break;
1520
- default:
1521
- K.error(((a = s.data) == null ? void 0 : a.message) || "请求失败");
1522
- }
1523
- else
1524
- K.error("网络连接失败");
1525
- return Promise.reject(o);
1526
- }
1527
- ), e;
1528
- }, se = to(), L = {
1529
- get(e, o) {
1530
- return se.get(e, o);
1531
- },
1532
- post(e, o, s) {
1533
- return se.post(e, o, s);
1534
- },
1535
- put(e, o, s) {
1536
- return se.put(e, o, s);
1537
- },
1538
- patch(e, o, s) {
1539
- return se.patch(e, o, s);
1540
- },
1541
- delete(e, o) {
1542
- return se.delete(e, o);
1543
- }
1544
- };
1545
- function $o(e, o = {}) {
1546
- const s = o.indexPath || "/dashboard";
1547
- return {
1548
- path: "/",
1549
- name: "Layout",
1550
- component: He,
1551
- redirect: s,
1552
- children: e
1553
- };
1554
- }
1555
- function To(e) {
1556
- return ke({
1557
- history: be(),
1558
- routes: e,
1559
- scrollBehavior: () => ({ left: 0, top: 0 })
1560
- });
1561
- }
1562
- function Mo(e) {
1563
- return L.post("/auth/login", e);
1564
- }
1565
- function zo() {
1566
- return L.post("/auth/logout");
1567
- }
1568
- function Eo() {
1569
- return L.get("/user/info");
1570
- }
1571
- function Io(e) {
1572
- return L.post("/auth/refresh", { refreshToken: e });
1573
- }
1574
- function Ao(e) {
1575
- return L.get("/role/list", { params: e });
1576
- }
1577
- function Ro(e) {
1578
- return L.get(`/role/${e}`);
1579
- }
1580
- function Do(e) {
1581
- return L.post("/role", e);
1582
- }
1583
- function Uo(e, o) {
1584
- return L.put(`/role/${e}`, o);
1585
- }
1586
- function Vo(e) {
1587
- return L.delete(`/role/${e}`);
1588
- }
1589
- function Po(e, o) {
1590
- return L.patch(`/role/${e}/status`, { status: o });
1591
- }
1592
- function Oo() {
1593
- return L.get("/menu/list");
1594
- }
1595
- function Bo() {
1596
- return L.get("/menu/tree");
1597
- }
1598
- function No(e) {
1599
- return L.post("/menu", e);
1600
- }
1601
- function Ho(e, o) {
1602
- return L.put(`/menu/${e}`, o);
1603
- }
1604
- function Fo(e) {
1605
- return L.delete(`/menu/${e}`);
1606
- }
1607
- function jo(e) {
1608
- return L.get("/user/list", { params: e });
1609
- }
1610
- function Ko(e) {
1611
- return L.get(`/user/${e}`);
1612
- }
1613
- function qo(e) {
1614
- return L.post("/user", e);
1615
- }
1616
- function Wo(e, o) {
1617
- return L.put(`/user/${e}`, o);
1618
- }
1619
- function Yo(e) {
1620
- return L.delete(`/user/${e}`);
1621
- }
1622
- function Xo(e) {
1623
- return L.post("/user/batch-delete", { ids: e });
1624
- }
1625
- function Jo(e, o) {
1626
- return L.patch(`/user/${e}/status`, { status: o });
1627
- }
1628
- function Qo(e) {
1629
- return L.post(`/user/${e}/reset-password`);
1630
- }
1631
- var so = /* @__PURE__ */ ((e) => (e[e.ENABLED = 1] = "ENABLED", e[e.DISABLED = 0] = "DISABLED", e))(so || {}), oo = /* @__PURE__ */ ((e) => (e[e.UNKNOWN = 0] = "UNKNOWN", e[e.MALE = 1] = "MALE", e[e.FEMALE = 2] = "FEMALE", e))(oo || {}), ao = /* @__PURE__ */ ((e) => (e[e.DIRECTORY = 0] = "DIRECTORY", e[e.MENU = 1] = "MENU", e[e.BUTTON = 2] = "BUTTON", e))(ao || {});
1632
- const Zo = {
1633
- 1: "启用",
1634
- 0: "禁用"
1635
- }, Go = {
1636
- 0: "未知",
1637
- 1: "男",
1638
- 2: "女"
1639
- }, ea = {
1640
- 0: "目录",
1641
- 1: "菜单",
1642
- 2: "按钮"
1643
- }, ta = [
1644
- {
1645
- label: "启用",
1646
- value: 1
1647
- /* ENABLED */
1648
- },
1649
- {
1650
- label: "禁用",
1651
- value: 0
1652
- /* DISABLED */
1653
- }
1654
- ], sa = [
1655
- {
1656
- label: "未知",
1657
- value: 0
1658
- /* UNKNOWN */
1659
- },
1660
- {
1661
- label: "男",
1662
- value: 1
1663
- /* MALE */
1664
- },
1665
- {
1666
- label: "女",
1667
- value: 2
1668
- /* FEMALE */
1669
- }
1670
- ], oa = [
1671
- {
1672
- label: "目录",
1673
- value: 0
1674
- /* DIRECTORY */
1675
- },
1676
- {
1677
- label: "菜单",
1678
- value: 1
1679
- /* MENU */
1680
- },
1681
- {
1682
- label: "按钮",
1683
- value: 2
1684
- /* BUTTON */
1685
- }
1686
- ], aa = {
1687
- mounted(e, o) {
1688
- var d;
1689
- const s = N(), { value: a } = o;
1690
- if (!a) return;
1691
- const r = s.permissions;
1692
- let c = !1;
1693
- Array.isArray(a) ? c = a.some((n) => r.includes(n) || r.includes("*")) : c = r.includes(a) || r.includes("*"), c || (d = e.parentNode) == null || d.removeChild(e);
1694
- }
1695
- };
1696
- export {
1697
- Io as $,
1698
- Ao as A,
1699
- $e as B,
1700
- ct as C,
1701
- Ko as D,
1702
- Eo as E,
1703
- ko as F,
1704
- oo as G,
1705
- ve as H,
1706
- jo as I,
1707
- xo as J,
1708
- eo as K,
1709
- He as L,
1710
- ao as M,
1711
- Ne as N,
1712
- L as O,
1713
- Lo as P,
1714
- pt as Q,
1715
- Oe as R,
1716
- so as S,
1717
- yo as T,
1718
- v as U,
1719
- ne as V,
1720
- Mo as W,
1721
- zo as X,
1722
- lt as Y,
1723
- aa as Z,
1724
- W as _,
1725
- ta as a,
1726
- Qo as a0,
1727
- go as a1,
1728
- Te as a2,
1729
- vo as a3,
1730
- re as a4,
1731
- ut as a5,
1732
- it as a6,
1733
- dt as a7,
1734
- ht as a8,
1735
- Ve as a9,
1736
- Ho as aa,
1737
- Uo as ab,
1738
- Po as ac,
1739
- Wo as ad,
1740
- Jo as ae,
1741
- bo as af,
1742
- oe as ag,
1743
- wo as ah,
1744
- he as ai,
1745
- Co as aj,
1746
- de as ak,
1747
- So as al,
1748
- N as am,
1749
- oa as b,
1750
- Zs as c,
1751
- sa as d,
1752
- Go as e,
1753
- ea as f,
1754
- Ws as g,
1755
- le as h,
1756
- Hs as i,
1757
- Zo as j,
1758
- Xo as k,
1759
- Be as l,
1760
- $o as m,
1761
- No as n,
1762
- Do as o,
1763
- To as p,
1764
- qo as q,
1765
- _o as r,
1766
- Fo as s,
1767
- Vo as t,
1768
- Yo as u,
1769
- Pe as v,
1770
- Oo as w,
1771
- Bo as x,
1772
- fo as y,
1773
- Ro as z
1774
- };