xto-fronted 0.4.51 → 0.4.53

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,475 @@
1
+ import { defineComponent as O, ref as N, computed as z, reactive as $, onMounted as Y, openBlock as V, createElementBlock as k, createVNode as a, unref as e, withCtx as o, createElementVNode as n, createTextVNode as m, Fragment as g, renderList as x, toDisplayString as i, createCommentVNode as h } from "vue";
2
+ import { Form as q, FormItem as p, Input as v, Select as F, InputNumber as j, Switch as A } from "@xto/form";
3
+ import { Card as G, Tag as c } from "@xto/data";
4
+ import { Modal as H, Message as J } from "@xto/feedback";
5
+ import { Button as E, Space as D } from "@xto/base";
6
+ import { S as r, M as u, b as K, _ as P } from "./index-DPDK8Ht4.js";
7
+ const Q = { class: "menu-page" }, W = { class: "toolbar" }, X = { class: "menu-tree" }, Z = { class: "tree-table" }, ee = { class: "tree-row tree-row--level-0" }, te = ["onClick"], le = ["onClick"], ae = /* @__PURE__ */ O({
8
+ __name: "index",
9
+ setup(ne) {
10
+ const R = [
11
+ {
12
+ id: 1,
13
+ parentId: null,
14
+ name: "Dashboard",
15
+ path: "/dashboard",
16
+ component: "dashboard/index",
17
+ redirect: "",
18
+ icon: "dashboard",
19
+ title: "仪表盘",
20
+ type: u.MENU,
21
+ sort: 1,
22
+ status: r.ENABLED,
23
+ hidden: !1,
24
+ keepAlive: !0
25
+ },
26
+ {
27
+ id: 2,
28
+ parentId: null,
29
+ name: "System",
30
+ path: "/system",
31
+ component: "",
32
+ redirect: "/system/user",
33
+ icon: "setting",
34
+ title: "系统管理",
35
+ type: u.DIRECTORY,
36
+ sort: 2,
37
+ status: r.ENABLED,
38
+ hidden: !1,
39
+ keepAlive: !1,
40
+ children: [
41
+ {
42
+ id: 21,
43
+ parentId: 2,
44
+ name: "SystemUser",
45
+ path: "/system/user",
46
+ component: "system/user/index",
47
+ redirect: "",
48
+ icon: "user",
49
+ title: "用户管理",
50
+ type: u.MENU,
51
+ sort: 1,
52
+ status: r.ENABLED,
53
+ hidden: !1,
54
+ keepAlive: !0
55
+ },
56
+ {
57
+ id: 22,
58
+ parentId: 2,
59
+ name: "SystemRole",
60
+ path: "/system/role",
61
+ component: "system/role/index",
62
+ redirect: "",
63
+ icon: "role",
64
+ title: "角色管理",
65
+ type: u.MENU,
66
+ sort: 2,
67
+ status: r.ENABLED,
68
+ hidden: !1,
69
+ keepAlive: !0
70
+ },
71
+ {
72
+ id: 23,
73
+ parentId: 2,
74
+ name: "SystemMenu",
75
+ path: "/system/menu",
76
+ component: "system/menu/index",
77
+ redirect: "",
78
+ icon: "menu",
79
+ title: "菜单管理",
80
+ type: u.MENU,
81
+ sort: 3,
82
+ status: r.ENABLED,
83
+ hidden: !1,
84
+ keepAlive: !0
85
+ }
86
+ ]
87
+ }
88
+ ], U = N(!1), C = N([]), y = N(!1), S = z(() => s.id ? "编辑菜单" : "新增菜单"), s = $({
89
+ id: 0,
90
+ parentId: null,
91
+ name: "",
92
+ path: "",
93
+ component: "",
94
+ redirect: "",
95
+ icon: "",
96
+ title: "",
97
+ type: u.MENU,
98
+ sort: 0,
99
+ status: r.ENABLED,
100
+ hidden: !1,
101
+ keepAlive: !0
102
+ }), w = {
103
+ name: [
104
+ { required: !0, message: "请输入菜单名称", trigger: "blur" }
105
+ ],
106
+ path: [
107
+ { required: !0, message: "请输入路由路径", trigger: "blur" }
108
+ ],
109
+ title: [
110
+ { required: !0, message: "请输入菜单标题", trigger: "blur" }
111
+ ]
112
+ }, M = N(), I = () => {
113
+ U.value = !0, setTimeout(() => {
114
+ C.value = R, U.value = !1;
115
+ }, 300);
116
+ }, B = (f = null) => {
117
+ Object.assign(s, {
118
+ id: 0,
119
+ parentId: f,
120
+ name: "",
121
+ path: "",
122
+ component: "",
123
+ redirect: "",
124
+ icon: "",
125
+ title: "",
126
+ type: u.MENU,
127
+ sort: 0,
128
+ status: r.ENABLED,
129
+ hidden: !1,
130
+ keepAlive: !0
131
+ }), y.value = !0;
132
+ }, b = (f) => {
133
+ Object.assign(s, f), y.value = !0;
134
+ }, T = async () => {
135
+ var f;
136
+ try {
137
+ await ((f = M.value) == null ? void 0 : f.validate()), J.success(s.id ? "编辑成功" : "新增成功"), y.value = !1, I();
138
+ } catch (t) {
139
+ console.error(t);
140
+ }
141
+ }, L = (f) => ({
142
+ dashboard: "📊",
143
+ system: "⚙️",
144
+ user: "👤",
145
+ role: "👥",
146
+ menu: "📋",
147
+ setting: "🔧"
148
+ })[f || ""] || "📄";
149
+ return Y(() => {
150
+ I();
151
+ }), (f, t) => (V(), k("div", Q, [
152
+ a(e(G), { class: "menu-card" }, {
153
+ default: o(() => [
154
+ n("div", W, [
155
+ a(e(E), {
156
+ type: "primary",
157
+ onClick: t[0] || (t[0] = (l) => B())
158
+ }, {
159
+ default: o(() => [...t[14] || (t[14] = [
160
+ m("新增菜单", -1)
161
+ ])]),
162
+ _: 1
163
+ })
164
+ ]),
165
+ n("div", X, [
166
+ n("table", Z, [
167
+ t[19] || (t[19] = n("thead", null, [
168
+ n("tr", null, [
169
+ n("th", null, "菜单名称"),
170
+ n("th", null, "图标"),
171
+ n("th", null, "路由路径"),
172
+ n("th", null, "类型"),
173
+ n("th", null, "排序"),
174
+ n("th", null, "状态"),
175
+ n("th", null, "操作")
176
+ ])
177
+ ], -1)),
178
+ n("tbody", null, [
179
+ (V(!0), k(g, null, x(C.value, (l) => (V(), k(g, {
180
+ key: l.id
181
+ }, [
182
+ n("tr", ee, [
183
+ n("td", null, [
184
+ n("span", {
185
+ class: "menu-name",
186
+ onClick: (d) => b(l)
187
+ }, i(l.title), 9, te)
188
+ ]),
189
+ n("td", null, i(L(l.icon)), 1),
190
+ n("td", null, i(l.path), 1),
191
+ n("td", null, [
192
+ a(e(c), {
193
+ type: l.type === e(u).DIRECTORY ? "primary" : l.type === e(u).MENU ? "success" : "warning",
194
+ size: "small"
195
+ }, {
196
+ default: o(() => [
197
+ m(i(l.type === e(u).DIRECTORY ? "目录" : l.type === e(u).MENU ? "菜单" : "按钮"), 1)
198
+ ]),
199
+ _: 2
200
+ }, 1032, ["type"])
201
+ ]),
202
+ n("td", null, i(l.sort), 1),
203
+ n("td", null, [
204
+ a(e(c), {
205
+ type: l.status === e(r).ENABLED ? "success" : "danger",
206
+ size: "small"
207
+ }, {
208
+ default: o(() => [
209
+ m(i(l.status === e(r).ENABLED ? "启用" : "禁用"), 1)
210
+ ]),
211
+ _: 2
212
+ }, 1032, ["type"])
213
+ ]),
214
+ n("td", null, [
215
+ a(e(D), null, {
216
+ default: o(() => [
217
+ a(e(E), {
218
+ type: "primary",
219
+ link: "",
220
+ size: "small",
221
+ onClick: (d) => B(l.id)
222
+ }, {
223
+ default: o(() => [...t[15] || (t[15] = [
224
+ m("新增", -1)
225
+ ])]),
226
+ _: 1
227
+ }, 8, ["onClick"]),
228
+ a(e(E), {
229
+ type: "primary",
230
+ link: "",
231
+ size: "small",
232
+ onClick: (d) => b(l)
233
+ }, {
234
+ default: o(() => [...t[16] || (t[16] = [
235
+ m("编辑", -1)
236
+ ])]),
237
+ _: 1
238
+ }, 8, ["onClick"])
239
+ ]),
240
+ _: 2
241
+ }, 1024)
242
+ ])
243
+ ]),
244
+ l.children ? (V(!0), k(g, { key: 0 }, x(l.children, (d) => (V(), k("tr", {
245
+ key: d.id,
246
+ class: "tree-row tree-row--level-1"
247
+ }, [
248
+ n("td", null, [
249
+ t[17] || (t[17] = n("span", { class: "tree-indent" }, null, -1)),
250
+ n("span", {
251
+ class: "menu-name",
252
+ onClick: (_) => b(d)
253
+ }, i(d.title), 9, le)
254
+ ]),
255
+ n("td", null, i(L(d.icon)), 1),
256
+ n("td", null, i(d.path), 1),
257
+ n("td", null, [
258
+ a(e(c), {
259
+ type: d.type === e(u).DIRECTORY ? "primary" : d.type === e(u).MENU ? "success" : "warning",
260
+ size: "small"
261
+ }, {
262
+ default: o(() => [
263
+ m(i(d.type === e(u).DIRECTORY ? "目录" : d.type === e(u).MENU ? "菜单" : "按钮"), 1)
264
+ ]),
265
+ _: 2
266
+ }, 1032, ["type"])
267
+ ]),
268
+ n("td", null, i(d.sort), 1),
269
+ n("td", null, [
270
+ a(e(c), {
271
+ type: d.status === e(r).ENABLED ? "success" : "danger",
272
+ size: "small"
273
+ }, {
274
+ default: o(() => [
275
+ m(i(d.status === e(r).ENABLED ? "启用" : "禁用"), 1)
276
+ ]),
277
+ _: 2
278
+ }, 1032, ["type"])
279
+ ]),
280
+ n("td", null, [
281
+ a(e(D), null, {
282
+ default: o(() => [
283
+ a(e(E), {
284
+ type: "primary",
285
+ link: "",
286
+ size: "small",
287
+ onClick: (_) => b(d)
288
+ }, {
289
+ default: o(() => [...t[18] || (t[18] = [
290
+ m("编辑", -1)
291
+ ])]),
292
+ _: 1
293
+ }, 8, ["onClick"])
294
+ ]),
295
+ _: 2
296
+ }, 1024)
297
+ ])
298
+ ]))), 128)) : h("", !0)
299
+ ], 64))), 128))
300
+ ])
301
+ ])
302
+ ])
303
+ ]),
304
+ _: 1
305
+ }),
306
+ a(e(H), {
307
+ modelValue: y.value,
308
+ "onUpdate:modelValue": t[13] || (t[13] = (l) => y.value = l),
309
+ title: S.value,
310
+ width: "600px"
311
+ }, {
312
+ footer: o(() => [
313
+ a(e(D), null, {
314
+ default: o(() => [
315
+ a(e(E), {
316
+ onClick: t[12] || (t[12] = (l) => y.value = !1)
317
+ }, {
318
+ default: o(() => [...t[20] || (t[20] = [
319
+ m("取消", -1)
320
+ ])]),
321
+ _: 1
322
+ }),
323
+ a(e(E), {
324
+ type: "primary",
325
+ onClick: T
326
+ }, {
327
+ default: o(() => [...t[21] || (t[21] = [
328
+ m("确定", -1)
329
+ ])]),
330
+ _: 1
331
+ })
332
+ ]),
333
+ _: 1
334
+ })
335
+ ]),
336
+ default: o(() => [
337
+ a(e(q), {
338
+ ref_key: "formRef",
339
+ ref: M,
340
+ model: s,
341
+ rules: w,
342
+ "label-width": "80px"
343
+ }, {
344
+ default: o(() => [
345
+ a(e(p), { label: "上级菜单" }, {
346
+ default: o(() => [
347
+ a(e(v), {
348
+ modelValue: s.parentId,
349
+ "onUpdate:modelValue": t[1] || (t[1] = (l) => s.parentId = l),
350
+ placeholder: "上级菜单ID",
351
+ disabled: ""
352
+ }, null, 8, ["modelValue"])
353
+ ]),
354
+ _: 1
355
+ }),
356
+ a(e(p), { label: "菜单类型" }, {
357
+ default: o(() => [
358
+ a(e(F), {
359
+ modelValue: s.type,
360
+ "onUpdate:modelValue": t[2] || (t[2] = (l) => s.type = l),
361
+ options: e(K)
362
+ }, null, 8, ["modelValue", "options"])
363
+ ]),
364
+ _: 1
365
+ }),
366
+ a(e(p), {
367
+ label: "菜单名称",
368
+ prop: "name"
369
+ }, {
370
+ default: o(() => [
371
+ a(e(v), {
372
+ modelValue: s.name,
373
+ "onUpdate:modelValue": t[3] || (t[3] = (l) => s.name = l),
374
+ placeholder: "请输入菜单名称(路由name)"
375
+ }, null, 8, ["modelValue"])
376
+ ]),
377
+ _: 1
378
+ }),
379
+ a(e(p), {
380
+ label: "菜单标题",
381
+ prop: "title"
382
+ }, {
383
+ default: o(() => [
384
+ a(e(v), {
385
+ modelValue: s.title,
386
+ "onUpdate:modelValue": t[4] || (t[4] = (l) => s.title = l),
387
+ placeholder: "请输入菜单标题"
388
+ }, null, 8, ["modelValue"])
389
+ ]),
390
+ _: 1
391
+ }),
392
+ a(e(p), {
393
+ label: "路由路径",
394
+ prop: "path"
395
+ }, {
396
+ default: o(() => [
397
+ a(e(v), {
398
+ modelValue: s.path,
399
+ "onUpdate:modelValue": t[5] || (t[5] = (l) => s.path = l),
400
+ placeholder: "请输入路由路径"
401
+ }, null, 8, ["modelValue"])
402
+ ]),
403
+ _: 1
404
+ }),
405
+ a(e(p), { label: "组件路径" }, {
406
+ default: o(() => [
407
+ a(e(v), {
408
+ modelValue: s.component,
409
+ "onUpdate:modelValue": t[6] || (t[6] = (l) => s.component = l),
410
+ placeholder: "请输入组件路径"
411
+ }, null, 8, ["modelValue"])
412
+ ]),
413
+ _: 1
414
+ }),
415
+ a(e(p), { label: "图标" }, {
416
+ default: o(() => [
417
+ a(e(v), {
418
+ modelValue: s.icon,
419
+ "onUpdate:modelValue": t[7] || (t[7] = (l) => s.icon = l),
420
+ placeholder: "请输入图标名称"
421
+ }, null, 8, ["modelValue"])
422
+ ]),
423
+ _: 1
424
+ }),
425
+ a(e(p), { label: "排序" }, {
426
+ default: o(() => [
427
+ a(e(j), {
428
+ modelValue: s.sort,
429
+ "onUpdate:modelValue": t[8] || (t[8] = (l) => s.sort = l),
430
+ min: 0
431
+ }, null, 8, ["modelValue"])
432
+ ]),
433
+ _: 1
434
+ }),
435
+ a(e(p), { label: "状态" }, {
436
+ default: o(() => [
437
+ a(e(A), {
438
+ modelValue: s.status,
439
+ "onUpdate:modelValue": t[9] || (t[9] = (l) => s.status = l),
440
+ "active-value": e(r).ENABLED,
441
+ "inactive-value": e(r).DISABLED
442
+ }, null, 8, ["modelValue", "active-value", "inactive-value"])
443
+ ]),
444
+ _: 1
445
+ }),
446
+ a(e(p), { label: "隐藏" }, {
447
+ default: o(() => [
448
+ a(e(A), {
449
+ modelValue: s.hidden,
450
+ "onUpdate:modelValue": t[10] || (t[10] = (l) => s.hidden = l)
451
+ }, null, 8, ["modelValue"])
452
+ ]),
453
+ _: 1
454
+ }),
455
+ a(e(p), { label: "缓存" }, {
456
+ default: o(() => [
457
+ a(e(A), {
458
+ modelValue: s.keepAlive,
459
+ "onUpdate:modelValue": t[11] || (t[11] = (l) => s.keepAlive = l)
460
+ }, null, 8, ["modelValue"])
461
+ ]),
462
+ _: 1
463
+ })
464
+ ]),
465
+ _: 1
466
+ }, 8, ["model"])
467
+ ]),
468
+ _: 1
469
+ }, 8, ["modelValue", "title"])
470
+ ]));
471
+ }
472
+ }), pe = /* @__PURE__ */ P(ae, [["__scopeId", "data-v-2a272a68"]]);
473
+ export {
474
+ pe as default
475
+ };