@yuku123/z-team-component 0.2.80 → 0.2.83

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 (51) hide show
  1. package/dist/ChangeLogView-_bRZ55Yi.js +542 -0
  2. package/dist/ComponentDoc-BFoF51we.js +3998 -0
  3. package/dist/InvitationManagementPage-CTPCZXHu.js +495 -0
  4. package/dist/OnboardingPage-DwtuTL61.js +393 -0
  5. package/dist/ScheduledTasks-yeTm2bOY.js +9407 -0
  6. package/dist/SystemShell-D9OzKxL-.js +689 -0
  7. package/dist/_commonjsHelpers-B52_cu2H.js +26 -0
  8. package/dist/api-CIhVblfa.js +2155 -0
  9. package/dist/api-DXLNhtCX.js +20 -0
  10. package/dist/browser-jb_PFvU3.js +1538 -0
  11. package/dist/createWorkspaceWsHandler-BWP5S5X3.js +12951 -0
  12. package/dist/ctc-sso-DtJHC-2M.js +117 -0
  13. package/dist/echarts-B1OU1xr4.js +16 -0
  14. package/dist/history-BlrA1eaW.js +41 -0
  15. package/dist/index-BCp5EtqR.js +914 -0
  16. package/dist/index-BHrMl3Jq.js +9585 -0
  17. package/dist/index-BP7WTzVH.js +137 -0
  18. package/dist/index-B_LJRFsK.js +339 -0
  19. package/dist/index-BgIheStI.js +133 -0
  20. package/dist/index-BohoJQPr.js +7631 -0
  21. package/dist/index-BydWNuk5.js +1229 -0
  22. package/dist/index-C815hPWS.js +430 -0
  23. package/dist/index-CBQMS6rx.js +178 -0
  24. package/dist/index-CESmMALI.js +242 -0
  25. package/dist/index-CUVdeb8y.js +638 -0
  26. package/dist/index-CijskN6t.js +316 -0
  27. package/dist/index-CoBZZQBy.js +112 -0
  28. package/dist/index-Co_0idJY.js +2936 -0
  29. package/dist/index-Cvx6rrxD.js +956 -0
  30. package/dist/index-Cwr5Slv1.js +480 -0
  31. package/dist/index-CxFAICql.js +42050 -0
  32. package/dist/index-DK70mOTz.js +143 -0
  33. package/dist/index-DT80Pwa_.js +5893 -0
  34. package/dist/index-DWsfQMp8.js +208 -0
  35. package/dist/index-DhDdFRHC.js +279 -0
  36. package/dist/index-Dm3wmB0K.js +435 -0
  37. package/dist/index-DzS6-D3M.js +1640 -0
  38. package/dist/index-PKkV63Sw.js +1143 -0
  39. package/dist/index-SbMjh8t4.js +574 -0
  40. package/dist/index-cdB5K3gx.js +814 -0
  41. package/dist/index-mnWs_wA3.js +93 -0
  42. package/dist/index-nU-V276i.js +170 -0
  43. package/dist/index-nW0ikV2R.js +2700 -0
  44. package/dist/index-uF04Ucsi.js +8 -0
  45. package/dist/index-x_7Rmav9.js +118 -0
  46. package/dist/index.js +10 -0
  47. package/dist/index.module-CAa-2T7m.js +72 -0
  48. package/dist/index.module-UI0iz8K0.js +42 -0
  49. package/dist/{menuPermission-D9NGpBZP.js → menuPermission-DHUqvHfu.js} +1 -1
  50. package/dist/pages.js +1 -1
  51. package/package.json +1 -1
