xto-fronted 0.4.94 → 0.4.96

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,641 @@
1
+ import { defineComponent as $, ref as V, computed as O, reactive as H, onMounted as q, openBlock as f, createElementBlock as v, createElementVNode as e, createVNode as o, unref as s, withCtx as a, createTextVNode as m, toDisplayString as d, Fragment as C, renderList as U, createCommentVNode as F } from "vue";
2
+ import { Form as Y, FormItem as p, Input as _, Select as j, InputNumber as G, Switch as M } from "@xto/form";
3
+ import { Tag as E } from "@xto/data";
4
+ import { Modal as J, Message as K } from "@xto/feedback";
5
+ import { Button as h, Space as N } from "@xto/base";
6
+ import { S as r, M as c, b as P, _ as Q } from "./index-CVH7bDsl.js";
7
+ const W = { class: "menu-page" }, X = { class: "table-section" }, Z = { class: "table-toolbar" }, ee = { class: "toolbar-left" }, te = { class: "toolbar-right" }, se = { class: "table-count" }, le = { class: "table-wrapper" }, oe = { class: "data-table" }, ae = { key: 0 }, ne = { key: 1 }, de = { class: "data-row tree-row--level-0" }, ie = { class: "col-name" }, re = { class: "menu-info" }, ue = { class: "menu-icon-wrapper" }, pe = ["onClick"], ce = { class: "col-icon" }, me = { class: "icon-text" }, fe = { class: "col-path" }, ve = { class: "path-code" }, ye = { class: "col-type" }, _e = { class: "col-sort" }, he = { class: "sort-badge" }, ke = { class: "col-status" }, be = { class: "col-actions" }, ge = { class: "col-name" }, Ve = { class: "menu-info" }, Ee = { class: "menu-icon-wrapper" }, xe = ["onClick"], Ce = { class: "col-icon" }, Me = { class: "icon-text" }, Ne = { class: "col-path" }, we = { class: "path-code" }, Ae = { class: "col-type" }, Be = { class: "col-sort" }, De = { class: "sort-badge" }, Le = { class: "col-status" }, Ue = { class: "col-actions" }, Ie = { class: "form-grid" }, Te = { class: "status-field" }, Se = { class: "status-label" }, ze = { class: "status-field" }, Re = { class: "status-label" }, $e = { class: "status-field" }, Oe = { class: "status-label" }, He = /* @__PURE__ */ $({
8
+ __name: "index",
9
+ setup(qe) {
10
+ const I = [
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: c.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: c.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: c.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: c.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: c.MENU,
81
+ sort: 3,
82
+ status: r.ENABLED,
83
+ hidden: !1,
84
+ keepAlive: !0
85
+ }
86
+ ]
87
+ }
88
+ ], x = V(!1), k = V([]), y = V(!1), T = O(() => n.id ? "编辑菜单" : "新增菜单"), n = H({
89
+ id: 0,
90
+ parentId: null,
91
+ name: "",
92
+ path: "",
93
+ component: "",
94
+ redirect: "",
95
+ icon: "",
96
+ title: "",
97
+ type: c.MENU,
98
+ sort: 0,
99
+ status: r.ENABLED,
100
+ hidden: !1,
101
+ keepAlive: !0
102
+ }), S = {
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
+ }, w = V(), A = () => {
113
+ x.value = !0, setTimeout(() => {
114
+ k.value = I, x.value = !1;
115
+ }, 300);
116
+ }, B = (u = null) => {
117
+ Object.assign(n, {
118
+ id: 0,
119
+ parentId: u,
120
+ name: "",
121
+ path: "",
122
+ component: "",
123
+ redirect: "",
124
+ icon: "",
125
+ title: "",
126
+ type: c.MENU,
127
+ sort: 0,
128
+ status: r.ENABLED,
129
+ hidden: !1,
130
+ keepAlive: !0
131
+ }), y.value = !0;
132
+ }, b = (u) => {
133
+ Object.assign(n, u), y.value = !0;
134
+ }, z = async () => {
135
+ var u;
136
+ try {
137
+ await ((u = w.value) == null ? void 0 : u.validate()), K.success(n.id ? "编辑成功" : "新增成功"), y.value = !1, A();
138
+ } catch (t) {
139
+ console.error(t);
140
+ }
141
+ }, g = (u) => ({
142
+ dashboard: "📊",
143
+ system: "⚙️",
144
+ user: "👤",
145
+ role: "👥",
146
+ menu: "📋",
147
+ setting: "🔧"
148
+ })[u || ""] || "📄", D = (u) => {
149
+ switch (u) {
150
+ case c.DIRECTORY:
151
+ return "primary";
152
+ case c.MENU:
153
+ return "success";
154
+ default:
155
+ return "warning";
156
+ }
157
+ }, L = (u) => {
158
+ switch (u) {
159
+ case c.DIRECTORY:
160
+ return "目录";
161
+ case c.MENU:
162
+ return "菜单";
163
+ default:
164
+ return "按钮";
165
+ }
166
+ };
167
+ return q(() => {
168
+ A();
169
+ }), (u, t) => (f(), v("div", W, [
170
+ e("div", X, [
171
+ e("div", Z, [
172
+ e("div", ee, [
173
+ o(s(h), {
174
+ type: "primary",
175
+ onClick: t[0] || (t[0] = (l) => B())
176
+ }, {
177
+ icon: a(() => [...t[14] || (t[14] = [
178
+ e("svg", {
179
+ viewBox: "0 0 24 24",
180
+ fill: "none",
181
+ stroke: "currentColor",
182
+ "stroke-width": "2"
183
+ }, [
184
+ e("line", {
185
+ x1: "12",
186
+ y1: "5",
187
+ x2: "12",
188
+ y2: "19"
189
+ }),
190
+ e("line", {
191
+ x1: "5",
192
+ y1: "12",
193
+ x2: "19",
194
+ y2: "12"
195
+ })
196
+ ], -1)
197
+ ])]),
198
+ default: a(() => [
199
+ t[15] || (t[15] = m(" 新增菜单 ", -1))
200
+ ]),
201
+ _: 1
202
+ })
203
+ ]),
204
+ e("div", te, [
205
+ e("span", se, "共 " + d(k.value.length) + " 个菜单", 1)
206
+ ])
207
+ ]),
208
+ e("div", le, [
209
+ e("table", oe, [
210
+ t[26] || (t[26] = e("thead", null, [
211
+ e("tr", null, [
212
+ e("th", { class: "col-name" }, "菜单名称"),
213
+ e("th", { class: "col-icon" }, "图标"),
214
+ e("th", { class: "col-path" }, "路由路径"),
215
+ e("th", { class: "col-type" }, "类型"),
216
+ e("th", { class: "col-sort" }, "排序"),
217
+ e("th", { class: "col-status" }, "状态"),
218
+ e("th", { class: "col-actions" }, "操作")
219
+ ])
220
+ ], -1)),
221
+ e("tbody", null, [
222
+ x.value ? (f(), v("tr", ae, [...t[16] || (t[16] = [
223
+ e("td", {
224
+ colspan: "7",
225
+ class: "loading-cell"
226
+ }, [
227
+ e("div", { class: "loading-content" }, [
228
+ e("div", { class: "loading-spinner" }),
229
+ e("span", null, "加载中...")
230
+ ])
231
+ ], -1)
232
+ ])])) : k.value.length === 0 ? (f(), v("tr", ne, [...t[17] || (t[17] = [
233
+ e("td", {
234
+ colspan: "7",
235
+ class: "empty-cell"
236
+ }, [
237
+ e("div", { class: "empty-content" }, [
238
+ e("svg", {
239
+ viewBox: "0 0 64 41",
240
+ fill: "none"
241
+ }, [
242
+ e("g", { transform: "translate(0 1)" }, [
243
+ e("ellipse", {
244
+ fill: "#f5f5f5",
245
+ cx: "32",
246
+ cy: "33",
247
+ rx: "32",
248
+ ry: "7"
249
+ }),
250
+ e("g", {
251
+ stroke: "var(--color-text-placeholder)",
252
+ "stroke-width": "2"
253
+ }, [
254
+ e("path", { d: "M55 12.76L44.854 1.258C44.367.474 43.656 0 42.907 0H21.093c-.749 0-1.46.474-1.947 1.257L9 12.761V22h46v-9.24z" }),
255
+ e("path", {
256
+ d: "M41.613 15.931c0-1.605.994-2.93 2.227-2.931H55v18.137C55 33.26 53.68 35 52.05 35H11.95C10.32 35 9 33.259 9 31.137V13h11.16c1.233 0 2.227 1.323 2.227 2.928v.022c0 1.605 1.005 2.901 2.237 2.901h14.752c1.232 0 2.237-1.308 2.237-2.913v-.007z",
257
+ fill: "var(--color-fill)"
258
+ })
259
+ ])
260
+ ])
261
+ ]),
262
+ e("span", null, "暂无数据")
263
+ ])
264
+ ], -1)
265
+ ])])) : (f(!0), v(C, { key: 2 }, U(k.value, (l) => (f(), v(C, {
266
+ key: l.id
267
+ }, [
268
+ e("tr", de, [
269
+ e("td", ie, [
270
+ e("div", re, [
271
+ e("span", ue, d(g(l.icon)), 1),
272
+ e("span", {
273
+ class: "menu-title",
274
+ onClick: (i) => b(l)
275
+ }, d(l.title), 9, pe)
276
+ ])
277
+ ]),
278
+ e("td", ce, [
279
+ e("span", me, d(g(l.icon)), 1)
280
+ ]),
281
+ e("td", fe, [
282
+ e("code", ve, d(l.path), 1)
283
+ ]),
284
+ e("td", ye, [
285
+ o(s(E), {
286
+ type: D(l.type),
287
+ size: "small"
288
+ }, {
289
+ default: a(() => [
290
+ m(d(L(l.type)), 1)
291
+ ]),
292
+ _: 2
293
+ }, 1032, ["type"])
294
+ ]),
295
+ e("td", _e, [
296
+ e("span", he, d(l.sort), 1)
297
+ ]),
298
+ e("td", ke, [
299
+ o(s(E), {
300
+ type: l.status === s(r).ENABLED ? "success" : "danger",
301
+ size: "small"
302
+ }, {
303
+ default: a(() => [
304
+ m(d(l.status === s(r).ENABLED ? "启用" : "禁用"), 1)
305
+ ]),
306
+ _: 2
307
+ }, 1032, ["type"])
308
+ ]),
309
+ e("td", be, [
310
+ o(s(N), { class: "action-buttons" }, {
311
+ default: a(() => [
312
+ o(s(h), {
313
+ type: "primary",
314
+ link: "",
315
+ size: "small",
316
+ onClick: (i) => B(l.id)
317
+ }, {
318
+ icon: a(() => [...t[18] || (t[18] = [
319
+ e("svg", {
320
+ viewBox: "0 0 24 24",
321
+ fill: "none",
322
+ stroke: "currentColor",
323
+ "stroke-width": "2"
324
+ }, [
325
+ e("line", {
326
+ x1: "12",
327
+ y1: "5",
328
+ x2: "12",
329
+ y2: "19"
330
+ }),
331
+ e("line", {
332
+ x1: "5",
333
+ y1: "12",
334
+ x2: "19",
335
+ y2: "12"
336
+ })
337
+ ], -1)
338
+ ])]),
339
+ default: a(() => [
340
+ t[19] || (t[19] = m(" 新增 ", -1))
341
+ ]),
342
+ _: 1
343
+ }, 8, ["onClick"]),
344
+ o(s(h), {
345
+ type: "primary",
346
+ link: "",
347
+ size: "small",
348
+ onClick: (i) => b(l)
349
+ }, {
350
+ icon: a(() => [...t[20] || (t[20] = [
351
+ e("svg", {
352
+ viewBox: "0 0 24 24",
353
+ fill: "none",
354
+ stroke: "currentColor",
355
+ "stroke-width": "2"
356
+ }, [
357
+ e("path", { d: "M11 4H4a2 2 0 00-2 2v14a2 2 0 002 2h14a2 2 0 002-2v-7" }),
358
+ e("path", { d: "M18.5 2.5a2.121 2.121 0 013 3L12 15l-4 1 1-4 9.5-9.5z" })
359
+ ], -1)
360
+ ])]),
361
+ default: a(() => [
362
+ t[21] || (t[21] = m(" 编辑 ", -1))
363
+ ]),
364
+ _: 1
365
+ }, 8, ["onClick"])
366
+ ]),
367
+ _: 2
368
+ }, 1024)
369
+ ])
370
+ ]),
371
+ l.children ? (f(!0), v(C, { key: 0 }, U(l.children, (i) => (f(), v("tr", {
372
+ key: i.id,
373
+ class: "data-row tree-row--level-1"
374
+ }, [
375
+ e("td", ge, [
376
+ e("div", Ve, [
377
+ t[22] || (t[22] = e("span", { class: "tree-indent" }, null, -1)),
378
+ t[23] || (t[23] = e("span", { class: "tree-line" }, null, -1)),
379
+ e("span", Ee, d(g(i.icon)), 1),
380
+ e("span", {
381
+ class: "menu-title",
382
+ onClick: (R) => b(i)
383
+ }, d(i.title), 9, xe)
384
+ ])
385
+ ]),
386
+ e("td", Ce, [
387
+ e("span", Me, d(g(i.icon)), 1)
388
+ ]),
389
+ e("td", Ne, [
390
+ e("code", we, d(i.path), 1)
391
+ ]),
392
+ e("td", Ae, [
393
+ o(s(E), {
394
+ type: D(i.type),
395
+ size: "small"
396
+ }, {
397
+ default: a(() => [
398
+ m(d(L(i.type)), 1)
399
+ ]),
400
+ _: 2
401
+ }, 1032, ["type"])
402
+ ]),
403
+ e("td", Be, [
404
+ e("span", De, d(i.sort), 1)
405
+ ]),
406
+ e("td", Le, [
407
+ o(s(E), {
408
+ type: i.status === s(r).ENABLED ? "success" : "danger",
409
+ size: "small"
410
+ }, {
411
+ default: a(() => [
412
+ m(d(i.status === s(r).ENABLED ? "启用" : "禁用"), 1)
413
+ ]),
414
+ _: 2
415
+ }, 1032, ["type"])
416
+ ]),
417
+ e("td", Ue, [
418
+ o(s(N), { class: "action-buttons" }, {
419
+ default: a(() => [
420
+ o(s(h), {
421
+ type: "primary",
422
+ link: "",
423
+ size: "small",
424
+ onClick: (R) => b(i)
425
+ }, {
426
+ icon: a(() => [...t[24] || (t[24] = [
427
+ e("svg", {
428
+ viewBox: "0 0 24 24",
429
+ fill: "none",
430
+ stroke: "currentColor",
431
+ "stroke-width": "2"
432
+ }, [
433
+ e("path", { d: "M11 4H4a2 2 0 00-2 2v14a2 2 0 002 2h14a2 2 0 002-2v-7" }),
434
+ e("path", { d: "M18.5 2.5a2.121 2.121 0 013 3L12 15l-4 1 1-4 9.5-9.5z" })
435
+ ], -1)
436
+ ])]),
437
+ default: a(() => [
438
+ t[25] || (t[25] = m(" 编辑 ", -1))
439
+ ]),
440
+ _: 1
441
+ }, 8, ["onClick"])
442
+ ]),
443
+ _: 2
444
+ }, 1024)
445
+ ])
446
+ ]))), 128)) : F("", !0)
447
+ ], 64))), 128))
448
+ ])
449
+ ])
450
+ ])
451
+ ]),
452
+ o(s(J), {
453
+ modelValue: y.value,
454
+ "onUpdate:modelValue": t[13] || (t[13] = (l) => y.value = l),
455
+ title: T.value,
456
+ width: "600px",
457
+ class: "menu-modal"
458
+ }, {
459
+ footer: a(() => [
460
+ o(s(N), null, {
461
+ default: a(() => [
462
+ o(s(h), {
463
+ onClick: t[12] || (t[12] = (l) => y.value = !1)
464
+ }, {
465
+ default: a(() => [...t[27] || (t[27] = [
466
+ m("取消", -1)
467
+ ])]),
468
+ _: 1
469
+ }),
470
+ o(s(h), {
471
+ type: "primary",
472
+ onClick: z
473
+ }, {
474
+ default: a(() => [...t[28] || (t[28] = [
475
+ m("确定", -1)
476
+ ])]),
477
+ _: 1
478
+ })
479
+ ]),
480
+ _: 1
481
+ })
482
+ ]),
483
+ default: a(() => [
484
+ o(s(Y), {
485
+ ref_key: "formRef",
486
+ ref: w,
487
+ model: n,
488
+ rules: S,
489
+ "label-width": "80px",
490
+ class: "menu-form"
491
+ }, {
492
+ default: a(() => [
493
+ e("div", Ie, [
494
+ o(s(p), {
495
+ label: "上级菜单",
496
+ class: "form-item-full"
497
+ }, {
498
+ default: a(() => [
499
+ o(s(_), {
500
+ modelValue: n.parentId,
501
+ "onUpdate:modelValue": t[1] || (t[1] = (l) => n.parentId = l),
502
+ placeholder: "上级菜单ID",
503
+ disabled: ""
504
+ }, null, 8, ["modelValue"])
505
+ ]),
506
+ _: 1
507
+ }),
508
+ o(s(p), { label: "菜单类型" }, {
509
+ default: a(() => [
510
+ o(s(j), {
511
+ modelValue: n.type,
512
+ "onUpdate:modelValue": t[2] || (t[2] = (l) => n.type = l),
513
+ options: s(P)
514
+ }, null, 8, ["modelValue", "options"])
515
+ ]),
516
+ _: 1
517
+ }),
518
+ o(s(p), { label: "排序" }, {
519
+ default: a(() => [
520
+ o(s(G), {
521
+ modelValue: n.sort,
522
+ "onUpdate:modelValue": t[3] || (t[3] = (l) => n.sort = l),
523
+ min: 0
524
+ }, null, 8, ["modelValue"])
525
+ ]),
526
+ _: 1
527
+ }),
528
+ o(s(p), {
529
+ label: "菜单名称",
530
+ prop: "name"
531
+ }, {
532
+ default: a(() => [
533
+ o(s(_), {
534
+ modelValue: n.name,
535
+ "onUpdate:modelValue": t[4] || (t[4] = (l) => n.name = l),
536
+ placeholder: "请输入菜单名称(路由name)"
537
+ }, null, 8, ["modelValue"])
538
+ ]),
539
+ _: 1
540
+ }),
541
+ o(s(p), {
542
+ label: "菜单标题",
543
+ prop: "title"
544
+ }, {
545
+ default: a(() => [
546
+ o(s(_), {
547
+ modelValue: n.title,
548
+ "onUpdate:modelValue": t[5] || (t[5] = (l) => n.title = l),
549
+ placeholder: "请输入菜单标题"
550
+ }, null, 8, ["modelValue"])
551
+ ]),
552
+ _: 1
553
+ }),
554
+ o(s(p), {
555
+ label: "路由路径",
556
+ prop: "path",
557
+ class: "form-item-full"
558
+ }, {
559
+ default: a(() => [
560
+ o(s(_), {
561
+ modelValue: n.path,
562
+ "onUpdate:modelValue": t[6] || (t[6] = (l) => n.path = l),
563
+ placeholder: "请输入路由路径"
564
+ }, null, 8, ["modelValue"])
565
+ ]),
566
+ _: 1
567
+ }),
568
+ o(s(p), {
569
+ label: "组件路径",
570
+ class: "form-item-full"
571
+ }, {
572
+ default: a(() => [
573
+ o(s(_), {
574
+ modelValue: n.component,
575
+ "onUpdate:modelValue": t[7] || (t[7] = (l) => n.component = l),
576
+ placeholder: "请输入组件路径"
577
+ }, null, 8, ["modelValue"])
578
+ ]),
579
+ _: 1
580
+ }),
581
+ o(s(p), { label: "图标" }, {
582
+ default: a(() => [
583
+ o(s(_), {
584
+ modelValue: n.icon,
585
+ "onUpdate:modelValue": t[8] || (t[8] = (l) => n.icon = l),
586
+ placeholder: "请输入图标名称"
587
+ }, null, 8, ["modelValue"])
588
+ ]),
589
+ _: 1
590
+ }),
591
+ o(s(p), { label: "状态" }, {
592
+ default: a(() => [
593
+ e("div", Te, [
594
+ o(s(M), {
595
+ modelValue: n.status,
596
+ "onUpdate:modelValue": t[9] || (t[9] = (l) => n.status = l),
597
+ "active-value": s(r).ENABLED,
598
+ "inactive-value": s(r).DISABLED
599
+ }, null, 8, ["modelValue", "active-value", "inactive-value"]),
600
+ e("span", Se, d(n.status === s(r).ENABLED ? "启用" : "禁用"), 1)
601
+ ])
602
+ ]),
603
+ _: 1
604
+ }),
605
+ o(s(p), { label: "隐藏" }, {
606
+ default: a(() => [
607
+ e("div", ze, [
608
+ o(s(M), {
609
+ modelValue: n.hidden,
610
+ "onUpdate:modelValue": t[10] || (t[10] = (l) => n.hidden = l)
611
+ }, null, 8, ["modelValue"]),
612
+ e("span", Re, d(n.hidden ? "隐藏" : "显示"), 1)
613
+ ])
614
+ ]),
615
+ _: 1
616
+ }),
617
+ o(s(p), { label: "缓存" }, {
618
+ default: a(() => [
619
+ e("div", $e, [
620
+ o(s(M), {
621
+ modelValue: n.keepAlive,
622
+ "onUpdate:modelValue": t[11] || (t[11] = (l) => n.keepAlive = l)
623
+ }, null, 8, ["modelValue"]),
624
+ e("span", Oe, d(n.keepAlive ? "开启" : "关闭"), 1)
625
+ ])
626
+ ]),
627
+ _: 1
628
+ })
629
+ ])
630
+ ]),
631
+ _: 1
632
+ }, 8, ["model"])
633
+ ]),
634
+ _: 1
635
+ }, 8, ["modelValue", "title"])
636
+ ]));
637
+ }
638
+ }), Pe = /* @__PURE__ */ Q(He, [["__scopeId", "data-v-fcdec27c"]]);
639
+ export {
640
+ Pe as default
641
+ };