xto-fronted 0.4.43 → 0.4.44

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,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-CD1ZEMzL.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
+ };
package/dist/index.es.js CHANGED
@@ -1,4 +1,4 @@
1
- import { F as s, c as t, G as o, d as r, e as u, H as n, L as i, i as p, M as l, b as d, f as T, g, h as R, S as k, a as c, j as h, T as f, k as S, l as U, m, n as M, o as y, p as x, q as A, r as b, s as D, t as L, u as C, v as F, w as G, x as I, y as E, z as O, A as v, B as w, C as P, D as j, E as q, I as B, J as H, K as N, N as z, O as J, P as K, Q, R as V, U as W, V as X, W as Y, X as Z, Y as $, Z as _, $ as ee, a0 as ae, a1 as se, a2 as te, a3 as oe, a4 as re, a5 as ue, a6 as ne, a7 as ie, a8 as pe, a9 as le, aa as de, ab as Te, ac as ge, ad as Re, ae as ke, af as ce, ag as he, ah as fe, ai as Se, aj as Ue, ak as me, al as Me, am as ye, an as xe, ao as Ae, ap as be, aq as De, ar as Le, as as Ce, at as Fe, au as Ge, av as Ie, aw as Ee, ax as Oe } from "./index-BvcBQjw6.js";
1
+ import { F as s, c as t, G as o, d as r, e as u, H as n, L as i, i as p, M as l, b as d, f as T, g, h as R, S as k, a as c, j as h, T as f, k as S, l as U, m, n as M, o as y, p as x, q as A, r as b, s as D, t as L, u as C, v as F, w as G, x as I, y as E, z as O, A as v, B as w, C as P, D as j, E as q, I as B, J as H, K as N, N as z, O as J, P as K, Q, R as V, U as W, V as X, W as Y, X as Z, Y as $, Z as _, $ as ee, a0 as ae, a1 as se, a2 as te, a3 as oe, a4 as re, a5 as ue, a6 as ne, a7 as ie, a8 as pe, a9 as le, aa as de, ab as Te, ac as ge, ad as Re, ae as ke, af as ce, ag as he, ah as fe, ai as Se, aj as Ue, ak as me, al as Me, am as ye, an as xe, ao as Ae, ap as be, aq as De, ar as Le, as as Ce, at as Fe, au as Ge, av as Ie, aw as Ee, ax as Oe } from "./index-CD1ZEMzL.js";
2
2
  export {
3
3
  s as Footer,
4
4
  t as Forbidden,