@yuku123/z-team-component 0.2.4 → 0.2.6
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/InvitationManagementPage-BVBwdTi0.js +490 -0
- package/dist/LowCodePage-DH-DYM7K.js +17 -0
- package/dist/OnboardingPage-Cy2YU_Og.js +393 -0
- package/dist/{ProjectApp-Ce_PotqP.js → ProjectApp-YRqDFopZ.js} +2451 -2128
- package/dist/api-B6evTauY.js +20 -0
- package/dist/{index-Denxu2yE.js → index-CHSnuHux.js} +12228 -13244
- package/dist/index-D_SjmsjB.js +183 -0
- package/dist/index.js +1 -1
- package/dist/pages.js +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,393 @@
|
|
|
1
|
+
import { jsx as t, jsxs as r, Fragment as b } from "react/jsx-runtime";
|
|
2
|
+
import { useState as a, useMemo as oe, useEffect as W } from "react";
|
|
3
|
+
import { useNavigate as le, useSearchParams as se } from "react-router-dom";
|
|
4
|
+
import { Form as c, message as o, Spin as ce, Typography as de, Card as d, Tag as x, Empty as me, Row as he, Col as fe, Space as S, Avatar as ge, Pagination as pe, Button as T, Result as ue, Modal as E, Input as k, Alert as U } from "antd";
|
|
5
|
+
import { RocketOutlined as q, ApartmentOutlined as ye, CheckCircleOutlined as Ce, PlusOutlined as z, KeyOutlined as m, GiftOutlined as ve, HomeOutlined as we, CrownOutlined as be } from "@ant-design/icons";
|
|
6
|
+
import { g as xe, a as Se, s as Te, r as ke } from "./api-B6evTauY.js";
|
|
7
|
+
import { a as ze } from "./ProjectApp-YRqDFopZ.js";
|
|
8
|
+
const { Title: u, Text: O, Paragraph: Oe } = de, y = 12, Me = () => {
|
|
9
|
+
const L = le(), [H] = se(), [_, I] = a(!0), [i, $] = a(null), [l, G] = a([]), [A, F] = a(0), [h, B] = a(""), [C, K] = a(1), X = oe(() => {
|
|
10
|
+
const e = (C - 1) * y;
|
|
11
|
+
return l.slice(e, e + y);
|
|
12
|
+
}, [l, C]), [Z, f] = a(!1), [P] = c.useForm(), [J, j] = a(!1), [D, g] = a(!1), [R] = c.useForm(), [Q, M] = a(!1), v = H.get("invite") || "";
|
|
13
|
+
W(() => {
|
|
14
|
+
V();
|
|
15
|
+
}, []), W(() => {
|
|
16
|
+
v && i && ne(v);
|
|
17
|
+
}, [v, i]);
|
|
18
|
+
const V = async () => {
|
|
19
|
+
I(!0);
|
|
20
|
+
try {
|
|
21
|
+
const e = await xe();
|
|
22
|
+
$(e), G(e.memberships || []), e.tenantCount === 0 ? F(1) : (F(0), e.memberships && e.memberships.length > 0 && B(e.memberships[0].tenantCode));
|
|
23
|
+
} catch (e) {
|
|
24
|
+
o.error("加载租户信息失败: " + ((e == null ? void 0 : e.message) || e));
|
|
25
|
+
} finally {
|
|
26
|
+
I(!1);
|
|
27
|
+
}
|
|
28
|
+
}, p = async (e) => {
|
|
29
|
+
try {
|
|
30
|
+
const n = await Te(e);
|
|
31
|
+
n && n.token && (localStorage.setItem("token", n.token), o.success(`已自动进入 ${e} 租户`), L("/ctc"));
|
|
32
|
+
} catch (n) {
|
|
33
|
+
o.error("进入租户失败: " + ((n == null ? void 0 : n.message) || n));
|
|
34
|
+
}
|
|
35
|
+
}, Y = async () => {
|
|
36
|
+
if (!h) {
|
|
37
|
+
o.warning("请先选择一个租户");
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
await p(h);
|
|
41
|
+
}, ee = async () => {
|
|
42
|
+
try {
|
|
43
|
+
const e = await P.validateFields();
|
|
44
|
+
j(!0);
|
|
45
|
+
const n = JSON.parse(localStorage.getItem("userInfo") || "null") || {}, s = await ze.post("/ctc/ac/tenants", {
|
|
46
|
+
tenantCode: e.tenantCode,
|
|
47
|
+
tenantName: e.tenantName
|
|
48
|
+
}, {
|
|
49
|
+
headers: {
|
|
50
|
+
"X-User-Id": String(n.userId || n.id || "")
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
if (s && (s.tenantCode || s.id)) {
|
|
54
|
+
const w = s.tenantCode || e.tenantCode;
|
|
55
|
+
o.success("租户创建成功!正在进入..."), f(!1), await p(w);
|
|
56
|
+
}
|
|
57
|
+
} catch (e) {
|
|
58
|
+
if (e != null && e.errorFields) return;
|
|
59
|
+
o.error("创建失败: " + ((e == null ? void 0 : e.message) || e));
|
|
60
|
+
} finally {
|
|
61
|
+
j(!1);
|
|
62
|
+
}
|
|
63
|
+
}, te = async () => {
|
|
64
|
+
try {
|
|
65
|
+
const e = await R.validateFields();
|
|
66
|
+
M(!0);
|
|
67
|
+
const n = await ke(e.code.trim().toUpperCase());
|
|
68
|
+
n && n.tenantCode && (o.success("加入成功!正在进入..."), g(!1), await p(n.tenantCode));
|
|
69
|
+
} catch (e) {
|
|
70
|
+
if (e != null && e.errorFields) return;
|
|
71
|
+
o.error("兑换失败: " + ((e == null ? void 0 : e.message) || e));
|
|
72
|
+
} finally {
|
|
73
|
+
M(!1);
|
|
74
|
+
}
|
|
75
|
+
}, ne = async (e) => {
|
|
76
|
+
try {
|
|
77
|
+
const n = await Se(e);
|
|
78
|
+
n && n.tenantCode && (o.success("已接受邀请!正在进入..."), await p(n.tenantCode));
|
|
79
|
+
} catch (n) {
|
|
80
|
+
o.error("接受邀请失败: " + ((n == null ? void 0 : n.message) || n));
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
return _ ? /* @__PURE__ */ t("div", { style: { display: "flex", justifyContent: "center", alignItems: "center", minHeight: "100vh" }, children: /* @__PURE__ */ t(ce, { size: "large", description: "加载中..." }) }) : /* @__PURE__ */ r("div", { style: {
|
|
84
|
+
minHeight: "100vh",
|
|
85
|
+
background: "linear-gradient(135deg, #1677ff 0%, #0958d9 100%)",
|
|
86
|
+
padding: "40px 20px"
|
|
87
|
+
}, children: [
|
|
88
|
+
/* @__PURE__ */ r("div", { style: { maxWidth: 720, margin: "0 auto" }, children: [
|
|
89
|
+
/* @__PURE__ */ r("div", { style: { textAlign: "center", marginBottom: 24, color: "#fff" }, children: [
|
|
90
|
+
/* @__PURE__ */ t(q, { style: { fontSize: 40, marginBottom: 8 } }),
|
|
91
|
+
/* @__PURE__ */ r(u, { level: 2, style: {
|
|
92
|
+
color: "#fff",
|
|
93
|
+
margin: 0
|
|
94
|
+
}, children: [
|
|
95
|
+
"欢迎, ",
|
|
96
|
+
(i == null ? void 0 : i.nickname) || (i == null ? void 0 : i.username) || (i == null ? void 0 : i.email)
|
|
97
|
+
] }),
|
|
98
|
+
/* @__PURE__ */ t(O, { style: { color: "rgba(255,255,255,0.85)" }, children: "选择你的工作空间" })
|
|
99
|
+
] }),
|
|
100
|
+
A === 0 && /* @__PURE__ */ r(d, { children: [
|
|
101
|
+
/* @__PURE__ */ r("div", { style: {
|
|
102
|
+
display: "flex",
|
|
103
|
+
justifyContent: "space-between",
|
|
104
|
+
alignItems: "center",
|
|
105
|
+
marginBottom: 8,
|
|
106
|
+
flexWrap: "wrap",
|
|
107
|
+
gap: 8
|
|
108
|
+
}, children: [
|
|
109
|
+
/* @__PURE__ */ r(u, { level: 4, style: { margin: 0 }, children: [
|
|
110
|
+
/* @__PURE__ */ t(ye, {}),
|
|
111
|
+
" 选择工作空间"
|
|
112
|
+
] }),
|
|
113
|
+
/* @__PURE__ */ r(x, { color: "blue", children: [
|
|
114
|
+
l.length,
|
|
115
|
+
" 个租户"
|
|
116
|
+
] })
|
|
117
|
+
] }),
|
|
118
|
+
/* @__PURE__ */ t(Oe, { type: "secondary", style: { marginBottom: 20 }, children: l.length === 0 ? "你还没有加入任何租户,可以创建新租户 / 输入邀请码加入:" : l.length > 1 ? `你属于 ${l.length} 个租户,点击选择一个进入:` : "你当前属于 1 个租户,可以直接进入,或创建新租户 / 加入其他组织:" }),
|
|
119
|
+
l.length === 0 ? /* @__PURE__ */ t(
|
|
120
|
+
me,
|
|
121
|
+
{
|
|
122
|
+
description: "你还没有加入任何租户",
|
|
123
|
+
style: { padding: "40px 0" }
|
|
124
|
+
}
|
|
125
|
+
) : /* @__PURE__ */ r(b, { children: [
|
|
126
|
+
/* @__PURE__ */ t(he, { gutter: [16, 16], children: X.map((e) => {
|
|
127
|
+
var N;
|
|
128
|
+
const n = h === e.tenantCode, s = e.roleCode === "owner", w = e.roleCode === "admin", re = s ? "gold" : w ? "blue" : "default", ie = s ? /* @__PURE__ */ t(be, {}) : null, ae = ((N = (e.tenantName || e.tenantCode || "?").trim()[0]) == null ? void 0 : N.toUpperCase()) || "?";
|
|
129
|
+
return /* @__PURE__ */ t(fe, { xs: 24, sm: 12, md: 12, lg: 8, children: /* @__PURE__ */ r(
|
|
130
|
+
d,
|
|
131
|
+
{
|
|
132
|
+
hoverable: !0,
|
|
133
|
+
onClick: () => B(e.tenantCode),
|
|
134
|
+
style: {
|
|
135
|
+
cursor: "pointer",
|
|
136
|
+
position: "relative",
|
|
137
|
+
borderColor: n ? "#1677ff" : void 0,
|
|
138
|
+
borderWidth: n ? 2 : 1,
|
|
139
|
+
boxShadow: n ? "0 0 0 2px rgba(22,119,255,0.15)" : void 0,
|
|
140
|
+
transition: "all 0.2s",
|
|
141
|
+
height: "100%"
|
|
142
|
+
},
|
|
143
|
+
styles: { body: { padding: 16 } },
|
|
144
|
+
children: [
|
|
145
|
+
n && /* @__PURE__ */ t(
|
|
146
|
+
Ce,
|
|
147
|
+
{
|
|
148
|
+
style: {
|
|
149
|
+
position: "absolute",
|
|
150
|
+
top: 8,
|
|
151
|
+
right: 8,
|
|
152
|
+
color: "#1677ff",
|
|
153
|
+
fontSize: 20,
|
|
154
|
+
zIndex: 1
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
),
|
|
158
|
+
/* @__PURE__ */ r(S, { align: "start", size: 12, style: { width: "100%" }, children: [
|
|
159
|
+
/* @__PURE__ */ t(
|
|
160
|
+
ge,
|
|
161
|
+
{
|
|
162
|
+
size: 48,
|
|
163
|
+
style: {
|
|
164
|
+
backgroundColor: n ? "#1677ff" : "#f0f0f0",
|
|
165
|
+
color: n ? "#fff" : "#595959",
|
|
166
|
+
fontWeight: 600,
|
|
167
|
+
flexShrink: 0
|
|
168
|
+
},
|
|
169
|
+
children: ae
|
|
170
|
+
}
|
|
171
|
+
),
|
|
172
|
+
/* @__PURE__ */ r("div", { style: { flex: 1, minWidth: 0 }, children: [
|
|
173
|
+
/* @__PURE__ */ t("div", { style: {
|
|
174
|
+
fontWeight: 600,
|
|
175
|
+
fontSize: 15,
|
|
176
|
+
marginBottom: 4,
|
|
177
|
+
overflow: "hidden",
|
|
178
|
+
textOverflow: "ellipsis",
|
|
179
|
+
whiteSpace: "nowrap"
|
|
180
|
+
}, children: e.tenantName || e.tenantCode }),
|
|
181
|
+
/* @__PURE__ */ r(S, { size: 4, wrap: !0, style: { marginBottom: 6 }, children: [
|
|
182
|
+
/* @__PURE__ */ t(
|
|
183
|
+
x,
|
|
184
|
+
{
|
|
185
|
+
color: re,
|
|
186
|
+
icon: ie,
|
|
187
|
+
style: { margin: 0 },
|
|
188
|
+
children: e.roleCode
|
|
189
|
+
}
|
|
190
|
+
),
|
|
191
|
+
e.memberStatus === 0 && /* @__PURE__ */ t(
|
|
192
|
+
x,
|
|
193
|
+
{
|
|
194
|
+
color: "default",
|
|
195
|
+
style: { margin: 0 },
|
|
196
|
+
children: "未激活"
|
|
197
|
+
}
|
|
198
|
+
)
|
|
199
|
+
] }),
|
|
200
|
+
/* @__PURE__ */ t("div", { style: {
|
|
201
|
+
color: "#8c8c8c",
|
|
202
|
+
fontSize: 12,
|
|
203
|
+
fontFamily: "monospace",
|
|
204
|
+
overflow: "hidden",
|
|
205
|
+
textOverflow: "ellipsis",
|
|
206
|
+
whiteSpace: "nowrap"
|
|
207
|
+
}, children: e.tenantCode }),
|
|
208
|
+
e.joinedAt && /* @__PURE__ */ r("div", { style: {
|
|
209
|
+
color: "#bfbfbf",
|
|
210
|
+
fontSize: 11,
|
|
211
|
+
marginTop: 4
|
|
212
|
+
}, children: [
|
|
213
|
+
"加入于 ",
|
|
214
|
+
e.joinedAt.slice(0, 10)
|
|
215
|
+
] })
|
|
216
|
+
] })
|
|
217
|
+
] })
|
|
218
|
+
]
|
|
219
|
+
}
|
|
220
|
+
) }, e.tenantCode);
|
|
221
|
+
}) }),
|
|
222
|
+
l.length > y && /* @__PURE__ */ t("div", { style: {
|
|
223
|
+
display: "flex",
|
|
224
|
+
justifyContent: "center",
|
|
225
|
+
marginTop: 24
|
|
226
|
+
}, children: /* @__PURE__ */ t(
|
|
227
|
+
pe,
|
|
228
|
+
{
|
|
229
|
+
current: C,
|
|
230
|
+
pageSize: y,
|
|
231
|
+
total: l.length,
|
|
232
|
+
onChange: K,
|
|
233
|
+
showSizeChanger: !1
|
|
234
|
+
}
|
|
235
|
+
) })
|
|
236
|
+
] }),
|
|
237
|
+
/* @__PURE__ */ r("div", { style: {
|
|
238
|
+
marginTop: 24,
|
|
239
|
+
paddingTop: 16,
|
|
240
|
+
borderTop: "1px solid #f0f0f0",
|
|
241
|
+
display: "flex",
|
|
242
|
+
gap: 8,
|
|
243
|
+
justifyContent: "space-between",
|
|
244
|
+
alignItems: "center",
|
|
245
|
+
flexWrap: "wrap"
|
|
246
|
+
}, children: [
|
|
247
|
+
/* @__PURE__ */ r(S, { children: [
|
|
248
|
+
/* @__PURE__ */ t(T, { icon: /* @__PURE__ */ t(z, {}), onClick: () => f(!0), children: "创建新租户" }),
|
|
249
|
+
/* @__PURE__ */ t(T, { icon: /* @__PURE__ */ t(m, {}), onClick: () => g(!0), children: "输入邀请码加入" })
|
|
250
|
+
] }),
|
|
251
|
+
/* @__PURE__ */ t(
|
|
252
|
+
T,
|
|
253
|
+
{
|
|
254
|
+
type: "primary",
|
|
255
|
+
size: "large",
|
|
256
|
+
icon: /* @__PURE__ */ t(q, {}),
|
|
257
|
+
onClick: Y,
|
|
258
|
+
disabled: !h,
|
|
259
|
+
children: "进入选中的租户"
|
|
260
|
+
}
|
|
261
|
+
)
|
|
262
|
+
] })
|
|
263
|
+
] }),
|
|
264
|
+
A === 1 && /* @__PURE__ */ r(d, { children: [
|
|
265
|
+
/* @__PURE__ */ t(
|
|
266
|
+
ue,
|
|
267
|
+
{
|
|
268
|
+
icon: /* @__PURE__ */ t(ve, { style: { color: "#1677ff" } }),
|
|
269
|
+
title: "你还没有加入任何组织",
|
|
270
|
+
subTitle: "FEATURE049 · 多租户身份模型. 选择下面任一方式开始:"
|
|
271
|
+
}
|
|
272
|
+
),
|
|
273
|
+
/* @__PURE__ */ r("div", { style: { display: "grid", gridTemplateColumns: "1fr 1fr", gap: 16, marginTop: 16 }, children: [
|
|
274
|
+
/* @__PURE__ */ r(
|
|
275
|
+
d,
|
|
276
|
+
{
|
|
277
|
+
hoverable: !0,
|
|
278
|
+
onClick: () => f(!0),
|
|
279
|
+
style: { textAlign: "center", cursor: "pointer" },
|
|
280
|
+
children: [
|
|
281
|
+
/* @__PURE__ */ t(z, { style: { fontSize: 32, color: "#1677ff", marginBottom: 8 } }),
|
|
282
|
+
/* @__PURE__ */ t(u, { level: 5, style: { margin: 0 }, children: "创建我的组织" }),
|
|
283
|
+
/* @__PURE__ */ t(O, { type: "secondary", style: { fontSize: 12 }, children: "第一个组织, 你将是 owner" })
|
|
284
|
+
]
|
|
285
|
+
}
|
|
286
|
+
),
|
|
287
|
+
/* @__PURE__ */ r(
|
|
288
|
+
d,
|
|
289
|
+
{
|
|
290
|
+
hoverable: !0,
|
|
291
|
+
onClick: () => g(!0),
|
|
292
|
+
style: { textAlign: "center", cursor: "pointer" },
|
|
293
|
+
children: [
|
|
294
|
+
/* @__PURE__ */ t(m, { style: { fontSize: 32, color: "#52c41a", marginBottom: 8 } }),
|
|
295
|
+
/* @__PURE__ */ t(u, { level: 5, style: { margin: 0 }, children: "输入邀请码" }),
|
|
296
|
+
/* @__PURE__ */ t(O, { type: "secondary", style: { fontSize: 12 }, children: "有同事给你的 6 位码" })
|
|
297
|
+
]
|
|
298
|
+
}
|
|
299
|
+
)
|
|
300
|
+
] })
|
|
301
|
+
] })
|
|
302
|
+
] }),
|
|
303
|
+
/* @__PURE__ */ r(
|
|
304
|
+
E,
|
|
305
|
+
{
|
|
306
|
+
title: /* @__PURE__ */ r(b, { children: [
|
|
307
|
+
/* @__PURE__ */ t(z, {}),
|
|
308
|
+
" 创建新组织"
|
|
309
|
+
] }),
|
|
310
|
+
open: Z,
|
|
311
|
+
onCancel: () => f(!1),
|
|
312
|
+
onOk: ee,
|
|
313
|
+
confirmLoading: J,
|
|
314
|
+
okText: "创建",
|
|
315
|
+
children: [
|
|
316
|
+
/* @__PURE__ */ r(c, { form: P, layout: "vertical", children: [
|
|
317
|
+
/* @__PURE__ */ t(
|
|
318
|
+
c.Item,
|
|
319
|
+
{
|
|
320
|
+
name: "tenantName",
|
|
321
|
+
label: "组织名称",
|
|
322
|
+
rules: [{ required: !0, message: "请输入组织名称" }],
|
|
323
|
+
children: /* @__PURE__ */ t(k, { prefix: /* @__PURE__ */ t(we, {}), placeholder: "如: 我的公司" })
|
|
324
|
+
}
|
|
325
|
+
),
|
|
326
|
+
/* @__PURE__ */ t(
|
|
327
|
+
c.Item,
|
|
328
|
+
{
|
|
329
|
+
name: "tenantCode",
|
|
330
|
+
label: "组织编码",
|
|
331
|
+
extra: "英文+数字, 唯一标识, 创建后不可改",
|
|
332
|
+
rules: [
|
|
333
|
+
{ required: !0, message: "请输入组织编码" },
|
|
334
|
+
{ pattern: /^[a-zA-Z0-9_]{3,32}$/, message: "3-32 位字母数字下划线" }
|
|
335
|
+
],
|
|
336
|
+
children: /* @__PURE__ */ t(k, { prefix: /* @__PURE__ */ t(m, {}), placeholder: "如: my_company" })
|
|
337
|
+
}
|
|
338
|
+
)
|
|
339
|
+
] }),
|
|
340
|
+
/* @__PURE__ */ t(
|
|
341
|
+
U,
|
|
342
|
+
{
|
|
343
|
+
type: "info",
|
|
344
|
+
showIcon: !0,
|
|
345
|
+
title: "创建后你将自动成为该组织的 owner, 可邀请他人加入"
|
|
346
|
+
}
|
|
347
|
+
)
|
|
348
|
+
]
|
|
349
|
+
}
|
|
350
|
+
),
|
|
351
|
+
/* @__PURE__ */ r(
|
|
352
|
+
E,
|
|
353
|
+
{
|
|
354
|
+
title: /* @__PURE__ */ r(b, { children: [
|
|
355
|
+
/* @__PURE__ */ t(m, {}),
|
|
356
|
+
" 输入邀请码"
|
|
357
|
+
] }),
|
|
358
|
+
open: D,
|
|
359
|
+
onCancel: () => g(!1),
|
|
360
|
+
onOk: te,
|
|
361
|
+
confirmLoading: Q,
|
|
362
|
+
okText: "加入",
|
|
363
|
+
children: [
|
|
364
|
+
/* @__PURE__ */ t(c, { form: R, layout: "vertical", children: /* @__PURE__ */ t(
|
|
365
|
+
c.Item,
|
|
366
|
+
{
|
|
367
|
+
name: "code",
|
|
368
|
+
label: "6 位邀请码",
|
|
369
|
+
rules: [
|
|
370
|
+
{ required: !0, message: "请输入邀请码" },
|
|
371
|
+
{ len: 6, message: "邀请码为 6 位" }
|
|
372
|
+
],
|
|
373
|
+
children: /* @__PURE__ */ t(
|
|
374
|
+
k,
|
|
375
|
+
{
|
|
376
|
+
prefix: /* @__PURE__ */ t(m, {}),
|
|
377
|
+
placeholder: "如: X7K2M9",
|
|
378
|
+
maxLength: 6,
|
|
379
|
+
style: { textTransform: "uppercase", fontSize: 20, letterSpacing: 4 },
|
|
380
|
+
size: "large"
|
|
381
|
+
}
|
|
382
|
+
)
|
|
383
|
+
}
|
|
384
|
+
) }),
|
|
385
|
+
/* @__PURE__ */ t(U, { type: "info", showIcon: !0, title: "加入后, 你将获得该组织指定角色的访问权限" })
|
|
386
|
+
]
|
|
387
|
+
}
|
|
388
|
+
)
|
|
389
|
+
] });
|
|
390
|
+
};
|
|
391
|
+
export {
|
|
392
|
+
Me as default
|
|
393
|
+
};
|