@yuku123/z-task-component 0.0.0-stage → 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.
- package/dist/index.js +1120 -0
- package/dist/jsx-runtime-z6PQ6F3d.js +296 -0
- package/dist/pages.js +663 -0
- package/dist/z-task-component.css +1 -0
- package/package.json +43 -4
- package/README.md +0 -3
package/dist/pages.js
ADDED
|
@@ -0,0 +1,663 @@
|
|
|
1
|
+
import { j as e } from "./jsx-runtime-z6PQ6F3d.js";
|
|
2
|
+
import { Typography as N, Card as x, Space as S, Tag as C, Row as F, Col as z, Statistic as T, Input as g, Select as k, Table as B, Button as j, message as u, Form as o, DatePicker as E, Modal as $ } from "antd";
|
|
3
|
+
import { useNavigate as O, useParams as K, Routes as V, Route as b, Navigate as W } from "react-router-dom";
|
|
4
|
+
import { useState as h, useEffect as w } from "react";
|
|
5
|
+
import { HomeOutlined as H, DashboardOutlined as Z, AppstoreOutlined as A, FileTextOutlined as q, ClockCircleOutlined as _, CheckCircleOutlined as J, SearchOutlined as X, PlusOutlined as R, EditOutlined as D, UserOutlined as U, LockOutlined as M } from "@ant-design/icons";
|
|
6
|
+
import { createRequest as G } from "@yuku123/z-frontend-common";
|
|
7
|
+
const Ce = { title: "z-task 任务管理", short: "z-task" }, Q = [
|
|
8
|
+
{ key: "/z-task/home", label: "首页", icon: /* @__PURE__ */ e.jsx(H, {}) },
|
|
9
|
+
{ key: "/z-task/overview", label: "仪表盘", icon: /* @__PURE__ */ e.jsx(Z, {}) },
|
|
10
|
+
{ key: "/z-task/task", label: "任务管理", icon: /* @__PURE__ */ e.jsx(A, {}) },
|
|
11
|
+
{ key: "/z-task/project", label: "项目管理", icon: /* @__PURE__ */ e.jsx(A, {}) },
|
|
12
|
+
{ key: "/z-task/user", label: "用户管理", icon: /* @__PURE__ */ e.jsx(A, {}) }
|
|
13
|
+
], { Title: Y, Paragraph: ee } = N;
|
|
14
|
+
function te() {
|
|
15
|
+
const t = O(), [l, c] = h(null);
|
|
16
|
+
w(() => {
|
|
17
|
+
const n = localStorage.getItem("userInfo");
|
|
18
|
+
if (n)
|
|
19
|
+
try {
|
|
20
|
+
c(JSON.parse(n));
|
|
21
|
+
} catch {
|
|
22
|
+
c({ name: n });
|
|
23
|
+
}
|
|
24
|
+
}, []);
|
|
25
|
+
const d = Q.filter((n) => n.key !== "/z-task/home");
|
|
26
|
+
return /* @__PURE__ */ e.jsxs("div", { children: [
|
|
27
|
+
/* @__PURE__ */ e.jsx(x, { style: { marginBottom: 16, background: "linear-gradient(135deg, #7c3aed 0%, #6d28d9 100%)", border: "none" }, children: /* @__PURE__ */ e.jsxs(S, { direction: "vertical", size: 4, style: { color: "#fff" }, children: [
|
|
28
|
+
/* @__PURE__ */ e.jsxs(Y, { level: 3, style: { color: "#fff", margin: 0 }, children: [
|
|
29
|
+
"欢迎",
|
|
30
|
+
l != null && l.name ? `,${l.name}` : ""
|
|
31
|
+
] }),
|
|
32
|
+
/* @__PURE__ */ e.jsx(ee, { style: { color: "rgba(255,255,255,0.85)", margin: 0 }, children: "z-task 任务管理 管理台" }),
|
|
33
|
+
(l == null ? void 0 : l.role) && /* @__PURE__ */ e.jsx(C, { style: { marginTop: 8, background: "rgba(255,255,255,0.2)", color: "#fff", border: "none" }, children: l.role })
|
|
34
|
+
] }) }),
|
|
35
|
+
/* @__PURE__ */ e.jsx(F, { gutter: [16, 16], children: d.map((n) => /* @__PURE__ */ e.jsx(z, { xs: 24, sm: 12, md: 12, lg: 8, children: /* @__PURE__ */ e.jsx(x, { hoverable: !0, onClick: () => t(n.key), style: { borderTop: "3px solid #7c3aed" }, children: /* @__PURE__ */ e.jsxs(S, { align: "start", size: 12, children: [
|
|
36
|
+
/* @__PURE__ */ e.jsx("div", { style: {
|
|
37
|
+
width: 44,
|
|
38
|
+
height: 44,
|
|
39
|
+
borderRadius: 8,
|
|
40
|
+
flexShrink: 0,
|
|
41
|
+
background: "rgba(124,58,237,0.08)",
|
|
42
|
+
color: "#7c3aed",
|
|
43
|
+
display: "flex",
|
|
44
|
+
alignItems: "center",
|
|
45
|
+
justifyContent: "center",
|
|
46
|
+
fontSize: 20
|
|
47
|
+
}, children: n.icon }),
|
|
48
|
+
/* @__PURE__ */ e.jsxs("div", { style: { minWidth: 0 }, children: [
|
|
49
|
+
/* @__PURE__ */ e.jsx("div", { style: { fontSize: 15, fontWeight: 600, color: "#0f172a" }, children: n.label }),
|
|
50
|
+
/* @__PURE__ */ e.jsx("div", { style: { fontSize: 12, color: "#94a3b8", marginTop: 2 }, children: n.key })
|
|
51
|
+
] })
|
|
52
|
+
] }) }) }, n.key)) })
|
|
53
|
+
] });
|
|
54
|
+
}
|
|
55
|
+
const p = G({ baseURL: "/api" });
|
|
56
|
+
p.interceptors.request.use((t) => {
|
|
57
|
+
const l = localStorage.getItem("userId");
|
|
58
|
+
return l && (t.headers["X-User-Id"] = l), t;
|
|
59
|
+
});
|
|
60
|
+
function Te(t) {
|
|
61
|
+
t && t.apiBase !== void 0 && (p.defaults.baseURL = t.apiBase);
|
|
62
|
+
}
|
|
63
|
+
const se = (t) => p.get("/api/task/list", { params: { listId: t } }), ae = (t) => p.get("/api/task/assignee/list", { params: { userId: t } }), re = (t) => p.post("/api/task/complete", null, { params: { taskId: t } }), le = (t) => p.post("/api/task/reopen", null, { params: { taskId: t } }), ne = (t) => p.get("/api/project/user/list", { params: { userId: t } }), ie = (t) => p.post("/api/project", t), oe = (t) => p.put(`/api/project/${t}/archive`);
|
|
64
|
+
function ce() {
|
|
65
|
+
const [t, l] = h({
|
|
66
|
+
total: 0,
|
|
67
|
+
todo: 0,
|
|
68
|
+
doing: 0,
|
|
69
|
+
done: 0,
|
|
70
|
+
cancelled: 0
|
|
71
|
+
});
|
|
72
|
+
return w(() => {
|
|
73
|
+
const c = localStorage.getItem("userId") || "1";
|
|
74
|
+
ae(c).then((d) => {
|
|
75
|
+
const n = d.data || [];
|
|
76
|
+
l({
|
|
77
|
+
total: n.length,
|
|
78
|
+
todo: n.filter((r) => r.status === 0).length,
|
|
79
|
+
doing: n.filter((r) => r.status === 1).length,
|
|
80
|
+
done: n.filter((r) => r.status === 2).length,
|
|
81
|
+
cancelled: n.filter((r) => r.status === 3).length
|
|
82
|
+
});
|
|
83
|
+
}).catch(() => {
|
|
84
|
+
});
|
|
85
|
+
}, []), /* @__PURE__ */ e.jsxs("div", { children: [
|
|
86
|
+
/* @__PURE__ */ e.jsx("h1", { style: { marginBottom: 24 }, children: "仪表盘" }),
|
|
87
|
+
/* @__PURE__ */ e.jsxs(F, { gutter: 16, children: [
|
|
88
|
+
/* @__PURE__ */ e.jsx(z, { span: 6, children: /* @__PURE__ */ e.jsx(x, { children: /* @__PURE__ */ e.jsx(
|
|
89
|
+
T,
|
|
90
|
+
{
|
|
91
|
+
title: "总任务数",
|
|
92
|
+
value: t.total,
|
|
93
|
+
prefix: /* @__PURE__ */ e.jsx(q, { style: { color: "#1890ff" } })
|
|
94
|
+
}
|
|
95
|
+
) }) }),
|
|
96
|
+
/* @__PURE__ */ e.jsx(z, { span: 6, children: /* @__PURE__ */ e.jsx(x, { children: /* @__PURE__ */ e.jsx(
|
|
97
|
+
T,
|
|
98
|
+
{
|
|
99
|
+
title: "待办",
|
|
100
|
+
value: t.todo,
|
|
101
|
+
prefix: /* @__PURE__ */ e.jsx(_, { style: { color: "#faad14" } })
|
|
102
|
+
}
|
|
103
|
+
) }) }),
|
|
104
|
+
/* @__PURE__ */ e.jsx(z, { span: 6, children: /* @__PURE__ */ e.jsx(x, { children: /* @__PURE__ */ e.jsx(
|
|
105
|
+
T,
|
|
106
|
+
{
|
|
107
|
+
title: "进行中",
|
|
108
|
+
value: t.doing,
|
|
109
|
+
prefix: /* @__PURE__ */ e.jsx(q, { style: { color: "#1890ff" } })
|
|
110
|
+
}
|
|
111
|
+
) }) }),
|
|
112
|
+
/* @__PURE__ */ e.jsx(z, { span: 6, children: /* @__PURE__ */ e.jsx(x, { children: /* @__PURE__ */ e.jsx(
|
|
113
|
+
T,
|
|
114
|
+
{
|
|
115
|
+
title: "已完成",
|
|
116
|
+
value: t.done,
|
|
117
|
+
prefix: /* @__PURE__ */ e.jsx(J, { style: { color: "#52c41a" } })
|
|
118
|
+
}
|
|
119
|
+
) }) })
|
|
120
|
+
] })
|
|
121
|
+
] });
|
|
122
|
+
}
|
|
123
|
+
const { Search: de } = g, { Option: P } = k, ue = {
|
|
124
|
+
0: { color: "gold", text: "待办" },
|
|
125
|
+
1: { color: "blue", text: "进行中" },
|
|
126
|
+
2: { color: "green", text: "已完成" }
|
|
127
|
+
}, xe = {
|
|
128
|
+
0: { color: "green", text: "低" },
|
|
129
|
+
1: { color: "gold", text: "中" },
|
|
130
|
+
2: { color: "orange", text: "高" },
|
|
131
|
+
3: { color: "red", text: "紧急" }
|
|
132
|
+
};
|
|
133
|
+
function he() {
|
|
134
|
+
const t = O(), [l, c] = h([]), [d, n] = h(!1), [r, m] = h(null), s = async (a) => {
|
|
135
|
+
if (a) {
|
|
136
|
+
n(!0);
|
|
137
|
+
try {
|
|
138
|
+
const i = await se(a);
|
|
139
|
+
c(i.data || []);
|
|
140
|
+
} catch {
|
|
141
|
+
u.error("加载任务失败");
|
|
142
|
+
} finally {
|
|
143
|
+
n(!1);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
};
|
|
147
|
+
w(() => {
|
|
148
|
+
r && s(r);
|
|
149
|
+
}, [r]);
|
|
150
|
+
const f = [
|
|
151
|
+
{
|
|
152
|
+
title: "ID",
|
|
153
|
+
dataIndex: "id",
|
|
154
|
+
key: "id",
|
|
155
|
+
width: 80
|
|
156
|
+
},
|
|
157
|
+
{
|
|
158
|
+
title: "任务名称",
|
|
159
|
+
dataIndex: "title",
|
|
160
|
+
key: "title"
|
|
161
|
+
},
|
|
162
|
+
{
|
|
163
|
+
title: "优先级",
|
|
164
|
+
dataIndex: "priority",
|
|
165
|
+
key: "priority",
|
|
166
|
+
render: (a) => {
|
|
167
|
+
const i = xe[a] || { color: "default", text: String(a) };
|
|
168
|
+
return /* @__PURE__ */ e.jsx(C, { color: i.color, children: i.text });
|
|
169
|
+
}
|
|
170
|
+
},
|
|
171
|
+
{
|
|
172
|
+
title: "状态",
|
|
173
|
+
dataIndex: "status",
|
|
174
|
+
key: "status",
|
|
175
|
+
render: (a) => {
|
|
176
|
+
const i = ue[a] || { color: "default", text: String(a) };
|
|
177
|
+
return /* @__PURE__ */ e.jsx(C, { color: i.color, children: i.text });
|
|
178
|
+
}
|
|
179
|
+
},
|
|
180
|
+
{
|
|
181
|
+
title: "截止日期",
|
|
182
|
+
dataIndex: "dueDate",
|
|
183
|
+
key: "dueDate",
|
|
184
|
+
render: (a) => a || "-"
|
|
185
|
+
},
|
|
186
|
+
{
|
|
187
|
+
title: "操作",
|
|
188
|
+
key: "action",
|
|
189
|
+
render: (a, i) => /* @__PURE__ */ e.jsxs(S, { size: "middle", children: [
|
|
190
|
+
/* @__PURE__ */ e.jsx(j, { type: "link", icon: /* @__PURE__ */ e.jsx(D, {}), onClick: () => t(`/z-task/task/edit/${i.id}`), children: "编辑" }),
|
|
191
|
+
i.status === 2 ? /* @__PURE__ */ e.jsx(j, { type: "link", onClick: () => L(i.id), children: "重新打开" }) : /* @__PURE__ */ e.jsx(j, { type: "link", onClick: () => I(i.id), children: "完成" })
|
|
192
|
+
] })
|
|
193
|
+
}
|
|
194
|
+
], I = async (a) => {
|
|
195
|
+
try {
|
|
196
|
+
await re(a), u.success("任务已完成"), s(r);
|
|
197
|
+
} catch {
|
|
198
|
+
u.error("操作失败");
|
|
199
|
+
}
|
|
200
|
+
}, L = async (a) => {
|
|
201
|
+
try {
|
|
202
|
+
await le(a), u.success("任务已重新打开"), s(r);
|
|
203
|
+
} catch {
|
|
204
|
+
u.error("操作失败");
|
|
205
|
+
}
|
|
206
|
+
};
|
|
207
|
+
return /* @__PURE__ */ e.jsxs(
|
|
208
|
+
x,
|
|
209
|
+
{
|
|
210
|
+
title: "任务管理",
|
|
211
|
+
extra: /* @__PURE__ */ e.jsx(j, { type: "primary", icon: /* @__PURE__ */ e.jsx(R, {}), onClick: () => t("/z-task/task/edit/new"), children: "新建任务" }),
|
|
212
|
+
children: [
|
|
213
|
+
/* @__PURE__ */ e.jsxs("div", { style: { marginBottom: 16, display: "flex", gap: 16 }, children: [
|
|
214
|
+
/* @__PURE__ */ e.jsxs(
|
|
215
|
+
k,
|
|
216
|
+
{
|
|
217
|
+
placeholder: "选择列表",
|
|
218
|
+
style: { width: 200 },
|
|
219
|
+
onChange: (a) => m(a),
|
|
220
|
+
allowClear: !0,
|
|
221
|
+
children: [
|
|
222
|
+
/* @__PURE__ */ e.jsx(P, { value: 1, children: "待办" }),
|
|
223
|
+
/* @__PURE__ */ e.jsx(P, { value: 2, children: "进行中" }),
|
|
224
|
+
/* @__PURE__ */ e.jsx(P, { value: 3, children: "已完成" })
|
|
225
|
+
]
|
|
226
|
+
}
|
|
227
|
+
),
|
|
228
|
+
/* @__PURE__ */ e.jsx(
|
|
229
|
+
de,
|
|
230
|
+
{
|
|
231
|
+
placeholder: "搜索任务名称",
|
|
232
|
+
allowClear: !0,
|
|
233
|
+
enterButton: /* @__PURE__ */ e.jsx(X, {}),
|
|
234
|
+
style: { width: 300 }
|
|
235
|
+
}
|
|
236
|
+
)
|
|
237
|
+
] }),
|
|
238
|
+
/* @__PURE__ */ e.jsx(
|
|
239
|
+
B,
|
|
240
|
+
{
|
|
241
|
+
columns: f,
|
|
242
|
+
dataSource: l,
|
|
243
|
+
rowKey: "id",
|
|
244
|
+
loading: d
|
|
245
|
+
}
|
|
246
|
+
)
|
|
247
|
+
]
|
|
248
|
+
}
|
|
249
|
+
);
|
|
250
|
+
}
|
|
251
|
+
const { Option: y } = k, me = [
|
|
252
|
+
{ value: 0, label: "低" },
|
|
253
|
+
{ value: 1, label: "中" },
|
|
254
|
+
{ value: 2, label: "高" },
|
|
255
|
+
{ value: 3, label: "紧急" }
|
|
256
|
+
], je = [
|
|
257
|
+
{ value: 0, label: "待办" },
|
|
258
|
+
{ value: 1, label: "进行中" },
|
|
259
|
+
{ value: 2, label: "已完成" }
|
|
260
|
+
];
|
|
261
|
+
function pe() {
|
|
262
|
+
const t = O(), { id: l } = K(), c = l !== "new", [d] = o.useForm(), [n, r] = h(!1);
|
|
263
|
+
w(() => {
|
|
264
|
+
c && l && (r(!0), r(!1));
|
|
265
|
+
}, [l, c]);
|
|
266
|
+
const m = async (s) => {
|
|
267
|
+
try {
|
|
268
|
+
u.success(c ? "任务更新成功" : "任务创建成功"), t("/z-task/task");
|
|
269
|
+
} catch {
|
|
270
|
+
u.error(c ? "更新失败" : "创建失败");
|
|
271
|
+
}
|
|
272
|
+
};
|
|
273
|
+
return /* @__PURE__ */ e.jsx(x, { title: c ? "编辑任务" : "新建任务", children: /* @__PURE__ */ e.jsxs(
|
|
274
|
+
o,
|
|
275
|
+
{
|
|
276
|
+
form: d,
|
|
277
|
+
layout: "vertical",
|
|
278
|
+
onFinish: m,
|
|
279
|
+
initialValues: {
|
|
280
|
+
status: 0,
|
|
281
|
+
priority: 1
|
|
282
|
+
},
|
|
283
|
+
children: [
|
|
284
|
+
/* @__PURE__ */ e.jsx(
|
|
285
|
+
o.Item,
|
|
286
|
+
{
|
|
287
|
+
name: "title",
|
|
288
|
+
label: "任务名称",
|
|
289
|
+
rules: [{ required: !0, message: "请输入任务名称" }],
|
|
290
|
+
children: /* @__PURE__ */ e.jsx(g, { placeholder: "请输入任务名称" })
|
|
291
|
+
}
|
|
292
|
+
),
|
|
293
|
+
/* @__PURE__ */ e.jsx(
|
|
294
|
+
o.Item,
|
|
295
|
+
{
|
|
296
|
+
name: "projectId",
|
|
297
|
+
label: "所属项目",
|
|
298
|
+
rules: [{ required: !0, message: "请选择所属项目" }],
|
|
299
|
+
children: /* @__PURE__ */ e.jsxs(k, { placeholder: "请选择项目", allowClear: !0, children: [
|
|
300
|
+
/* @__PURE__ */ e.jsx(y, { value: 1, children: "Z-Task项目" }),
|
|
301
|
+
/* @__PURE__ */ e.jsx(y, { value: 2, children: "Z-Config项目" })
|
|
302
|
+
] })
|
|
303
|
+
}
|
|
304
|
+
),
|
|
305
|
+
/* @__PURE__ */ e.jsx(
|
|
306
|
+
o.Item,
|
|
307
|
+
{
|
|
308
|
+
name: "listId",
|
|
309
|
+
label: "所属列表",
|
|
310
|
+
rules: [{ required: !0, message: "请选择列表" }],
|
|
311
|
+
children: /* @__PURE__ */ e.jsxs(k, { placeholder: "请选择列表", children: [
|
|
312
|
+
/* @__PURE__ */ e.jsx(y, { value: 1, children: "待办" }),
|
|
313
|
+
/* @__PURE__ */ e.jsx(y, { value: 2, children: "进行中" }),
|
|
314
|
+
/* @__PURE__ */ e.jsx(y, { value: 3, children: "已完成" })
|
|
315
|
+
] })
|
|
316
|
+
}
|
|
317
|
+
),
|
|
318
|
+
/* @__PURE__ */ e.jsx(
|
|
319
|
+
o.Item,
|
|
320
|
+
{
|
|
321
|
+
name: "priority",
|
|
322
|
+
label: "优先级",
|
|
323
|
+
children: /* @__PURE__ */ e.jsx(k, { children: me.map((s) => /* @__PURE__ */ e.jsx(y, { value: s.value, children: s.label }, s.value)) })
|
|
324
|
+
}
|
|
325
|
+
),
|
|
326
|
+
/* @__PURE__ */ e.jsx(
|
|
327
|
+
o.Item,
|
|
328
|
+
{
|
|
329
|
+
name: "status",
|
|
330
|
+
label: "状态",
|
|
331
|
+
children: /* @__PURE__ */ e.jsx(k, { children: je.map((s) => /* @__PURE__ */ e.jsx(y, { value: s.value, children: s.label }, s.value)) })
|
|
332
|
+
}
|
|
333
|
+
),
|
|
334
|
+
/* @__PURE__ */ e.jsx(
|
|
335
|
+
o.Item,
|
|
336
|
+
{
|
|
337
|
+
name: "dueDate",
|
|
338
|
+
label: "截止日期",
|
|
339
|
+
children: /* @__PURE__ */ e.jsx(E, { style: { width: "100%" } })
|
|
340
|
+
}
|
|
341
|
+
),
|
|
342
|
+
/* @__PURE__ */ e.jsx(
|
|
343
|
+
o.Item,
|
|
344
|
+
{
|
|
345
|
+
name: "description",
|
|
346
|
+
label: "任务描述",
|
|
347
|
+
children: /* @__PURE__ */ e.jsx(g.TextArea, { rows: 4, placeholder: "请输入任务描述" })
|
|
348
|
+
}
|
|
349
|
+
),
|
|
350
|
+
/* @__PURE__ */ e.jsx(o.Item, { children: /* @__PURE__ */ e.jsxs(S, { children: [
|
|
351
|
+
/* @__PURE__ */ e.jsx(j, { type: "primary", htmlType: "submit", children: c ? "更新" : "创建" }),
|
|
352
|
+
/* @__PURE__ */ e.jsx(j, { onClick: () => t("/z-task/task"), children: "取消" })
|
|
353
|
+
] }) })
|
|
354
|
+
]
|
|
355
|
+
}
|
|
356
|
+
) });
|
|
357
|
+
}
|
|
358
|
+
const ge = {
|
|
359
|
+
0: { color: "default", text: "已归档" },
|
|
360
|
+
1: { color: "green", text: "进行中" }
|
|
361
|
+
};
|
|
362
|
+
function fe() {
|
|
363
|
+
const [t, l] = h([]), [c, d] = h(!1), [n, r] = h(!1), [m] = o.useForm(), s = async () => {
|
|
364
|
+
d(!0);
|
|
365
|
+
try {
|
|
366
|
+
const a = localStorage.getItem("userId") || "1", i = await ne(a);
|
|
367
|
+
l(i.data || []);
|
|
368
|
+
} catch {
|
|
369
|
+
u.error("加载项目失败");
|
|
370
|
+
} finally {
|
|
371
|
+
d(!1);
|
|
372
|
+
}
|
|
373
|
+
};
|
|
374
|
+
w(() => {
|
|
375
|
+
s();
|
|
376
|
+
}, []);
|
|
377
|
+
const f = async () => {
|
|
378
|
+
try {
|
|
379
|
+
const a = await m.validateFields();
|
|
380
|
+
await ie(a), u.success("创建成功"), r(!1), m.resetFields(), s();
|
|
381
|
+
} catch {
|
|
382
|
+
u.error("创建失败");
|
|
383
|
+
}
|
|
384
|
+
}, I = async (a) => {
|
|
385
|
+
try {
|
|
386
|
+
await oe(a), u.success("归档成功"), s();
|
|
387
|
+
} catch {
|
|
388
|
+
u.error("归档失败");
|
|
389
|
+
}
|
|
390
|
+
}, L = [
|
|
391
|
+
{
|
|
392
|
+
title: "ID",
|
|
393
|
+
dataIndex: "id",
|
|
394
|
+
key: "id",
|
|
395
|
+
width: 80
|
|
396
|
+
},
|
|
397
|
+
{
|
|
398
|
+
title: "项目名称",
|
|
399
|
+
dataIndex: "name",
|
|
400
|
+
key: "name"
|
|
401
|
+
},
|
|
402
|
+
{
|
|
403
|
+
title: "项目描述",
|
|
404
|
+
dataIndex: "description",
|
|
405
|
+
key: "description",
|
|
406
|
+
render: (a) => a || "-"
|
|
407
|
+
},
|
|
408
|
+
{
|
|
409
|
+
title: "状态",
|
|
410
|
+
dataIndex: "status",
|
|
411
|
+
key: "status",
|
|
412
|
+
render: (a) => {
|
|
413
|
+
const i = ge[a] || { color: "default", text: String(a) };
|
|
414
|
+
return /* @__PURE__ */ e.jsx(C, { color: i.color, children: i.text });
|
|
415
|
+
}
|
|
416
|
+
},
|
|
417
|
+
{
|
|
418
|
+
title: "创建时间",
|
|
419
|
+
dataIndex: "createdAt",
|
|
420
|
+
key: "createdAt"
|
|
421
|
+
},
|
|
422
|
+
{
|
|
423
|
+
title: "操作",
|
|
424
|
+
key: "action",
|
|
425
|
+
render: (a, i) => /* @__PURE__ */ e.jsxs(S, { size: "middle", children: [
|
|
426
|
+
/* @__PURE__ */ e.jsx(j, { type: "link", icon: /* @__PURE__ */ e.jsx(D, {}), children: "编辑" }),
|
|
427
|
+
i.status === 1 && /* @__PURE__ */ e.jsx(j, { type: "link", danger: !0, onClick: () => I(i.id), children: "归档" })
|
|
428
|
+
] })
|
|
429
|
+
}
|
|
430
|
+
];
|
|
431
|
+
return /* @__PURE__ */ e.jsxs(
|
|
432
|
+
x,
|
|
433
|
+
{
|
|
434
|
+
title: "项目管理",
|
|
435
|
+
extra: /* @__PURE__ */ e.jsx(j, { type: "primary", icon: /* @__PURE__ */ e.jsx(R, {}), onClick: () => r(!0), children: "新建项目" }),
|
|
436
|
+
children: [
|
|
437
|
+
/* @__PURE__ */ e.jsx(
|
|
438
|
+
B,
|
|
439
|
+
{
|
|
440
|
+
columns: L,
|
|
441
|
+
dataSource: t,
|
|
442
|
+
rowKey: "id",
|
|
443
|
+
loading: c
|
|
444
|
+
}
|
|
445
|
+
),
|
|
446
|
+
/* @__PURE__ */ e.jsx(
|
|
447
|
+
$,
|
|
448
|
+
{
|
|
449
|
+
title: "新建项目",
|
|
450
|
+
open: n,
|
|
451
|
+
onOk: f,
|
|
452
|
+
onCancel: () => {
|
|
453
|
+
r(!1), m.resetFields();
|
|
454
|
+
},
|
|
455
|
+
okText: "创建",
|
|
456
|
+
cancelText: "取消",
|
|
457
|
+
children: /* @__PURE__ */ e.jsxs(o, { form: m, layout: "vertical", children: [
|
|
458
|
+
/* @__PURE__ */ e.jsx(o.Item, { name: "name", label: "项目名称", rules: [{ required: !0, message: "请输入项目名称" }], children: /* @__PURE__ */ e.jsx(g, { placeholder: "请输入项目名称" }) }),
|
|
459
|
+
/* @__PURE__ */ e.jsx(o.Item, { name: "description", label: "项目描述", children: /* @__PURE__ */ e.jsx(g.TextArea, { placeholder: "请输入项目描述", rows: 3 }) })
|
|
460
|
+
] })
|
|
461
|
+
}
|
|
462
|
+
)
|
|
463
|
+
]
|
|
464
|
+
}
|
|
465
|
+
);
|
|
466
|
+
}
|
|
467
|
+
function ye() {
|
|
468
|
+
const [t, l] = h([]), [c, d] = h(!1);
|
|
469
|
+
w(() => {
|
|
470
|
+
l([]);
|
|
471
|
+
}, []);
|
|
472
|
+
const n = [
|
|
473
|
+
{
|
|
474
|
+
title: "ID",
|
|
475
|
+
dataIndex: "id",
|
|
476
|
+
key: "id",
|
|
477
|
+
width: 80
|
|
478
|
+
},
|
|
479
|
+
{
|
|
480
|
+
title: "用户名",
|
|
481
|
+
dataIndex: "username",
|
|
482
|
+
key: "username"
|
|
483
|
+
},
|
|
484
|
+
{
|
|
485
|
+
title: "昵称",
|
|
486
|
+
dataIndex: "nickname",
|
|
487
|
+
key: "nickname",
|
|
488
|
+
render: (r) => r || "-"
|
|
489
|
+
},
|
|
490
|
+
{
|
|
491
|
+
title: "邮箱",
|
|
492
|
+
dataIndex: "email",
|
|
493
|
+
key: "email"
|
|
494
|
+
},
|
|
495
|
+
{
|
|
496
|
+
title: "状态",
|
|
497
|
+
dataIndex: "status",
|
|
498
|
+
key: "status",
|
|
499
|
+
render: (r) => /* @__PURE__ */ e.jsx(C, { color: r === 1 ? "green" : "red", children: r === 1 ? "启用" : "禁用" })
|
|
500
|
+
},
|
|
501
|
+
{
|
|
502
|
+
title: "来源",
|
|
503
|
+
dataIndex: "source",
|
|
504
|
+
key: "source",
|
|
505
|
+
render: (r) => r || "-"
|
|
506
|
+
},
|
|
507
|
+
{
|
|
508
|
+
title: "创建时间",
|
|
509
|
+
dataIndex: "createdAt",
|
|
510
|
+
key: "createdAt"
|
|
511
|
+
}
|
|
512
|
+
];
|
|
513
|
+
return /* @__PURE__ */ e.jsx(x, { title: "用户管理", children: /* @__PURE__ */ e.jsx(
|
|
514
|
+
B,
|
|
515
|
+
{
|
|
516
|
+
columns: n,
|
|
517
|
+
dataSource: t,
|
|
518
|
+
rowKey: "id",
|
|
519
|
+
loading: c,
|
|
520
|
+
locale: { emptyText: "暂无数据(用户由 z-ctc 统一管理)" }
|
|
521
|
+
}
|
|
522
|
+
) });
|
|
523
|
+
}
|
|
524
|
+
function ke() {
|
|
525
|
+
return /* @__PURE__ */ e.jsxs(V, { children: [
|
|
526
|
+
/* @__PURE__ */ e.jsx(b, { index: !0, element: /* @__PURE__ */ e.jsx(W, { to: "task", replace: !0 }) }),
|
|
527
|
+
/* @__PURE__ */ e.jsx(b, { path: "dashboard", element: /* @__PURE__ */ e.jsx(ce, {}) }),
|
|
528
|
+
/* @__PURE__ */ e.jsx(b, { path: "task", element: /* @__PURE__ */ e.jsx(he, {}) }),
|
|
529
|
+
/* @__PURE__ */ e.jsx(b, { path: "task/edit/:id?", element: /* @__PURE__ */ e.jsx(pe, {}) }),
|
|
530
|
+
/* @__PURE__ */ e.jsx(b, { path: "project", element: /* @__PURE__ */ e.jsx(fe, {}) }),
|
|
531
|
+
/* @__PURE__ */ e.jsx(b, { path: "user", element: /* @__PURE__ */ e.jsx(ye, {}) })
|
|
532
|
+
] });
|
|
533
|
+
}
|
|
534
|
+
function Oe() {
|
|
535
|
+
const t = O(), l = async (c) => {
|
|
536
|
+
var d, n, r, m;
|
|
537
|
+
try {
|
|
538
|
+
const s = await p.post("/auth/login", c), f = ((d = s == null ? void 0 : s.data) == null ? void 0 : d.token) ?? (s == null ? void 0 : s.token), I = ((n = s == null ? void 0 : s.data) == null ? void 0 : n.userId) ?? (s == null ? void 0 : s.userId);
|
|
539
|
+
if (f && localStorage.setItem("token", f), I != null && localStorage.setItem("userId", String(I)), !f) {
|
|
540
|
+
u.error("登录响应缺少 token");
|
|
541
|
+
return;
|
|
542
|
+
}
|
|
543
|
+
u.success("登录成功"), t("/");
|
|
544
|
+
} catch (s) {
|
|
545
|
+
u.error("登录失败:" + (((m = (r = s.response) == null ? void 0 : r.data) == null ? void 0 : m.message) || s.message));
|
|
546
|
+
}
|
|
547
|
+
};
|
|
548
|
+
return /* @__PURE__ */ e.jsx("div", { className: "login-container", children: /* @__PURE__ */ e.jsx(x, { title: "欢迎登录 Z-Task", className: "login-card", children: /* @__PURE__ */ e.jsxs(
|
|
549
|
+
o,
|
|
550
|
+
{
|
|
551
|
+
name: "login",
|
|
552
|
+
initialValues: { remember: !0 },
|
|
553
|
+
onFinish: l,
|
|
554
|
+
autoComplete: "off",
|
|
555
|
+
children: [
|
|
556
|
+
/* @__PURE__ */ e.jsx(
|
|
557
|
+
o.Item,
|
|
558
|
+
{
|
|
559
|
+
name: "username",
|
|
560
|
+
rules: [{ required: !0, message: "请输入用户名!" }],
|
|
561
|
+
children: /* @__PURE__ */ e.jsx(g, { prefix: /* @__PURE__ */ e.jsx(U, {}), placeholder: "用户名", size: "large" })
|
|
562
|
+
}
|
|
563
|
+
),
|
|
564
|
+
/* @__PURE__ */ e.jsx(
|
|
565
|
+
o.Item,
|
|
566
|
+
{
|
|
567
|
+
name: "password",
|
|
568
|
+
rules: [{ required: !0, message: "请输入密码!" }],
|
|
569
|
+
children: /* @__PURE__ */ e.jsx(
|
|
570
|
+
g.Password,
|
|
571
|
+
{
|
|
572
|
+
prefix: /* @__PURE__ */ e.jsx(M, {}),
|
|
573
|
+
placeholder: "密码",
|
|
574
|
+
size: "large"
|
|
575
|
+
}
|
|
576
|
+
)
|
|
577
|
+
}
|
|
578
|
+
),
|
|
579
|
+
/* @__PURE__ */ e.jsx(o.Item, { children: /* @__PURE__ */ e.jsx(j, { type: "primary", htmlType: "submit", size: "large", block: !0, children: "登录" }) })
|
|
580
|
+
]
|
|
581
|
+
}
|
|
582
|
+
) }) });
|
|
583
|
+
}
|
|
584
|
+
const v = { username: "admin", password: "123456", user: { name: "admin", role: "管理员" } };
|
|
585
|
+
function Le() {
|
|
586
|
+
const [t, l] = h(!1), c = async (d) => {
|
|
587
|
+
l(!0);
|
|
588
|
+
try {
|
|
589
|
+
d.username === v.username && d.password === v.password ? (localStorage.setItem("token", "mock-" + v.username), localStorage.setItem("userInfo", JSON.stringify(v.user)), u.success("登录成功(mock 模式,待 CTC/SSO 接入)"), window.location.href = "/z-task/home") : u.error("用户名或密码错误(默认 admin/123456)");
|
|
590
|
+
} finally {
|
|
591
|
+
l(!1);
|
|
592
|
+
}
|
|
593
|
+
};
|
|
594
|
+
return /* @__PURE__ */ e.jsx("div", { style: {
|
|
595
|
+
height: "100vh",
|
|
596
|
+
display: "flex",
|
|
597
|
+
justifyContent: "center",
|
|
598
|
+
alignItems: "center",
|
|
599
|
+
background: "linear-gradient(135deg, #eef2ff 0%, #f5f3ff 50%, #eff6ff 100%)"
|
|
600
|
+
}, children: /* @__PURE__ */ e.jsxs(x, { style: { width: 400, boxShadow: "0 10px 40px rgba(124,58,237,0.12)" }, children: [
|
|
601
|
+
/* @__PURE__ */ e.jsxs("div", { style: { textAlign: "center", marginBottom: 20 }, children: [
|
|
602
|
+
/* @__PURE__ */ e.jsx("div", { style: {
|
|
603
|
+
width: 48,
|
|
604
|
+
height: 48,
|
|
605
|
+
borderRadius: 12,
|
|
606
|
+
margin: "0 auto 12px",
|
|
607
|
+
background: "linear-gradient(135deg, #7c3aed, #6d28d9)",
|
|
608
|
+
display: "flex",
|
|
609
|
+
alignItems: "center",
|
|
610
|
+
justifyContent: "center",
|
|
611
|
+
color: "#fff",
|
|
612
|
+
fontSize: 24,
|
|
613
|
+
fontWeight: 700
|
|
614
|
+
}, children: "z" }),
|
|
615
|
+
/* @__PURE__ */ e.jsx("div", { style: { fontSize: 18, fontWeight: 600, color: "#0f172a" }, children: "z-task 管理台" })
|
|
616
|
+
] }),
|
|
617
|
+
/* @__PURE__ */ e.jsxs(o, { onFinish: c, size: "large", children: [
|
|
618
|
+
/* @__PURE__ */ e.jsx(o.Item, { name: "username", rules: [{ required: !0, message: "请输入用户名" }], children: /* @__PURE__ */ e.jsx(g, { prefix: /* @__PURE__ */ e.jsx(U, {}), placeholder: "用户名" }) }),
|
|
619
|
+
/* @__PURE__ */ e.jsx(o.Item, { name: "password", rules: [{ required: !0, message: "请输入密码" }], children: /* @__PURE__ */ e.jsx(g.Password, { prefix: /* @__PURE__ */ e.jsx(M, {}), placeholder: "密码" }) }),
|
|
620
|
+
/* @__PURE__ */ e.jsx(o.Item, { style: { marginBottom: 8 }, children: /* @__PURE__ */ e.jsx(
|
|
621
|
+
j,
|
|
622
|
+
{
|
|
623
|
+
type: "primary",
|
|
624
|
+
htmlType: "submit",
|
|
625
|
+
loading: t,
|
|
626
|
+
block: !0,
|
|
627
|
+
style: { background: "linear-gradient(135deg, #7c3aed 0%, #6d28d9 100%)", border: "none" },
|
|
628
|
+
children: "登 录"
|
|
629
|
+
}
|
|
630
|
+
) }),
|
|
631
|
+
/* @__PURE__ */ e.jsxs("div", { style: { textAlign: "center", color: "#94a3b8", fontSize: 12 }, children: [
|
|
632
|
+
"Mock 模式:用户名 ",
|
|
633
|
+
/* @__PURE__ */ e.jsx("b", { children: v.username }),
|
|
634
|
+
" / 密码 ",
|
|
635
|
+
/* @__PURE__ */ e.jsx("b", { children: v.password })
|
|
636
|
+
] })
|
|
637
|
+
] })
|
|
638
|
+
] }) });
|
|
639
|
+
}
|
|
640
|
+
const Ae = [
|
|
641
|
+
{ path: "/z-task/home", Component: te },
|
|
642
|
+
{ path: "/z-task/dashboard", Component: null },
|
|
643
|
+
{ path: "/z-task/task", Component: null },
|
|
644
|
+
{ path: "/z-task/task/edit/:id?", Component: null },
|
|
645
|
+
{ path: "/z-task/project", Component: null },
|
|
646
|
+
{ path: "/z-task/user", Component: null },
|
|
647
|
+
{ path: "/z-task/:rest*", Component: ke }
|
|
648
|
+
], Pe = () => !!localStorage.getItem("token");
|
|
649
|
+
export {
|
|
650
|
+
ce as Dashboard,
|
|
651
|
+
te as HomePage,
|
|
652
|
+
Oe as Login,
|
|
653
|
+
Le as LoginPage,
|
|
654
|
+
fe as ProjectList,
|
|
655
|
+
pe as TaskEdit,
|
|
656
|
+
he as TaskList,
|
|
657
|
+
ye as UserList,
|
|
658
|
+
Ce as appMeta,
|
|
659
|
+
Te as configureTask,
|
|
660
|
+
Pe as isAuthenticated,
|
|
661
|
+
Q as menuItems,
|
|
662
|
+
Ae as routes
|
|
663
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.login-container{width:100%;height:100%;display:flex;align-items:center;justify-content:center;background:linear-gradient(135deg,#667eea,#764ba2)}.login-card{width:400px;box-shadow:0 10px 40px #00000026}.login-card .ant-card-head{text-align:center;font-size:20px;font-weight:700}
|