xto-fronted 0.4.47 → 0.4.49
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.
- package/dist/index-BAFpPlnI.js +475 -0
- package/dist/index-BIf7CYCW.js +475 -0
- package/dist/index-BR9WVjrV.js +2851 -0
- package/dist/index-BpOcz1m4.js +142 -0
- package/dist/index-CWvOcS8Y.js +345 -0
- package/dist/index-CgZM1vHq.js +372 -0
- package/dist/index-CqLLaQ-P.js +372 -0
- package/dist/index-DKN4xsXi.js +2851 -0
- package/dist/index-DfV_J8Te.js +345 -0
- package/dist/index-F53NVkhc.js +142 -0
- package/dist/index.es.js +1 -1
- package/dist/index.umd.js +1 -1
- package/dist/style.css +1 -1
- package/package.json +1 -1
- package/src/components/Layout/MixTopMenu.vue +11 -8
- package/src/components/Layout/Sidebar.vue +2 -2
- package/src/components/Layout/TopMenu.vue +12 -9
|
@@ -0,0 +1,372 @@
|
|
|
1
|
+
import { defineComponent as K, ref as f, reactive as A, computed as G, onMounted as H, openBlock as v, createElementBlock as E, createVNode as a, unref as l, withCtx as n, withKeys as J, createTextVNode as r, createElementVNode as u, Fragment as U, renderList as N, toDisplayString as c, createBlock as Q } from "vue";
|
|
2
|
+
import { Form as T, FormItem as m, Input as b, Select as W, Switch as _ } from "@xto/form";
|
|
3
|
+
import { Card as w, Tag as X, Pagination as Y } from "@xto/data";
|
|
4
|
+
import { Popconfirm as Z, Modal as ee, Message as C } from "@xto/feedback";
|
|
5
|
+
import { Space as L, Button as g } from "@xto/base";
|
|
6
|
+
import { S as d, a as le, _ as te } from "./index-BR9WVjrV.js";
|
|
7
|
+
const ae = { class: "user-page" }, ne = { class: "toolbar" }, ue = { class: "data-table" }, oe = { key: 0 }, se = { key: 1 }, de = { class: "pagination-wrapper" }, ie = /* @__PURE__ */ K({
|
|
8
|
+
__name: "index",
|
|
9
|
+
setup(re) {
|
|
10
|
+
const I = [
|
|
11
|
+
{ id: 1, username: "admin", nickname: "管理员", email: "admin@example.com", phone: "13800138001", status: d.ENABLED, roles: ["admin"], createTime: "2024-01-01 10:00:00" },
|
|
12
|
+
{ id: 2, username: "zhangsan", nickname: "张三", email: "zhangsan@example.com", phone: "13800138002", status: d.ENABLED, roles: ["editor"], createTime: "2024-01-02 10:00:00" },
|
|
13
|
+
{ id: 3, username: "lisi", nickname: "李四", email: "lisi@example.com", phone: "13800138003", status: d.DISABLED, roles: ["viewer"], createTime: "2024-01-03 10:00:00" },
|
|
14
|
+
{ id: 4, username: "wangwu", nickname: "王五", email: "wangwu@example.com", phone: "13800138004", status: d.ENABLED, roles: ["editor"], createTime: "2024-01-04 10:00:00" },
|
|
15
|
+
{ id: 5, username: "zhaoliu", nickname: "赵六", email: "zhaoliu@example.com", phone: "13800138005", status: d.ENABLED, roles: ["viewer"], createTime: "2024-01-05 10:00:00" }
|
|
16
|
+
], h = f(!1), B = f([]), S = f(0), k = f(1), D = f(10), i = A({
|
|
17
|
+
keyword: "",
|
|
18
|
+
status: void 0
|
|
19
|
+
}), y = f(!1), $ = G(() => s.id ? "编辑用户" : "新增用户"), s = A({
|
|
20
|
+
id: 0,
|
|
21
|
+
username: "",
|
|
22
|
+
nickname: "",
|
|
23
|
+
email: "",
|
|
24
|
+
phone: "",
|
|
25
|
+
status: d.ENABLED,
|
|
26
|
+
roles: []
|
|
27
|
+
}), F = {
|
|
28
|
+
username: [
|
|
29
|
+
{ required: !0, message: "请输入用户名", trigger: "blur" }
|
|
30
|
+
],
|
|
31
|
+
nickname: [
|
|
32
|
+
{ required: !0, message: "请输入昵称", trigger: "blur" }
|
|
33
|
+
],
|
|
34
|
+
email: [
|
|
35
|
+
{ required: !0, message: "请输入邮箱", trigger: "blur" },
|
|
36
|
+
{ type: "email", message: "请输入正确的邮箱格式", trigger: "blur" }
|
|
37
|
+
]
|
|
38
|
+
}, x = f(), p = () => {
|
|
39
|
+
h.value = !0, setTimeout(() => {
|
|
40
|
+
let o = [...I];
|
|
41
|
+
i.keyword && (o = o.filter(
|
|
42
|
+
(e) => e.username.includes(i.keyword) || e.nickname.includes(i.keyword)
|
|
43
|
+
)), i.status !== void 0 && (o = o.filter((e) => e.status === i.status)), S.value = o.length, B.value = o.slice((k.value - 1) * D.value, k.value * D.value), h.value = !1;
|
|
44
|
+
}, 300);
|
|
45
|
+
}, z = () => {
|
|
46
|
+
k.value = 1, p();
|
|
47
|
+
}, P = () => {
|
|
48
|
+
i.keyword = "", i.status = void 0, k.value = 1, p();
|
|
49
|
+
}, q = () => {
|
|
50
|
+
Object.assign(s, {
|
|
51
|
+
id: 0,
|
|
52
|
+
username: "",
|
|
53
|
+
nickname: "",
|
|
54
|
+
email: "",
|
|
55
|
+
phone: "",
|
|
56
|
+
status: d.ENABLED,
|
|
57
|
+
roles: []
|
|
58
|
+
}), y.value = !0;
|
|
59
|
+
}, M = (o) => {
|
|
60
|
+
Object.assign(s, o), y.value = !0;
|
|
61
|
+
}, O = (o) => {
|
|
62
|
+
C.success("删除成功"), p();
|
|
63
|
+
}, R = async () => {
|
|
64
|
+
var o;
|
|
65
|
+
try {
|
|
66
|
+
await ((o = x.value) == null ? void 0 : o.validate()), C.success(s.id ? "编辑成功" : "新增成功"), y.value = !1, p();
|
|
67
|
+
} catch (e) {
|
|
68
|
+
console.error(e);
|
|
69
|
+
}
|
|
70
|
+
}, j = (o) => {
|
|
71
|
+
C.success(`已${o.status === d.ENABLED ? "启用" : "禁用"}用户 ${o.username}`);
|
|
72
|
+
};
|
|
73
|
+
return H(() => {
|
|
74
|
+
p();
|
|
75
|
+
}), (o, e) => (v(), E("div", ae, [
|
|
76
|
+
a(l(w), { class: "search-card" }, {
|
|
77
|
+
default: n(() => [
|
|
78
|
+
a(l(T), {
|
|
79
|
+
model: i,
|
|
80
|
+
inline: ""
|
|
81
|
+
}, {
|
|
82
|
+
default: n(() => [
|
|
83
|
+
a(l(m), { label: "关键词" }, {
|
|
84
|
+
default: n(() => [
|
|
85
|
+
a(l(b), {
|
|
86
|
+
modelValue: i.keyword,
|
|
87
|
+
"onUpdate:modelValue": e[0] || (e[0] = (t) => i.keyword = t),
|
|
88
|
+
placeholder: "用户名/昵称",
|
|
89
|
+
clearable: "",
|
|
90
|
+
onKeyup: J(z, ["enter"])
|
|
91
|
+
}, null, 8, ["modelValue"])
|
|
92
|
+
]),
|
|
93
|
+
_: 1
|
|
94
|
+
}),
|
|
95
|
+
a(l(m), { label: "状态" }, {
|
|
96
|
+
default: n(() => [
|
|
97
|
+
a(l(W), {
|
|
98
|
+
modelValue: i.status,
|
|
99
|
+
"onUpdate:modelValue": e[1] || (e[1] = (t) => i.status = t),
|
|
100
|
+
options: l(le),
|
|
101
|
+
placeholder: "请选择",
|
|
102
|
+
clearable: ""
|
|
103
|
+
}, null, 8, ["modelValue", "options"])
|
|
104
|
+
]),
|
|
105
|
+
_: 1
|
|
106
|
+
}),
|
|
107
|
+
a(l(m), null, {
|
|
108
|
+
default: n(() => [
|
|
109
|
+
a(l(L), null, {
|
|
110
|
+
default: n(() => [
|
|
111
|
+
a(l(g), {
|
|
112
|
+
type: "primary",
|
|
113
|
+
onClick: z
|
|
114
|
+
}, {
|
|
115
|
+
default: n(() => [...e[11] || (e[11] = [
|
|
116
|
+
r("搜索", -1)
|
|
117
|
+
])]),
|
|
118
|
+
_: 1
|
|
119
|
+
}),
|
|
120
|
+
a(l(g), { onClick: P }, {
|
|
121
|
+
default: n(() => [...e[12] || (e[12] = [
|
|
122
|
+
r("重置", -1)
|
|
123
|
+
])]),
|
|
124
|
+
_: 1
|
|
125
|
+
})
|
|
126
|
+
]),
|
|
127
|
+
_: 1
|
|
128
|
+
})
|
|
129
|
+
]),
|
|
130
|
+
_: 1
|
|
131
|
+
})
|
|
132
|
+
]),
|
|
133
|
+
_: 1
|
|
134
|
+
}, 8, ["model"])
|
|
135
|
+
]),
|
|
136
|
+
_: 1
|
|
137
|
+
}),
|
|
138
|
+
a(l(w), { class: "table-card" }, {
|
|
139
|
+
default: n(() => [
|
|
140
|
+
u("div", ne, [
|
|
141
|
+
a(l(g), {
|
|
142
|
+
type: "primary",
|
|
143
|
+
onClick: q
|
|
144
|
+
}, {
|
|
145
|
+
default: n(() => [...e[13] || (e[13] = [
|
|
146
|
+
r("新增用户", -1)
|
|
147
|
+
])]),
|
|
148
|
+
_: 1
|
|
149
|
+
})
|
|
150
|
+
]),
|
|
151
|
+
u("table", ue, [
|
|
152
|
+
e[18] || (e[18] = u("thead", null, [
|
|
153
|
+
u("tr", null, [
|
|
154
|
+
u("th", null, "ID"),
|
|
155
|
+
u("th", null, "用户名"),
|
|
156
|
+
u("th", null, "昵称"),
|
|
157
|
+
u("th", null, "邮箱"),
|
|
158
|
+
u("th", null, "手机号"),
|
|
159
|
+
u("th", null, "角色"),
|
|
160
|
+
u("th", null, "状态"),
|
|
161
|
+
u("th", null, "创建时间"),
|
|
162
|
+
u("th", null, "操作")
|
|
163
|
+
])
|
|
164
|
+
], -1)),
|
|
165
|
+
u("tbody", null, [
|
|
166
|
+
h.value ? (v(), E("tr", oe, [...e[14] || (e[14] = [
|
|
167
|
+
u("td", {
|
|
168
|
+
colspan: "9",
|
|
169
|
+
class: "loading-cell"
|
|
170
|
+
}, "加载中...", -1)
|
|
171
|
+
])])) : B.value.length === 0 ? (v(), E("tr", se, [...e[15] || (e[15] = [
|
|
172
|
+
u("td", {
|
|
173
|
+
colspan: "9",
|
|
174
|
+
class: "empty-cell"
|
|
175
|
+
}, "暂无数据", -1)
|
|
176
|
+
])])) : (v(!0), E(U, { key: 2 }, N(B.value, (t) => (v(), E("tr", {
|
|
177
|
+
key: t.id
|
|
178
|
+
}, [
|
|
179
|
+
u("td", null, c(t.id), 1),
|
|
180
|
+
u("td", null, c(t.username), 1),
|
|
181
|
+
u("td", null, c(t.nickname), 1),
|
|
182
|
+
u("td", null, c(t.email), 1),
|
|
183
|
+
u("td", null, c(t.phone), 1),
|
|
184
|
+
u("td", null, [
|
|
185
|
+
(v(!0), E(U, null, N(t.roles, (V) => (v(), Q(l(X), {
|
|
186
|
+
key: V,
|
|
187
|
+
size: "small"
|
|
188
|
+
}, {
|
|
189
|
+
default: n(() => [
|
|
190
|
+
r(c(V), 1)
|
|
191
|
+
]),
|
|
192
|
+
_: 2
|
|
193
|
+
}, 1024))), 128))
|
|
194
|
+
]),
|
|
195
|
+
u("td", null, [
|
|
196
|
+
a(l(_), {
|
|
197
|
+
"model-value": t.status === l(d).ENABLED,
|
|
198
|
+
"onUpdate:modelValue": (V) => {
|
|
199
|
+
t.status = V ? l(d).ENABLED : l(d).DISABLED, j(t);
|
|
200
|
+
}
|
|
201
|
+
}, null, 8, ["model-value", "onUpdate:modelValue"])
|
|
202
|
+
]),
|
|
203
|
+
u("td", null, c(t.createTime), 1),
|
|
204
|
+
u("td", null, [
|
|
205
|
+
a(l(L), null, {
|
|
206
|
+
default: n(() => [
|
|
207
|
+
a(l(g), {
|
|
208
|
+
type: "primary",
|
|
209
|
+
link: "",
|
|
210
|
+
size: "small",
|
|
211
|
+
onClick: (V) => M(t)
|
|
212
|
+
}, {
|
|
213
|
+
default: n(() => [...e[16] || (e[16] = [
|
|
214
|
+
r("编辑", -1)
|
|
215
|
+
])]),
|
|
216
|
+
_: 1
|
|
217
|
+
}, 8, ["onClick"]),
|
|
218
|
+
a(l(Z), {
|
|
219
|
+
title: "确定删除该用户吗?",
|
|
220
|
+
onConfirm: (V) => O(t.id)
|
|
221
|
+
}, {
|
|
222
|
+
default: n(() => [
|
|
223
|
+
a(l(g), {
|
|
224
|
+
type: "danger",
|
|
225
|
+
link: "",
|
|
226
|
+
size: "small"
|
|
227
|
+
}, {
|
|
228
|
+
default: n(() => [...e[17] || (e[17] = [
|
|
229
|
+
r("删除", -1)
|
|
230
|
+
])]),
|
|
231
|
+
_: 1
|
|
232
|
+
})
|
|
233
|
+
]),
|
|
234
|
+
_: 1
|
|
235
|
+
}, 8, ["onConfirm"])
|
|
236
|
+
]),
|
|
237
|
+
_: 2
|
|
238
|
+
}, 1024)
|
|
239
|
+
])
|
|
240
|
+
]))), 128))
|
|
241
|
+
])
|
|
242
|
+
]),
|
|
243
|
+
u("div", de, [
|
|
244
|
+
a(l(Y), {
|
|
245
|
+
"current-page": k.value,
|
|
246
|
+
"onUpdate:currentPage": e[2] || (e[2] = (t) => k.value = t),
|
|
247
|
+
"page-size": D.value,
|
|
248
|
+
"onUpdate:pageSize": e[3] || (e[3] = (t) => D.value = t),
|
|
249
|
+
total: S.value,
|
|
250
|
+
"page-sizes": [10, 20, 50, 100],
|
|
251
|
+
layout: "total, sizes, prev, pager, next",
|
|
252
|
+
onCurrentChange: p,
|
|
253
|
+
onSizeChange: p
|
|
254
|
+
}, null, 8, ["current-page", "page-size", "total"])
|
|
255
|
+
])
|
|
256
|
+
]),
|
|
257
|
+
_: 1
|
|
258
|
+
}),
|
|
259
|
+
a(l(ee), {
|
|
260
|
+
modelValue: y.value,
|
|
261
|
+
"onUpdate:modelValue": e[10] || (e[10] = (t) => y.value = t),
|
|
262
|
+
title: $.value,
|
|
263
|
+
width: "500px"
|
|
264
|
+
}, {
|
|
265
|
+
footer: n(() => [
|
|
266
|
+
a(l(L), null, {
|
|
267
|
+
default: n(() => [
|
|
268
|
+
a(l(g), {
|
|
269
|
+
onClick: e[9] || (e[9] = (t) => y.value = !1)
|
|
270
|
+
}, {
|
|
271
|
+
default: n(() => [...e[19] || (e[19] = [
|
|
272
|
+
r("取消", -1)
|
|
273
|
+
])]),
|
|
274
|
+
_: 1
|
|
275
|
+
}),
|
|
276
|
+
a(l(g), {
|
|
277
|
+
type: "primary",
|
|
278
|
+
onClick: R
|
|
279
|
+
}, {
|
|
280
|
+
default: n(() => [...e[20] || (e[20] = [
|
|
281
|
+
r("确定", -1)
|
|
282
|
+
])]),
|
|
283
|
+
_: 1
|
|
284
|
+
})
|
|
285
|
+
]),
|
|
286
|
+
_: 1
|
|
287
|
+
})
|
|
288
|
+
]),
|
|
289
|
+
default: n(() => [
|
|
290
|
+
a(l(T), {
|
|
291
|
+
ref_key: "formRef",
|
|
292
|
+
ref: x,
|
|
293
|
+
model: s,
|
|
294
|
+
rules: F,
|
|
295
|
+
"label-width": "80px"
|
|
296
|
+
}, {
|
|
297
|
+
default: n(() => [
|
|
298
|
+
a(l(m), {
|
|
299
|
+
label: "用户名",
|
|
300
|
+
prop: "username"
|
|
301
|
+
}, {
|
|
302
|
+
default: n(() => [
|
|
303
|
+
a(l(b), {
|
|
304
|
+
modelValue: s.username,
|
|
305
|
+
"onUpdate:modelValue": e[4] || (e[4] = (t) => s.username = t),
|
|
306
|
+
placeholder: "请输入用户名"
|
|
307
|
+
}, null, 8, ["modelValue"])
|
|
308
|
+
]),
|
|
309
|
+
_: 1
|
|
310
|
+
}),
|
|
311
|
+
a(l(m), {
|
|
312
|
+
label: "昵称",
|
|
313
|
+
prop: "nickname"
|
|
314
|
+
}, {
|
|
315
|
+
default: n(() => [
|
|
316
|
+
a(l(b), {
|
|
317
|
+
modelValue: s.nickname,
|
|
318
|
+
"onUpdate:modelValue": e[5] || (e[5] = (t) => s.nickname = t),
|
|
319
|
+
placeholder: "请输入昵称"
|
|
320
|
+
}, null, 8, ["modelValue"])
|
|
321
|
+
]),
|
|
322
|
+
_: 1
|
|
323
|
+
}),
|
|
324
|
+
a(l(m), {
|
|
325
|
+
label: "邮箱",
|
|
326
|
+
prop: "email"
|
|
327
|
+
}, {
|
|
328
|
+
default: n(() => [
|
|
329
|
+
a(l(b), {
|
|
330
|
+
modelValue: s.email,
|
|
331
|
+
"onUpdate:modelValue": e[6] || (e[6] = (t) => s.email = t),
|
|
332
|
+
placeholder: "请输入邮箱"
|
|
333
|
+
}, null, 8, ["modelValue"])
|
|
334
|
+
]),
|
|
335
|
+
_: 1
|
|
336
|
+
}),
|
|
337
|
+
a(l(m), {
|
|
338
|
+
label: "手机号",
|
|
339
|
+
prop: "phone"
|
|
340
|
+
}, {
|
|
341
|
+
default: n(() => [
|
|
342
|
+
a(l(b), {
|
|
343
|
+
modelValue: s.phone,
|
|
344
|
+
"onUpdate:modelValue": e[7] || (e[7] = (t) => s.phone = t),
|
|
345
|
+
placeholder: "请输入手机号"
|
|
346
|
+
}, null, 8, ["modelValue"])
|
|
347
|
+
]),
|
|
348
|
+
_: 1
|
|
349
|
+
}),
|
|
350
|
+
a(l(m), { label: "状态" }, {
|
|
351
|
+
default: n(() => [
|
|
352
|
+
a(l(_), {
|
|
353
|
+
modelValue: s.status,
|
|
354
|
+
"onUpdate:modelValue": e[8] || (e[8] = (t) => s.status = t),
|
|
355
|
+
"active-value": l(d).ENABLED,
|
|
356
|
+
"inactive-value": l(d).DISABLED
|
|
357
|
+
}, null, 8, ["modelValue", "active-value", "inactive-value"])
|
|
358
|
+
]),
|
|
359
|
+
_: 1
|
|
360
|
+
})
|
|
361
|
+
]),
|
|
362
|
+
_: 1
|
|
363
|
+
}, 8, ["model"])
|
|
364
|
+
]),
|
|
365
|
+
_: 1
|
|
366
|
+
}, 8, ["modelValue", "title"])
|
|
367
|
+
]));
|
|
368
|
+
}
|
|
369
|
+
}), ke = /* @__PURE__ */ te(ie, [["__scopeId", "data-v-d2491ae0"]]);
|
|
370
|
+
export {
|
|
371
|
+
ke as default
|
|
372
|
+
};
|