@@ -0,0 +1,495 @@
1
+ import { jsxs as i, jsx as e, Fragment as A } from "react/jsx-runtime";
2
+ import { useState as o, useEffect as oe } from "react";
3
+ import { Form as m, message as l, Button as d, Input as B, Row as ae, Col as z, Card as v, Statistic as O, Alert as T, Space as p, Typography as se, Tabs as de, Popconfirm as F, Tag as h, Tooltip as ce, Modal as he, Radio as S, Select as w, InputNumber as ue } from "antd";
4
+ import { PlusOutlined as me, ClockCircleOutlined as _, CheckCircleOutlined as $, LinkOutlined as D, CopyOutlined as b, QrcodeOutlined as U, UserDeleteOutlined as K, TeamOutlined as pe, MailOutlined as j, DeleteOutlined as ye, UserAddOutlined as q, CloseCircleOutlined as N } from "@ant-design/icons";
5
+ import { l as fe, b as ge, g as ve, c as we, d as be, e as Ce, f as xe } from "./api-DXLNhtCX.js";
6
+ import { PageHeader as Ie, TableToolbar as ke, ListTable as W } from "@yuku123/z-frontend-common/ui";
7
+ const { Text: c } = se, Me = () => {
8
+ const [C] = m.useForm(), [M, P] = o(!1), [y, G] = o([]), [L, H] = o([]), [J, Q] = o(null), [u, V] = o(""), [X, x] = o(!1), [Y, R] = o(!1), [a, E] = o(null), [r, Z] = o(localStorage.getItem("userInfo") && JSON.parse(localStorage.getItem("userInfo") || "{}").tenantCode || "");
9
+ oe(() => {
10
+ r && f();
11
+ }, [r]);
12
+ const f = async () => {
13
+ if (!r) {
14
+ l.warning("请先选择租户");
15
+ return;
16
+ }
17
+ P(!0);
18
+ try {
19
+ const [t, n, s] = await Promise.all([
20
+ fe(r).catch(() => []),
21
+ ge(r).catch(() => []),
22
+ ve().catch(() => null)
23
+ ]);
24
+ if (G(t || []), H(n || []), s) {
25
+ Q(s.userId);
26
+ const k = (s.memberships || []).find((le) => le.tenantCode === r);
27
+ V((k == null ? void 0 : k.roleCode) || "");
28
+ }
29
+ } catch (t) {
30
+ l.error("加载失败: " + ((t == null ? void 0 : t.message) || t));
31
+ } finally {
32
+ P(!1);
33
+ }
34
+ }, ee = async () => {
35
+ try {
36
+ const t = await C.validateFields();
37
+ R(!0);
38
+ const n = await xe({
39
+ tenantCode: r,
40
+ inviteeEmail: t.inviteeEmail,
41
+ roleCode: t.roleCode,
42
+ type: t.type,
43
+ maxUses: t.maxUses
44
+ });
45
+ n && n.id && (l.success("邀请创建成功!"), E(n), x(!1), C.resetFields(), f());
46
+ } catch (t) {
47
+ if (t != null && t.errorFields) return;
48
+ l.error("创建失败: " + ((t == null ? void 0 : t.message) || t));
49
+ } finally {
50
+ R(!1);
51
+ }
52
+ }, te = async (t) => {
53
+ try {
54
+ await Ce(t, r), l.success("已撤销"), f();
55
+ } catch (n) {
56
+ l.error("撤销失败: " + ((n == null ? void 0 : n.message) || n));
57
+ }
58
+ }, ne = async (t, n) => {
59
+ try {
60
+ await be(t, r), l.success(`已移除成员 ${n}`), f();
61
+ } catch (s) {
62
+ l.error("移除失败: " + ((s == null ? void 0 : s.message) || s));
63
+ }
64
+ }, ie = async () => {
65
+ try {
66
+ await we(r), l.success("已退出该租户"), window.location.href = "/onboarding";
67
+ } catch (t) {
68
+ l.error("退出失败: " + ((t == null ? void 0 : t.message) || t));
69
+ }
70
+ }, g = (t, n = "已复制") => {
71
+ navigator.clipboard.writeText(t), l.success(n);
72
+ }, re = {
73
+ 0: { color: "processing", text: "待接受", icon: /* @__PURE__ */ e(_, {}) },
74
+ 1: { color: "success", text: "已接受", icon: /* @__PURE__ */ e($, {}) },
75
+ 2: { color: "default", text: "已撤销", icon: /* @__PURE__ */ e(N, {}) },
76
+ 3: { color: "error", text: "已过期", icon: /* @__PURE__ */ e(N, {}) }
77
+ }, I = {
78
+ total: y.length,
79
+ pending: y.filter((t) => t.status === 0).length,
80
+ accepted: y.filter((t) => t.status === 1).length
81
+ };
82
+ return /* @__PURE__ */ i("div", { children: [
83
+ /* @__PURE__ */ e(
84
+ Ie,
85
+ {
86
+ title: "邀请管理",
87
+ subtitle: `租户: ${r}`
88
+ }
89
+ ),
90
+ /* @__PURE__ */ e(
91
+ ke,
92
+ {
93
+ left: /* @__PURE__ */ e(
94
+ B,
95
+ {
96
+ placeholder: "租户编码",
97
+ value: r,
98
+ onChange: (t) => Z(t.target.value),
99
+ onPressEnter: f,
100
+ style: { width: 200 }
101
+ }
102
+ ),
103
+ right: /* @__PURE__ */ e(d, { type: "primary", icon: /* @__PURE__ */ e(me, {}), onClick: () => x(!0), children: "创建邀请" }),
104
+ extra: null
105
+ }
106
+ ),
107
+ /* @__PURE__ */ i(ae, { gutter: 16, style: { marginBottom: 16 }, children: [
108
+ /* @__PURE__ */ e(z, { span: 8, children: /* @__PURE__ */ e(v, { size: "small", children: /* @__PURE__ */ e(O, { title: "总邀请数", value: I.total }) }) }),
109
+ /* @__PURE__ */ e(z, { span: 8, children: /* @__PURE__ */ e(v, { size: "small", children: /* @__PURE__ */ e(
110
+ O,
111
+ {
112
+ title: "待接受",
113
+ value: I.pending,
114
+ styles: { content: { color: "#1890ff" } },
115
+ prefix: /* @__PURE__ */ e(_, {})
116
+ }
117
+ ) }) }),
118
+ /* @__PURE__ */ e(z, { span: 8, children: /* @__PURE__ */ e(v, { size: "small", children: /* @__PURE__ */ e(
119
+ O,
120
+ {
121
+ title: "已接受",
122
+ value: I.accepted,
123
+ styles: { content: { color: "#52c41a" } },
124
+ prefix: /* @__PURE__ */ e($, {})
125
+ }
126
+ ) }) })
127
+ ] }),
128
+ a && /* @__PURE__ */ e(
129
+ T,
130
+ {
131
+ type: "success",
132
+ showIcon: !0,
133
+ style: { marginBottom: 16 },
134
+ message: "邀请创建成功!",
135
+ description: /* @__PURE__ */ i(p, { orientation: "vertical", style: { width: "100%" }, children: [
136
+ a.inviteUrl && /* @__PURE__ */ i(p, { children: [
137
+ /* @__PURE__ */ e(D, {}),
138
+ /* @__PURE__ */ e("code", { style: { background: "#f0f0f0", padding: "2px 6px", borderRadius: 3 }, children: a.inviteUrl }),
139
+ /* @__PURE__ */ e(
140
+ d,
141
+ {
142
+ size: "small",
143
+ icon: /* @__PURE__ */ e(b, {}),
144
+ onClick: () => g(a.inviteUrl, "邀请链接已复制"),
145
+ children: "复制链接"
146
+ }
147
+ )
148
+ ] }),
149
+ a.inviteCode && /* @__PURE__ */ i(p, { children: [
150
+ /* @__PURE__ */ e(U, {}),
151
+ /* @__PURE__ */ e("code", { style: {
152
+ background: "#f0f0f0",
153
+ padding: "4px 12px",
154
+ borderRadius: 4,
155
+ fontSize: 18,
156
+ letterSpacing: 4,
157
+ fontWeight: "bold"
158
+ }, children: a.inviteCode }),
159
+ /* @__PURE__ */ e(
160
+ d,
161
+ {
162
+ size: "small",
163
+ icon: /* @__PURE__ */ e(b, {}),
164
+ onClick: () => g(a.inviteCode, "邀请码已复制"),
165
+ children: "复制码"
166
+ }
167
+ )
168
+ ] }),
169
+ /* @__PURE__ */ i(c, { type: "secondary", style: { fontSize: 12 }, children: [
170
+ "过期时间: ",
171
+ new Date(a.expireAt).toLocaleString()
172
+ ] })
173
+ ] }),
174
+ closable: !0,
175
+ onClose: () => E(null)
176
+ }
177
+ ),
178
+ /* @__PURE__ */ e(v, { size: "small", styles: { body: { paddingTop: 8 } }, children: /* @__PURE__ */ e(
179
+ de,
180
+ {
181
+ size: "small",
182
+ defaultActiveKey: "members",
183
+ items: [
184
+ {
185
+ key: "members",
186
+ label: /* @__PURE__ */ i("span", { children: [
187
+ /* @__PURE__ */ e(pe, {}),
188
+ " 成员管理 (",
189
+ L.length,
190
+ ")"
191
+ ] }),
192
+ children: /* @__PURE__ */ i(A, { children: [
193
+ u && u !== "owner" && /* @__PURE__ */ e(
194
+ T,
195
+ {
196
+ type: "warning",
197
+ showIcon: !0,
198
+ style: { marginBottom: 12 },
199
+ message: `你是 ${u}, 退出后回游离态, owner 需先转让`,
200
+ action: /* @__PURE__ */ e(
201
+ F,
202
+ {
203
+ title: "确认退出该租户?",
204
+ description: "退出后将回到游离态, 可重新加入或创建新租户",
205
+ onConfirm: ie,
206
+ children: /* @__PURE__ */ e(d, { size: "small", danger: !0, icon: /* @__PURE__ */ e(K, {}), children: "退出租户" })
207
+ }
208
+ )
209
+ }
210
+ ),
211
+ /* @__PURE__ */ e(
212
+ W,
213
+ {
214
+ rows: L,
215
+ rowKey: "id",
216
+ loading: M,
217
+ searchKeys: ["userId", "roleCode"],
218
+ searchPlaceholder: "按用户 ID / 角色过滤",
219
+ emptyTitle: "暂无成员",
220
+ emptyDescription: "该租户还没有成员,发个邀请把人拉进来。",
221
+ cardProps: { variant: "borderless", styles: { body: { padding: 0 } } },
222
+ columns: [
223
+ { title: "ID", dataIndex: "id", width: 60 },
224
+ { title: "用户ID", dataIndex: "userId", width: 80 },
225
+ {
226
+ title: "角色",
227
+ dataIndex: "roleCode",
228
+ width: 100,
229
+ render: (t) => /* @__PURE__ */ i(
230
+ h,
231
+ {
232
+ color: t === "owner" ? "gold" : t === "admin" ? "blue" : "default",
233
+ children: [
234
+ t === "owner" && "👑 ",
235
+ t
236
+ ]
237
+ }
238
+ )
239
+ },
240
+ {
241
+ title: "状态",
242
+ dataIndex: "memberStatus",
243
+ width: 80,
244
+ render: (t) => /* @__PURE__ */ e(
245
+ h,
246
+ {
247
+ color: t === 1 ? "success" : "default",
248
+ children: t === 1 ? "正常" : "已退出"
249
+ }
250
+ )
251
+ },
252
+ {
253
+ title: "加入时间",
254
+ dataIndex: "joinedAt",
255
+ width: 160,
256
+ render: (t) => t ? new Date(t).toLocaleString() : "-"
257
+ },
258
+ {
259
+ title: "操作",
260
+ width: 100,
261
+ fixed: "right",
262
+ render: (t, n) => u !== "owner" && u !== "admin" ? /* @__PURE__ */ e(
263
+ c,
264
+ {
265
+ type: "secondary",
266
+ children: "-"
267
+ }
268
+ ) : n.roleCode === "owner" ? /* @__PURE__ */ e(
269
+ c,
270
+ {
271
+ type: "secondary",
272
+ children: "owner"
273
+ }
274
+ ) : n.userId === J ? /* @__PURE__ */ e(c, { type: "secondary", children: "自己" }) : u === "admin" && n.roleCode === "admin" ? /* @__PURE__ */ e(
275
+ c,
276
+ {
277
+ type: "secondary",
278
+ children: "-"
279
+ }
280
+ ) : /* @__PURE__ */ e(
281
+ F,
282
+ {
283
+ title: "确认移除该成员?",
284
+ description: "移除后该用户将回游离态, 可重新接受邀请加入",
285
+ onConfirm: () => ne(n.id, `userId=${n.userId}`),
286
+ children: /* @__PURE__ */ e(
287
+ d,
288
+ {
289
+ size: "small",
290
+ type: "text",
291
+ danger: !0,
292
+ icon: /* @__PURE__ */ e(K, {}),
293
+ children: "移除"
294
+ }
295
+ )
296
+ }
297
+ )
298
+ }
299
+ ]
300
+ }
301
+ )
302
+ ] })
303
+ },
304
+ {
305
+ key: "invitations",
306
+ label: /* @__PURE__ */ i("span", { children: [
307
+ /* @__PURE__ */ e(q, {}),
308
+ " 邀请记录 (",
309
+ y.length,
310
+ ")"
311
+ ] }),
312
+ // 邀请记录 —— 走基座 ListTable:标准分页 + 端侧过滤 + EmptyState。
313
+ children: /* @__PURE__ */ e(
314
+ W,
315
+ {
316
+ rows: y,
317
+ rowKey: "id",
318
+ loading: M,
319
+ searchKeys: ["inviteeEmail", "roleCode", "status"],
320
+ searchPlaceholder: "按被邀请人 / 角色 / 状态过滤",
321
+ emptyTitle: "暂无邀请",
322
+ emptyDescription: "点右上角创建第一个。",
323
+ cardProps: { variant: "borderless", styles: { body: { padding: 0 } } },
324
+ columns: [
325
+ { title: "ID", dataIndex: "id", width: 60 },
326
+ {
327
+ title: "类型",
328
+ dataIndex: "type",
329
+ width: 80,
330
+ render: (t, n) => n.token ? /* @__PURE__ */ e(h, { color: "blue", icon: /* @__PURE__ */ e(D, {}), children: "链接" }) : n.inviteCode ? /* @__PURE__ */ e(h, { color: "purple", icon: /* @__PURE__ */ e(U, {}), children: "码" }) : "-"
331
+ },
332
+ {
333
+ title: "内容",
334
+ render: (t, n) => n.token ? /* @__PURE__ */ i(p, { children: [
335
+ /* @__PURE__ */ i("code", { style: { fontSize: 11 }, children: [
336
+ n.token.substring(0, 16),
337
+ "..."
338
+ ] }),
339
+ /* @__PURE__ */ e(
340
+ d,
341
+ {
342
+ size: "small",
343
+ type: "link",
344
+ icon: /* @__PURE__ */ e(b, {}),
345
+ onClick: () => g(
346
+ `https://opc.zopc.top/invite?token=${n.token}`,
347
+ "完整链接已复制"
348
+ ),
349
+ children: "复制"
350
+ }
351
+ )
352
+ ] }) : n.inviteCode ? /* @__PURE__ */ i(p, { children: [
353
+ /* @__PURE__ */ e("code", { style: {
354
+ fontSize: 16,
355
+ letterSpacing: 2,
356
+ fontWeight: "bold",
357
+ background: "#f0f0f0",
358
+ padding: "2px 8px",
359
+ borderRadius: 3
360
+ }, children: n.inviteCode }),
361
+ /* @__PURE__ */ e(
362
+ d,
363
+ {
364
+ size: "small",
365
+ type: "link",
366
+ icon: /* @__PURE__ */ e(b, {}),
367
+ onClick: () => g(n.inviteCode, "邀请码已复制"),
368
+ children: "复制"
369
+ }
370
+ )
371
+ ] }) : "-"
372
+ },
373
+ {
374
+ title: "被邀请人",
375
+ render: (t, n) => n.inviteeEmail ? /* @__PURE__ */ i(p, { size: 4, children: [
376
+ /* @__PURE__ */ e(j, {}),
377
+ " ",
378
+ n.inviteeEmail
379
+ ] }) : n.inviteePhone || /* @__PURE__ */ e(c, { type: "secondary", children: "不限 (公开码)" })
380
+ },
381
+ {
382
+ title: "角色",
383
+ dataIndex: "roleCode",
384
+ width: 80,
385
+ render: (t) => /* @__PURE__ */ e(
386
+ h,
387
+ {
388
+ color: t === "owner" ? "gold" : t === "admin" ? "blue" : "default",
389
+ children: t
390
+ }
391
+ )
392
+ },
393
+ {
394
+ title: "使用情况",
395
+ width: 100,
396
+ render: (t, n) => /* @__PURE__ */ e(ce, { title: `最多 ${n.maxUses || 1} 次`, children: /* @__PURE__ */ i(h, { children: [
397
+ n.usedCount || 0,
398
+ " / ",
399
+ n.maxUses || 1
400
+ ] }) })
401
+ },
402
+ {
403
+ title: "状态",
404
+ dataIndex: "status",
405
+ width: 90,
406
+ render: (t) => {
407
+ const n = re[t] || { color: "default", text: "?" };
408
+ return /* @__PURE__ */ e(h, { color: n.color, icon: n.icon, children: n.text });
409
+ }
410
+ },
411
+ {
412
+ title: "过期时间",
413
+ dataIndex: "expireAt",
414
+ width: 140,
415
+ render: (t) => t ? /* @__PURE__ */ e(
416
+ c,
417
+ {
418
+ type: new Date(t) < /* @__PURE__ */ new Date() ? "danger" : "secondary",
419
+ style: { fontSize: 12 },
420
+ children: new Date(t).toLocaleString()
421
+ }
422
+ ) : "-"
423
+ },
424
+ {
425
+ title: "操作",
426
+ width: 80,
427
+ fixed: "right",
428
+ render: (t, n) => n.status === 0 ? /* @__PURE__ */ e(
429
+ d,
430
+ {
431
+ size: "small",
432
+ type: "text",
433
+ danger: !0,
434
+ icon: /* @__PURE__ */ e(ye, {}),
435
+ onClick: () => te(n.id),
436
+ children: "撤销"
437
+ }
438
+ ) : /* @__PURE__ */ e(c, { type: "secondary", children: "-" })
439
+ }
440
+ ]
441
+ }
442
+ )
443
+ }
444
+ ]
445
+ }
446
+ ) }),
447
+ /* @__PURE__ */ i(
448
+ he,
449
+ {
450
+ title: /* @__PURE__ */ i(A, { children: [
451
+ /* @__PURE__ */ e(q, {}),
452
+ " 创建邀请"
453
+ ] }),
454
+ open: X,
455
+ onCancel: () => x(!1),
456
+ onOk: ee,
457
+ confirmLoading: Y,
458
+ okText: "创建",
459
+ children: [
460
+ /* @__PURE__ */ i(m, { form: C, layout: "vertical", initialValues: { type: "link", roleCode: "member", maxUses: 1 }, children: [
461
+ /* @__PURE__ */ e(m.Item, { name: "type", label: "类型", rules: [{ required: !0 }], children: /* @__PURE__ */ i(S.Group, { children: [
462
+ /* @__PURE__ */ i(S.Button, { value: "link", children: [
463
+ /* @__PURE__ */ e(D, {}),
464
+ " 邀请链接"
465
+ ] }),
466
+ /* @__PURE__ */ i(S.Button, { value: "code", children: [
467
+ /* @__PURE__ */ e(U, {}),
468
+ " 邀请码"
469
+ ] })
470
+ ] }) }),
471
+ /* @__PURE__ */ e(m.Item, { name: "inviteeEmail", label: "被邀请人邮箱 (可选, 链接模式可指定)", children: /* @__PURE__ */ e(B, { prefix: /* @__PURE__ */ e(j, {}), placeholder: "留空则任何人都可用 (码模式)" }) }),
472
+ /* @__PURE__ */ e(m.Item, { name: "roleCode", label: "加入后角色", rules: [{ required: !0 }], children: /* @__PURE__ */ i(w, { children: [
473
+ /* @__PURE__ */ e(w.Option, { value: "owner", children: "owner (完全管理)" }),
474
+ /* @__PURE__ */ e(w.Option, { value: "admin", children: "admin (管理员)" }),
475
+ /* @__PURE__ */ e(w.Option, { value: "member", children: "member (普通成员)" })
476
+ ] }) }),
477
+ /* @__PURE__ */ e(
478
+ m.Item,
479
+ {
480
+ name: "maxUses",
481
+ label: "最大使用次数",
482
+ extra: "码模式可 > 1 (批量邀请), 链接模式固定 1",
483
+ children: /* @__PURE__ */ e(ue, { min: 1, max: 100, style: { width: "100%" } })
484
+ }
485
+ )
486
+ ] }),
487
+ /* @__PURE__ */ e(T, { type: "info", showIcon: !0, title: "链接模式 7 天过期, 码模式同 7 天" })
488
+ ]
489
+ }
490
+ )
491
+ ] });
492
+ };
493
+ export {
494
+ Me as default
495
+ };