xto-fronted 0.4.52 → 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.
@@ -1,5 +1,5 @@
1
1
  declare const _default: import('vue').DefineComponent<{}, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {
2
- dropdownRef: HTMLDivElement;
3
2
  searchRef: HTMLDivElement;
3
+ dropdownRef: HTMLDivElement;
4
4
  }, HTMLDivElement>;
5
5
  export default _default;
@@ -0,0 +1,142 @@
1
+ import { defineComponent as g, ref as r, resolveComponent as x, openBlock as o, createElementBlock as c, createElementVNode as s, Fragment as d, renderList as m, createBlock as u, unref as l, withCtx as i, normalizeStyle as p, toDisplayString as a, createVNode as n, createTextVNode as q } from "vue";
2
+ import { Card as _, Tag as C, Progress as y } from "@xto/data";
3
+ import { _ as V } from "./index-DbEeir7h.js";
4
+ const B = { class: "dashboard" }, L = { class: "dashboard__stats" }, N = { class: "stat-card__content" }, S = { class: "stat-card__info" }, w = { class: "stat-card__title" }, z = { class: "dashboard__main" }, E = { class: "quick-links" }, I = { class: "quick-link__icon" }, T = { class: "quick-link__title" }, D = { class: "activity-list" }, F = { class: "activity-item__action" }, P = { class: "activity-item__time" }, U = { class: "system-info" }, j = { class: "system-info__item" }, A = { class: "system-info__item" }, G = /* @__PURE__ */ g({
5
+ __name: "index",
6
+ setup(H) {
7
+ const f = r([
8
+ { title: "用户总数", value: 1234, icon: "👥", color: "#409eff" },
9
+ { title: "今日访问", value: 567, icon: "👀", color: "#67c23a" },
10
+ { title: "订单数量", value: 890, icon: "📦", color: "#e6a23c" },
11
+ { title: "销售金额", value: 123456, icon: "💰", color: "#f56c6c" }
12
+ ]), v = r([
13
+ { user: "张三", action: "登录系统", time: "2分钟前", type: "success" },
14
+ { user: "李四", action: "修改了用户信息", time: "5分钟前", type: "warning" },
15
+ { user: "王五", action: "创建了新订单", time: "10分钟前", type: "info" },
16
+ { user: "赵六", action: "删除了测试数据", time: "30分钟前", type: "danger" },
17
+ { user: "钱七", action: "更新了系统配置", time: "1小时前", type: "primary" }
18
+ ]), k = r([
19
+ { title: "用户管理", path: "/system/user", icon: "👤" },
20
+ { title: "角色管理", path: "/system/role", icon: "👥" },
21
+ { title: "菜单管理", path: "/system/menu", icon: "📋" },
22
+ { title: "系统设置", path: "/system", icon: "⚙️" }
23
+ ]);
24
+ return (J, t) => {
25
+ const b = x("router-link");
26
+ return o(), c("div", B, [
27
+ s("div", L, [
28
+ (o(!0), c(d, null, m(f.value, (e) => (o(), u(l(_), {
29
+ key: e.title,
30
+ class: "stat-card"
31
+ }, {
32
+ default: i(() => [
33
+ s("div", N, [
34
+ s("div", {
35
+ class: "stat-card__icon",
36
+ style: p({ backgroundColor: e.color + "20" })
37
+ }, a(e.icon), 5),
38
+ s("div", S, [
39
+ s("div", w, a(e.title), 1),
40
+ s("div", {
41
+ class: "stat-card__value",
42
+ style: p({ color: e.color })
43
+ }, a(e.value.toLocaleString()), 5)
44
+ ])
45
+ ])
46
+ ]),
47
+ _: 2
48
+ }, 1024))), 128))
49
+ ]),
50
+ s("div", z, [
51
+ n(l(_), { class: "dashboard__quick" }, {
52
+ header: i(() => [...t[0] || (t[0] = [
53
+ s("span", { class: "card-title" }, "快捷入口", -1)
54
+ ])]),
55
+ default: i(() => [
56
+ s("div", E, [
57
+ (o(!0), c(d, null, m(k.value, (e) => (o(), u(b, {
58
+ key: e.path,
59
+ to: e.path,
60
+ class: "quick-link"
61
+ }, {
62
+ default: i(() => [
63
+ s("span", I, a(e.icon), 1),
64
+ s("span", T, a(e.title), 1)
65
+ ]),
66
+ _: 2
67
+ }, 1032, ["to"]))), 128))
68
+ ])
69
+ ]),
70
+ _: 1
71
+ }),
72
+ n(l(_), { class: "dashboard__activity" }, {
73
+ header: i(() => [...t[1] || (t[1] = [
74
+ s("span", { class: "card-title" }, "最近活动", -1)
75
+ ])]),
76
+ default: i(() => [
77
+ s("div", D, [
78
+ (o(!0), c(d, null, m(v.value, (e, h) => (o(), c("div", {
79
+ key: h,
80
+ class: "activity-item"
81
+ }, [
82
+ n(l(C), {
83
+ type: e.type,
84
+ size: "small"
85
+ }, {
86
+ default: i(() => [
87
+ q(a(e.user), 1)
88
+ ]),
89
+ _: 2
90
+ }, 1032, ["type"]),
91
+ s("span", F, a(e.action), 1),
92
+ s("span", P, a(e.time), 1)
93
+ ]))), 128))
94
+ ])
95
+ ]),
96
+ _: 1
97
+ })
98
+ ]),
99
+ n(l(_), { class: "dashboard__system" }, {
100
+ header: i(() => [...t[2] || (t[2] = [
101
+ s("span", { class: "card-title" }, "系统信息", -1)
102
+ ])]),
103
+ default: i(() => [
104
+ s("div", U, [
105
+ t[5] || (t[5] = s("div", { class: "system-info__item" }, [
106
+ s("span", { class: "system-info__label" }, "系统版本"),
107
+ s("span", { class: "system-info__value" }, "v1.0.0")
108
+ ], -1)),
109
+ t[6] || (t[6] = s("div", { class: "system-info__item" }, [
110
+ s("span", { class: "system-info__label" }, "Vue 版本"),
111
+ s("span", { class: "system-info__value" }, "3.4.21")
112
+ ], -1)),
113
+ t[7] || (t[7] = s("div", { class: "system-info__item" }, [
114
+ s("span", { class: "system-info__label" }, "构建工具"),
115
+ s("span", { class: "system-info__value" }, "Vite 5")
116
+ ], -1)),
117
+ t[8] || (t[8] = s("div", { class: "system-info__item" }, [
118
+ s("span", { class: "system-info__label" }, "UI 组件库"),
119
+ s("span", { class: "system-info__value" }, "xto")
120
+ ], -1)),
121
+ s("div", j, [
122
+ t[3] || (t[3] = s("span", { class: "system-info__label" }, "服务器状态", -1)),
123
+ n(l(y), {
124
+ percentage: 75,
125
+ status: "success"
126
+ })
127
+ ]),
128
+ s("div", A, [
129
+ t[4] || (t[4] = s("span", { class: "system-info__label" }, "内存使用", -1)),
130
+ n(l(y), { percentage: 45 })
131
+ ])
132
+ ])
133
+ ]),
134
+ _: 1
135
+ })
136
+ ]);
137
+ };
138
+ }
139
+ }), Q = /* @__PURE__ */ V(G, [["__scopeId", "data-v-44648cb1"]]);
140
+ export {
141
+ Q as default
142
+ };
@@ -0,0 +1,345 @@
1
+ import { defineComponent as j, ref as p, reactive as z, computed as q, onMounted as K, openBlock as V, createElementBlock as k, createVNode as t, unref as l, withCtx as o, withKeys as G, createTextVNode as i, createElementVNode as s, Fragment as H, renderList as J, toDisplayString as y } from "vue";
2
+ import { Form as N, FormItem as f, Input as E, Select as Q, Switch as W } from "@xto/form";
3
+ import { Card as x, Tag as A, Pagination as X } from "@xto/data";
4
+ import { Popconfirm as Y, Modal as Z, Message as U } from "@xto/feedback";
5
+ import { Space as S, Button as v } from "@xto/base";
6
+ import { S as r, a as h, _ as ee } from "./index-DbEeir7h.js";
7
+ const le = { class: "role-page" }, te = { class: "toolbar" }, ae = { class: "data-table" }, oe = { key: 0 }, se = { key: 1 }, ne = { class: "pagination-wrapper" }, de = /* @__PURE__ */ j({
8
+ __name: "index",
9
+ setup(ue) {
10
+ const T = [
11
+ { id: 1, name: "超级管理员", code: "admin", description: "拥有所有权限", status: r.ENABLED, permissions: ["*"], createTime: "2024-01-01 10:00:00" },
12
+ { id: 2, name: "编辑", code: "editor", description: "内容编辑权限", status: r.ENABLED, permissions: ["user:read", "user:write"], createTime: "2024-01-02 10:00:00" },
13
+ { id: 3, name: "访客", code: "viewer", description: "只读权限", status: r.ENABLED, permissions: ["user:read"], createTime: "2024-01-03 10:00:00" }
14
+ ], C = p(!1), D = p([]), B = p(0), c = p(1), b = p(10), u = z({
15
+ keyword: "",
16
+ status: void 0
17
+ }), g = p(!1), w = q(() => n.id ? "编辑角色" : "新增角色"), n = z({
18
+ id: 0,
19
+ name: "",
20
+ code: "",
21
+ description: "",
22
+ status: r.ENABLED,
23
+ permissions: []
24
+ }), I = {
25
+ name: [
26
+ { required: !0, message: "请输入角色名称", trigger: "blur" }
27
+ ],
28
+ code: [
29
+ { required: !0, message: "请输入角色编码", trigger: "blur" }
30
+ ]
31
+ }, L = p(), m = () => {
32
+ C.value = !0, setTimeout(() => {
33
+ let d = [...T];
34
+ u.keyword && (d = d.filter(
35
+ (e) => e.name.includes(u.keyword) || e.code.includes(u.keyword)
36
+ )), u.status !== void 0 && (d = d.filter((e) => e.status === u.status)), B.value = d.length, D.value = d.slice((c.value - 1) * b.value, c.value * b.value), C.value = !1;
37
+ }, 300);
38
+ }, _ = () => {
39
+ c.value = 1, m();
40
+ }, R = () => {
41
+ u.keyword = "", u.status = void 0, c.value = 1, m();
42
+ }, F = () => {
43
+ Object.assign(n, {
44
+ id: 0,
45
+ name: "",
46
+ code: "",
47
+ description: "",
48
+ status: r.ENABLED,
49
+ permissions: []
50
+ }), g.value = !0;
51
+ }, P = (d) => {
52
+ Object.assign(n, d), g.value = !0;
53
+ }, M = (d) => {
54
+ U.success("删除成功"), m();
55
+ }, O = async () => {
56
+ var d;
57
+ try {
58
+ await ((d = L.value) == null ? void 0 : d.validate()), U.success(n.id ? "编辑成功" : "新增成功"), g.value = !1, m();
59
+ } catch (e) {
60
+ console.error(e);
61
+ }
62
+ };
63
+ return K(() => {
64
+ m();
65
+ }), (d, e) => (V(), k("div", le, [
66
+ t(l(x), { class: "search-card" }, {
67
+ default: o(() => [
68
+ t(l(N), {
69
+ model: u,
70
+ inline: ""
71
+ }, {
72
+ default: o(() => [
73
+ t(l(f), { label: "关键词" }, {
74
+ default: o(() => [
75
+ t(l(E), {
76
+ modelValue: u.keyword,
77
+ "onUpdate:modelValue": e[0] || (e[0] = (a) => u.keyword = a),
78
+ placeholder: "角色名称/编码",
79
+ clearable: "",
80
+ onKeyup: G(_, ["enter"])
81
+ }, null, 8, ["modelValue"])
82
+ ]),
83
+ _: 1
84
+ }),
85
+ t(l(f), { label: "状态" }, {
86
+ default: o(() => [
87
+ t(l(Q), {
88
+ modelValue: u.status,
89
+ "onUpdate:modelValue": e[1] || (e[1] = (a) => u.status = a),
90
+ options: l(h),
91
+ placeholder: "请选择",
92
+ clearable: ""
93
+ }, null, 8, ["modelValue", "options"])
94
+ ]),
95
+ _: 1
96
+ }),
97
+ t(l(f), null, {
98
+ default: o(() => [
99
+ t(l(S), null, {
100
+ default: o(() => [
101
+ t(l(v), {
102
+ type: "primary",
103
+ onClick: _
104
+ }, {
105
+ default: o(() => [...e[10] || (e[10] = [
106
+ i("搜索", -1)
107
+ ])]),
108
+ _: 1
109
+ }),
110
+ t(l(v), { onClick: R }, {
111
+ default: o(() => [...e[11] || (e[11] = [
112
+ i("重置", -1)
113
+ ])]),
114
+ _: 1
115
+ })
116
+ ]),
117
+ _: 1
118
+ })
119
+ ]),
120
+ _: 1
121
+ })
122
+ ]),
123
+ _: 1
124
+ }, 8, ["model"])
125
+ ]),
126
+ _: 1
127
+ }),
128
+ t(l(x), { class: "table-card" }, {
129
+ default: o(() => [
130
+ s("div", te, [
131
+ t(l(v), {
132
+ type: "primary",
133
+ onClick: F
134
+ }, {
135
+ default: o(() => [...e[12] || (e[12] = [
136
+ i("新增角色", -1)
137
+ ])]),
138
+ _: 1
139
+ })
140
+ ]),
141
+ s("table", ae, [
142
+ e[17] || (e[17] = s("thead", null, [
143
+ s("tr", null, [
144
+ s("th", null, "ID"),
145
+ s("th", null, "角色名称"),
146
+ s("th", null, "角色编码"),
147
+ s("th", null, "描述"),
148
+ s("th", null, "状态"),
149
+ s("th", null, "创建时间"),
150
+ s("th", null, "操作")
151
+ ])
152
+ ], -1)),
153
+ s("tbody", null, [
154
+ C.value ? (V(), k("tr", oe, [...e[13] || (e[13] = [
155
+ s("td", {
156
+ colspan: "7",
157
+ class: "loading-cell"
158
+ }, "加载中...", -1)
159
+ ])])) : D.value.length === 0 ? (V(), k("tr", se, [...e[14] || (e[14] = [
160
+ s("td", {
161
+ colspan: "7",
162
+ class: "empty-cell"
163
+ }, "暂无数据", -1)
164
+ ])])) : (V(!0), k(H, { key: 2 }, J(D.value, (a) => (V(), k("tr", {
165
+ key: a.id
166
+ }, [
167
+ s("td", null, y(a.id), 1),
168
+ s("td", null, y(a.name), 1),
169
+ s("td", null, [
170
+ t(l(A), {
171
+ type: "primary",
172
+ size: "small"
173
+ }, {
174
+ default: o(() => [
175
+ i(y(a.code), 1)
176
+ ]),
177
+ _: 2
178
+ }, 1024)
179
+ ]),
180
+ s("td", null, y(a.description), 1),
181
+ s("td", null, [
182
+ t(l(A), {
183
+ type: a.status === l(r).ENABLED ? "success" : "danger",
184
+ size: "small"
185
+ }, {
186
+ default: o(() => [
187
+ i(y(a.status === l(r).ENABLED ? "启用" : "禁用"), 1)
188
+ ]),
189
+ _: 2
190
+ }, 1032, ["type"])
191
+ ]),
192
+ s("td", null, y(a.createTime), 1),
193
+ s("td", null, [
194
+ t(l(S), null, {
195
+ default: o(() => [
196
+ t(l(v), {
197
+ type: "primary",
198
+ link: "",
199
+ size: "small",
200
+ onClick: ($) => P(a)
201
+ }, {
202
+ default: o(() => [...e[15] || (e[15] = [
203
+ i("编辑", -1)
204
+ ])]),
205
+ _: 1
206
+ }, 8, ["onClick"]),
207
+ t(l(Y), {
208
+ title: "确定删除该角色吗?",
209
+ onConfirm: ($) => M(a.id)
210
+ }, {
211
+ default: o(() => [
212
+ t(l(v), {
213
+ type: "danger",
214
+ link: "",
215
+ size: "small"
216
+ }, {
217
+ default: o(() => [...e[16] || (e[16] = [
218
+ i("删除", -1)
219
+ ])]),
220
+ _: 1
221
+ })
222
+ ]),
223
+ _: 1
224
+ }, 8, ["onConfirm"])
225
+ ]),
226
+ _: 2
227
+ }, 1024)
228
+ ])
229
+ ]))), 128))
230
+ ])
231
+ ]),
232
+ s("div", ne, [
233
+ t(l(X), {
234
+ "current-page": c.value,
235
+ "onUpdate:currentPage": e[2] || (e[2] = (a) => c.value = a),
236
+ "page-size": b.value,
237
+ "onUpdate:pageSize": e[3] || (e[3] = (a) => b.value = a),
238
+ total: B.value,
239
+ "page-sizes": [10, 20, 50, 100],
240
+ layout: "total, sizes, prev, pager, next",
241
+ onCurrentChange: m,
242
+ onSizeChange: m
243
+ }, null, 8, ["current-page", "page-size", "total"])
244
+ ])
245
+ ]),
246
+ _: 1
247
+ }),
248
+ t(l(Z), {
249
+ modelValue: g.value,
250
+ "onUpdate:modelValue": e[9] || (e[9] = (a) => g.value = a),
251
+ title: w.value,
252
+ width: "500px"
253
+ }, {
254
+ footer: o(() => [
255
+ t(l(S), null, {
256
+ default: o(() => [
257
+ t(l(v), {
258
+ onClick: e[8] || (e[8] = (a) => g.value = !1)
259
+ }, {
260
+ default: o(() => [...e[18] || (e[18] = [
261
+ i("取消", -1)
262
+ ])]),
263
+ _: 1
264
+ }),
265
+ t(l(v), {
266
+ type: "primary",
267
+ onClick: O
268
+ }, {
269
+ default: o(() => [...e[19] || (e[19] = [
270
+ i("确定", -1)
271
+ ])]),
272
+ _: 1
273
+ })
274
+ ]),
275
+ _: 1
276
+ })
277
+ ]),
278
+ default: o(() => [
279
+ t(l(N), {
280
+ ref_key: "formRef",
281
+ ref: L,
282
+ model: n,
283
+ rules: I,
284
+ "label-width": "80px"
285
+ }, {
286
+ default: o(() => [
287
+ t(l(f), {
288
+ label: "角色名称",
289
+ prop: "name"
290
+ }, {
291
+ default: o(() => [
292
+ t(l(E), {
293
+ modelValue: n.name,
294
+ "onUpdate:modelValue": e[4] || (e[4] = (a) => n.name = a),
295
+ placeholder: "请输入角色名称"
296
+ }, null, 8, ["modelValue"])
297
+ ]),
298
+ _: 1
299
+ }),
300
+ t(l(f), {
301
+ label: "角色编码",
302
+ prop: "code"
303
+ }, {
304
+ default: o(() => [
305
+ t(l(E), {
306
+ modelValue: n.code,
307
+ "onUpdate:modelValue": e[5] || (e[5] = (a) => n.code = a),
308
+ placeholder: "请输入角色编码"
309
+ }, null, 8, ["modelValue"])
310
+ ]),
311
+ _: 1
312
+ }),
313
+ t(l(f), { label: "描述" }, {
314
+ default: o(() => [
315
+ t(l(E), {
316
+ modelValue: n.description,
317
+ "onUpdate:modelValue": e[6] || (e[6] = (a) => n.description = a),
318
+ placeholder: "请输入描述"
319
+ }, null, 8, ["modelValue"])
320
+ ]),
321
+ _: 1
322
+ }),
323
+ t(l(f), { label: "状态" }, {
324
+ default: o(() => [
325
+ t(l(W), {
326
+ modelValue: n.status,
327
+ "onUpdate:modelValue": e[7] || (e[7] = (a) => n.status = a),
328
+ "active-value": l(r).ENABLED,
329
+ "inactive-value": l(r).DISABLED
330
+ }, null, 8, ["modelValue", "active-value", "inactive-value"])
331
+ ]),
332
+ _: 1
333
+ })
334
+ ]),
335
+ _: 1
336
+ }, 8, ["model"])
337
+ ]),
338
+ _: 1
339
+ }, 8, ["modelValue", "title"])
340
+ ]));
341
+ }
342
+ }), ce = /* @__PURE__ */ ee(de, [["__scopeId", "data-v-8ad30bc6"]]);
343
+ export {
344
+ ce as default
345
+ };