xto-fronted 0.1.0

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.
Files changed (49) hide show
  1. package/README.md +95 -0
  2. package/dist/403-MQkNUulz.js +31 -0
  3. package/dist/404-BOFYLq4X.js +31 -0
  4. package/dist/App.vue.d.ts +2 -0
  5. package/dist/api/auth.d.ts +8 -0
  6. package/dist/api/system.d.ts +16 -0
  7. package/dist/api/user.d.ts +13 -0
  8. package/dist/components/Layout/Footer.vue.d.ts +2 -0
  9. package/dist/components/Layout/Header.vue.d.ts +4 -0
  10. package/dist/components/Layout/Sidebar.vue.d.ts +2 -0
  11. package/dist/components/Layout/Tabs.vue.d.ts +2 -0
  12. package/dist/components/Layout/index.vue.d.ts +2 -0
  13. package/dist/composables/useAuth.d.ts +9 -0
  14. package/dist/composables/useForm.d.ts +20 -0
  15. package/dist/composables/useTable.d.ts +29 -0
  16. package/dist/directives/permission.d.ts +4 -0
  17. package/dist/enums/index.d.ts +32 -0
  18. package/dist/index-BJxYdNPy.js +475 -0
  19. package/dist/index-BvnIIBR1.js +142 -0
  20. package/dist/index-CEvAq6KE.js +372 -0
  21. package/dist/index-DPkqej__.js +345 -0
  22. package/dist/index-pq9Z5K62.js +184 -0
  23. package/dist/index-vVfjShJR.js +1183 -0
  24. package/dist/index.d.ts +24 -0
  25. package/dist/index.es.js +73 -0
  26. package/dist/index.umd.js +1 -0
  27. package/dist/main.d.ts +0 -0
  28. package/dist/router/dynamicRoutes.d.ts +34 -0
  29. package/dist/router/index.d.ts +6 -0
  30. package/dist/router/staticRoutes.d.ts +3 -0
  31. package/dist/stores/app.d.ts +75 -0
  32. package/dist/stores/auth.d.ts +31 -0
  33. package/dist/stores/index.d.ts +9 -0
  34. package/dist/stores/menu.d.ts +108 -0
  35. package/dist/stores/user.d.ts +113 -0
  36. package/dist/style.css +1 -0
  37. package/dist/utils/auth.d.ts +18 -0
  38. package/dist/utils/permission.d.ts +17 -0
  39. package/dist/utils/request.d.ts +25 -0
  40. package/dist/utils/storage.d.ts +24 -0
  41. package/dist/views/dashboard/index.vue.d.ts +2 -0
  42. package/dist/views/error/403.vue.d.ts +2 -0
  43. package/dist/views/error/404.vue.d.ts +2 -0
  44. package/dist/views/login/index.vue.d.ts +4 -0
  45. package/dist/views/system/menu/index.vue.d.ts +4 -0
  46. package/dist/views/system/role/index.vue.d.ts +4 -0
  47. package/dist/views/system/user/index.vue.d.ts +4 -0
  48. package/dist/vite.svg +10 -0
  49. package/package.json +71 -0
@@ -0,0 +1,345 @@
1
+ import { defineComponent as j, ref as p, reactive as N, 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 _, 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, d as h, c as ee } from "./index-vVfjShJR.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 = N({
15
+ keyword: "",
16
+ status: void 0
17
+ }), g = p(!1), w = q(() => n.id ? "编辑角色" : "新增角色"), n = N({
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
+ }, z = () => {
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(_), {
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(z, ["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: z
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(_), {
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-b714caf1"]]);
343
+ export {
344
+ ce as default
345
+ };
@@ -0,0 +1,184 @@
1
+ import { defineComponent as h, ref as u, reactive as w, openBlock as b, createElementBlock as S, createElementVNode as s, createVNode as o, unref as t, withCtx as r, withKeys as V, createTextVNode as f } from "vue";
2
+ import { u as D, a as M, b as U, _ as A, c as I } from "./index-vVfjShJR.js";
3
+ import { useRouter as T } from "vue-router";
4
+ import { Button as C } from "@xto/base";
5
+ import { Form as R, FormItem as i, Input as _, Checkbox as z } from "@xto/form";
6
+ import { Message as B } from "@xto/feedback";
7
+ const L = { class: "login" }, N = { class: "login__container" }, q = /* @__PURE__ */ h({
8
+ __name: "index",
9
+ setup(E) {
10
+ const g = T(), y = D(), v = M(), k = U(), l = u(!1), d = u(!1), a = w({
11
+ username: "admin",
12
+ password: "123456"
13
+ }), x = {
14
+ username: [
15
+ { required: !0, message: "请输入用户名", trigger: "blur" }
16
+ ],
17
+ password: [
18
+ { required: !0, message: "请输入密码", trigger: "blur" },
19
+ { min: 6, message: "密码长度至少6位", trigger: "blur" }
20
+ ]
21
+ }, p = u(), c = async () => {
22
+ var m;
23
+ try {
24
+ await ((m = p.value) == null ? void 0 : m.validate()), l.value = !0, setTimeout(() => {
25
+ y.login({
26
+ token: "mock_token_" + Date.now(),
27
+ refreshToken: "mock_refresh_token",
28
+ expireTime: Date.now() + 7 * 24 * 60 * 60 * 1e3
29
+ }), v.setUserInfo({
30
+ id: 1,
31
+ username: a.username,
32
+ nickname: "管理员",
33
+ avatar: "",
34
+ email: "admin@example.com",
35
+ phone: "13800138000",
36
+ status: 1,
37
+ roles: ["admin"],
38
+ permissions: ["*"],
39
+ createTime: (/* @__PURE__ */ new Date()).toISOString()
40
+ }), k.setMenuList([
41
+ {
42
+ id: 1,
43
+ name: "Dashboard",
44
+ path: "/dashboard",
45
+ component: "dashboard/index",
46
+ icon: "dashboard",
47
+ title: "仪表盘",
48
+ keepAlive: !0,
49
+ affix: !0
50
+ },
51
+ {
52
+ id: 2,
53
+ name: "System",
54
+ path: "/system",
55
+ redirect: "/system/user",
56
+ icon: "setting",
57
+ title: "系统管理",
58
+ children: [
59
+ {
60
+ id: 21,
61
+ name: "SystemUser",
62
+ path: "/system/user",
63
+ component: "system/user/index",
64
+ icon: "user",
65
+ title: "用户管理",
66
+ keepAlive: !0
67
+ },
68
+ {
69
+ id: 22,
70
+ name: "SystemRole",
71
+ path: "/system/role",
72
+ component: "system/role/index",
73
+ icon: "role",
74
+ title: "角色管理",
75
+ keepAlive: !0
76
+ },
77
+ {
78
+ id: 23,
79
+ name: "SystemMenu",
80
+ path: "/system/menu",
81
+ component: "system/menu/index",
82
+ icon: "menu",
83
+ title: "菜单管理",
84
+ keepAlive: !0
85
+ }
86
+ ]
87
+ }
88
+ ]), B.success("登录成功"), g.push("/"), l.value = !1;
89
+ }, 1e3);
90
+ } catch {
91
+ l.value = !1;
92
+ }
93
+ };
94
+ return (m, e) => (b(), S("div", L, [
95
+ s("div", N, [
96
+ e[5] || (e[5] = s("div", { class: "login__header" }, [
97
+ s("img", {
98
+ src: A,
99
+ alt: "Logo",
100
+ class: "login__logo"
101
+ }),
102
+ s("h1", { class: "login__title" }, "Xto Demo"),
103
+ s("p", { class: "login__subtitle" }, "后台管理系统")
104
+ ], -1)),
105
+ o(t(R), {
106
+ ref_key: "formRef",
107
+ ref: p,
108
+ model: a,
109
+ rules: x,
110
+ class: "login__form",
111
+ "label-width": "0"
112
+ }, {
113
+ default: r(() => [
114
+ o(t(i), { prop: "username" }, {
115
+ default: r(() => [
116
+ o(t(_), {
117
+ modelValue: a.username,
118
+ "onUpdate:modelValue": e[0] || (e[0] = (n) => a.username = n),
119
+ placeholder: "用户名",
120
+ "prefix-icon": "👤",
121
+ size: "large"
122
+ }, null, 8, ["modelValue"])
123
+ ]),
124
+ _: 1
125
+ }),
126
+ o(t(i), { prop: "password" }, {
127
+ default: r(() => [
128
+ o(t(_), {
129
+ modelValue: a.password,
130
+ "onUpdate:modelValue": e[1] || (e[1] = (n) => a.password = n),
131
+ type: "password",
132
+ placeholder: "密码",
133
+ "prefix-icon": "🔒",
134
+ size: "large",
135
+ "show-password": "",
136
+ onKeyup: V(c, ["enter"])
137
+ }, null, 8, ["modelValue"])
138
+ ]),
139
+ _: 1
140
+ }),
141
+ o(t(i), null, {
142
+ default: r(() => [
143
+ o(t(z), {
144
+ modelValue: d.value,
145
+ "onUpdate:modelValue": e[2] || (e[2] = (n) => d.value = n)
146
+ }, {
147
+ default: r(() => [...e[3] || (e[3] = [
148
+ f("记住我", -1)
149
+ ])]),
150
+ _: 1
151
+ }, 8, ["modelValue"])
152
+ ]),
153
+ _: 1
154
+ }),
155
+ o(t(i), null, {
156
+ default: r(() => [
157
+ o(t(C), {
158
+ type: "primary",
159
+ size: "large",
160
+ loading: l.value,
161
+ class: "login__submit",
162
+ onClick: c
163
+ }, {
164
+ default: r(() => [...e[4] || (e[4] = [
165
+ f(" 登录 ", -1)
166
+ ])]),
167
+ _: 1
168
+ }, 8, ["loading"])
169
+ ]),
170
+ _: 1
171
+ })
172
+ ]),
173
+ _: 1
174
+ }, 8, ["model"]),
175
+ e[6] || (e[6] = s("div", { class: "login__footer" }, [
176
+ s("p", null, "提示: 任意用户名密码即可登录 (Mock 模式)")
177
+ ], -1))
178
+ ])
179
+ ]));
180
+ }
181
+ }), H = /* @__PURE__ */ I(q, [["__scopeId", "data-v-eb51a732"]]);
182
+ export {
183
+ H as default
184
+ };