@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/index.js
ADDED
|
@@ -0,0 +1,1120 @@
|
|
|
1
|
+
import { j as e } from "./jsx-runtime-z6PQ6F3d.js";
|
|
2
|
+
import { Card as B, Space as T, Tag as z, Button as b, Table as ee, Select as R, Form as y, Empty as Z, Spin as xe, Descriptions as w, List as q, Drawer as ue, Input as F, message as I, Popconfirm as je, Breadcrumb as Te, Typography as he, Modal as pe, DatePicker as we, Row as le, Col as H, Statistic as G, Progress as ze } from "antd";
|
|
3
|
+
import { CheckCircleOutlined as J, EditOutlined as Q, DeleteOutlined as te, PlusOutlined as me, InboxOutlined as fe, CheckOutlined as se, UnorderedListOutlined as Pe, ExclamationCircleOutlined as Se, ReloadOutlined as ye, EyeOutlined as De, ProjectOutlined as Ce, ClockCircleOutlined as ge, RocketOutlined as be } from "@ant-design/icons";
|
|
4
|
+
import { useState as p, useEffect as W } from "react";
|
|
5
|
+
import { createRequest as Oe, authRequest as Be } from "@yuku123/z-frontend-common";
|
|
6
|
+
import { useNavigate as Re, Routes as Me, Route as V, Navigate as Ae } from "react-router-dom";
|
|
7
|
+
const Le = {
|
|
8
|
+
high: { color: "red", text: "高" },
|
|
9
|
+
medium: { color: "orange", text: "中" },
|
|
10
|
+
low: { color: "green", text: "低" }
|
|
11
|
+
}, Fe = {
|
|
12
|
+
pending: { color: "default", text: "待处理" },
|
|
13
|
+
in_progress: { color: "blue", text: "进行中" },
|
|
14
|
+
completed: { color: "green", text: "已完成" }
|
|
15
|
+
};
|
|
16
|
+
function Ze({ task: t, onEdit: l, onComplete: i }) {
|
|
17
|
+
const n = Le[t.priority] || { color: "default", text: t.priority }, c = Fe[t.status] || { color: "default", text: t.status };
|
|
18
|
+
return /* @__PURE__ */ e.jsx(B, { size: "small", title: t.title, extra: /* @__PURE__ */ e.jsxs(T, { children: [
|
|
19
|
+
t.status !== "completed" && /* @__PURE__ */ e.jsx(b, { size: "small", icon: /* @__PURE__ */ e.jsx(J, {}), onClick: () => i == null ? void 0 : i(t), children: "完成" }),
|
|
20
|
+
/* @__PURE__ */ e.jsx(b, { size: "small", icon: /* @__PURE__ */ e.jsx(Q, {}), onClick: () => l == null ? void 0 : l(t), children: "编辑" })
|
|
21
|
+
] }), children: /* @__PURE__ */ e.jsxs(T, { orientation: "vertical", style: { width: "100%" }, children: [
|
|
22
|
+
/* @__PURE__ */ e.jsxs("div", { children: [
|
|
23
|
+
"项目:",
|
|
24
|
+
t.projectName
|
|
25
|
+
] }),
|
|
26
|
+
/* @__PURE__ */ e.jsxs(T, { children: [
|
|
27
|
+
/* @__PURE__ */ e.jsx(z, { color: n.color, children: n.text }),
|
|
28
|
+
/* @__PURE__ */ e.jsx(z, { color: c.color, children: c.text })
|
|
29
|
+
] }),
|
|
30
|
+
t.dueDate && /* @__PURE__ */ e.jsxs("div", { children: [
|
|
31
|
+
"截止:",
|
|
32
|
+
t.dueDate
|
|
33
|
+
] })
|
|
34
|
+
] }) });
|
|
35
|
+
}
|
|
36
|
+
const We = { high: "red", medium: "orange", low: "green" }, $e = {
|
|
37
|
+
pending: "default",
|
|
38
|
+
in_progress: "blue",
|
|
39
|
+
completed: "green"
|
|
40
|
+
};
|
|
41
|
+
function et({ dataSource: t, loading: l, onEdit: i, onDelete: n, onComplete: c }) {
|
|
42
|
+
const r = [
|
|
43
|
+
{ title: "任务名称", dataIndex: "title", key: "title" },
|
|
44
|
+
{ title: "项目", dataIndex: "projectName", key: "projectName" },
|
|
45
|
+
{
|
|
46
|
+
title: "优先级",
|
|
47
|
+
dataIndex: "priority",
|
|
48
|
+
key: "priority",
|
|
49
|
+
render: (u) => /* @__PURE__ */ e.jsx(z, { color: We[u], children: u === "high" ? "高" : u === "medium" ? "中" : "低" })
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
title: "状态",
|
|
53
|
+
dataIndex: "status",
|
|
54
|
+
key: "status",
|
|
55
|
+
render: (u) => {
|
|
56
|
+
const o = { pending: "待处理", in_progress: "进行中", completed: "已完成" };
|
|
57
|
+
return /* @__PURE__ */ e.jsx(z, { color: $e[u], children: o[u] || u });
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
{ title: "截止日期", dataIndex: "dueDate", key: "dueDate" },
|
|
61
|
+
{
|
|
62
|
+
title: "操作",
|
|
63
|
+
key: "action",
|
|
64
|
+
render: (u, o) => /* @__PURE__ */ e.jsxs(T, { children: [
|
|
65
|
+
o.status !== "completed" && /* @__PURE__ */ e.jsx(b, { size: "small", icon: /* @__PURE__ */ e.jsx(J, {}), onClick: () => c == null ? void 0 : c(o), children: "完成" }),
|
|
66
|
+
/* @__PURE__ */ e.jsx(b, { size: "small", icon: /* @__PURE__ */ e.jsx(Q, {}), onClick: () => i == null ? void 0 : i(o), children: "编辑" }),
|
|
67
|
+
/* @__PURE__ */ e.jsx(b, { size: "small", danger: !0, icon: /* @__PURE__ */ e.jsx(te, {}), onClick: () => n == null ? void 0 : n(o), children: "删除" })
|
|
68
|
+
] })
|
|
69
|
+
}
|
|
70
|
+
];
|
|
71
|
+
return /* @__PURE__ */ e.jsx(
|
|
72
|
+
ee,
|
|
73
|
+
{
|
|
74
|
+
columns: r,
|
|
75
|
+
dataSource: t,
|
|
76
|
+
loading: l,
|
|
77
|
+
rowKey: "id",
|
|
78
|
+
pagination: { pageSize: 10 }
|
|
79
|
+
}
|
|
80
|
+
);
|
|
81
|
+
}
|
|
82
|
+
function tt({ value: t, onChange: l, projects: i = [] }) {
|
|
83
|
+
return /* @__PURE__ */ e.jsx(
|
|
84
|
+
R,
|
|
85
|
+
{
|
|
86
|
+
value: t,
|
|
87
|
+
onChange: l,
|
|
88
|
+
placeholder: "请选择项目",
|
|
89
|
+
style: { width: 200 },
|
|
90
|
+
allowClear: !0,
|
|
91
|
+
children: i.map((n) => /* @__PURE__ */ e.jsx(R.Option, { value: n.id, children: n.name }, n.id))
|
|
92
|
+
}
|
|
93
|
+
);
|
|
94
|
+
}
|
|
95
|
+
const O = Oe("task"), v = {
|
|
96
|
+
// === 项目 ===
|
|
97
|
+
listMyProjects: () => Be.get("/project/user/list"),
|
|
98
|
+
createProject: (t) => O.post("/project", t),
|
|
99
|
+
updateProject: (t, l) => O.put(`/project/${t}`, l),
|
|
100
|
+
archiveProject: (t) => O.put(`/project/${t}/archive`),
|
|
101
|
+
// === 任务 ===
|
|
102
|
+
listTasksByProject: (t) => O.get("/task/project/list", { params: { projectId: t } }),
|
|
103
|
+
listTasksByList: (t) => O.get("/task/list", { params: { listId: t } }),
|
|
104
|
+
createTask: (t) => O.post("/task", t),
|
|
105
|
+
completeTask: (t) => O.post("/task/complete", null, { params: { taskId: t } }),
|
|
106
|
+
moveTask: (t, l, i) => O.put("/task/move", null, { params: { taskId: t, targetListId: l, position: i } }),
|
|
107
|
+
// === 任务详情 ===
|
|
108
|
+
getTaskDetail: (t) => O.get(`/task/${t}`),
|
|
109
|
+
updateTask: (t, l) => O.put(`/task/${t}`, l),
|
|
110
|
+
deleteTask: (t) => O.delete(`/task/${t}`)
|
|
111
|
+
}, X = (t) => {
|
|
112
|
+
if (!t) return "-";
|
|
113
|
+
const l = String(t), i = l.match(/^(\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2})/);
|
|
114
|
+
return i ? i[1] : l;
|
|
115
|
+
};
|
|
116
|
+
function re({ apiBaseURL: t }) {
|
|
117
|
+
const [l, i] = p([]), [n, c] = p(!1), [r, u] = p(!1), [o, a] = p(null), [d, k] = p(null), [P, S] = p([]), [g, L] = p(!1), [C] = y.useForm(), j = async () => {
|
|
118
|
+
c(!0);
|
|
119
|
+
try {
|
|
120
|
+
const s = await v.listMyProjects();
|
|
121
|
+
i((s == null ? void 0 : s.data) || s || []);
|
|
122
|
+
} catch (s) {
|
|
123
|
+
I.error("加载项目失败: " + ((s == null ? void 0 : s.message) || s));
|
|
124
|
+
} finally {
|
|
125
|
+
c(!1);
|
|
126
|
+
}
|
|
127
|
+
};
|
|
128
|
+
W(() => {
|
|
129
|
+
j();
|
|
130
|
+
}, []);
|
|
131
|
+
const m = async (s) => {
|
|
132
|
+
k(s), L(!0);
|
|
133
|
+
try {
|
|
134
|
+
const h = await v.listTasksByProject(s.id);
|
|
135
|
+
S((h == null ? void 0 : h.data) || h || []);
|
|
136
|
+
} catch (h) {
|
|
137
|
+
I.error("加载任务失败: " + ((h == null ? void 0 : h.message) || h));
|
|
138
|
+
} finally {
|
|
139
|
+
L(!1);
|
|
140
|
+
}
|
|
141
|
+
}, D = async () => {
|
|
142
|
+
if (d)
|
|
143
|
+
try {
|
|
144
|
+
const s = await v.listTasksByProject(d.id);
|
|
145
|
+
S((s == null ? void 0 : s.data) || s || []);
|
|
146
|
+
} catch (s) {
|
|
147
|
+
I.error("刷新任务失败: " + ((s == null ? void 0 : s.message) || s));
|
|
148
|
+
}
|
|
149
|
+
}, M = () => {
|
|
150
|
+
a(null), C.resetFields(), C.setFieldsValue({ status: 1 }), u(!0);
|
|
151
|
+
}, $ = (s) => {
|
|
152
|
+
a(s), C.setFieldsValue({ name: s.name, description: s.description, status: s.status ?? 1 }), u(!0);
|
|
153
|
+
}, E = async () => {
|
|
154
|
+
try {
|
|
155
|
+
const s = await C.validateFields();
|
|
156
|
+
o ? (await v.updateProject(o.id, s), I.success("项目已更新")) : (await v.createProject(s), I.success("项目已创建")), u(!1), j();
|
|
157
|
+
} catch (s) {
|
|
158
|
+
if (s != null && s.errorFields) return;
|
|
159
|
+
I.error("保存失败: " + ((s == null ? void 0 : s.message) || s));
|
|
160
|
+
}
|
|
161
|
+
}, _ = async (s) => {
|
|
162
|
+
try {
|
|
163
|
+
await v.archiveProject(s), I.success("项目已归档"), j(), (d == null ? void 0 : d.id) === s && (k(null), S([]));
|
|
164
|
+
} catch (h) {
|
|
165
|
+
I.error("归档失败: " + ((h == null ? void 0 : h.message) || h));
|
|
166
|
+
}
|
|
167
|
+
}, N = async (s) => {
|
|
168
|
+
try {
|
|
169
|
+
await v.completeTask(s), I.success("任务已完成"), D();
|
|
170
|
+
} catch (h) {
|
|
171
|
+
I.error("操作失败: " + ((h == null ? void 0 : h.message) || h));
|
|
172
|
+
}
|
|
173
|
+
}, A = [
|
|
174
|
+
{
|
|
175
|
+
title: "项目名称",
|
|
176
|
+
dataIndex: "name",
|
|
177
|
+
render: (s, h) => /* @__PURE__ */ e.jsx(
|
|
178
|
+
"a",
|
|
179
|
+
{
|
|
180
|
+
onClick: () => m(h),
|
|
181
|
+
style: { fontWeight: (d == null ? void 0 : d.id) === h.id ? 600 : 400 },
|
|
182
|
+
children: s
|
|
183
|
+
}
|
|
184
|
+
)
|
|
185
|
+
},
|
|
186
|
+
{
|
|
187
|
+
title: "状态",
|
|
188
|
+
dataIndex: "status",
|
|
189
|
+
width: 80,
|
|
190
|
+
render: (s) => s === 1 ? /* @__PURE__ */ e.jsx(z, { color: "green", children: "进行中" }) : /* @__PURE__ */ e.jsx(z, { children: "已归档" })
|
|
191
|
+
},
|
|
192
|
+
{ title: "创建时间", dataIndex: "createdAt", width: 170, render: X },
|
|
193
|
+
{
|
|
194
|
+
title: "操作",
|
|
195
|
+
width: 160,
|
|
196
|
+
fixed: "right",
|
|
197
|
+
render: (s, h) => /* @__PURE__ */ e.jsxs(T, { children: [
|
|
198
|
+
/* @__PURE__ */ e.jsx(b, { size: "small", icon: /* @__PURE__ */ e.jsx(Q, {}), onClick: () => $(h), children: "编辑" }),
|
|
199
|
+
/* @__PURE__ */ e.jsx(je, { title: "确定归档该项目?", onConfirm: () => _(h.id), children: /* @__PURE__ */ e.jsx(b, { size: "small", danger: !0, icon: /* @__PURE__ */ e.jsx(te, {}), children: "归档" }) })
|
|
200
|
+
] })
|
|
201
|
+
}
|
|
202
|
+
], U = (s) => {
|
|
203
|
+
const K = {
|
|
204
|
+
0: { text: "待办", color: "default" },
|
|
205
|
+
1: { text: "进行中", color: "blue" },
|
|
206
|
+
2: { text: "已完成", color: "green" }
|
|
207
|
+
}[s] || { text: String(s), color: "default" };
|
|
208
|
+
return /* @__PURE__ */ e.jsx(z, { color: K.color, children: K.text });
|
|
209
|
+
};
|
|
210
|
+
return /* @__PURE__ */ e.jsxs("div", { children: [
|
|
211
|
+
/* @__PURE__ */ e.jsx("div", { style: { display: "flex", justifyContent: "flex-end", marginBottom: 12 }, children: /* @__PURE__ */ e.jsx(b, { type: "primary", icon: /* @__PURE__ */ e.jsx(me, {}), onClick: M, children: "新建项目" }) }),
|
|
212
|
+
/* @__PURE__ */ e.jsxs("div", { style: { display: "flex", gap: 16, height: "calc(100vh - 220px)" }, children: [
|
|
213
|
+
/* @__PURE__ */ e.jsx(
|
|
214
|
+
B,
|
|
215
|
+
{
|
|
216
|
+
size: "small",
|
|
217
|
+
title: /* @__PURE__ */ e.jsxs(T, { children: [
|
|
218
|
+
/* @__PURE__ */ e.jsx(fe, {}),
|
|
219
|
+
"项目管理"
|
|
220
|
+
] }),
|
|
221
|
+
style: { width: 520, flexShrink: 0 },
|
|
222
|
+
styles: { body: { padding: 8, overflow: "auto", height: "calc(100% - 40px)" } },
|
|
223
|
+
children: /* @__PURE__ */ e.jsx(
|
|
224
|
+
ee,
|
|
225
|
+
{
|
|
226
|
+
rowKey: "id",
|
|
227
|
+
columns: A,
|
|
228
|
+
dataSource: l,
|
|
229
|
+
loading: n,
|
|
230
|
+
pagination: { pageSize: 10, size: "small" },
|
|
231
|
+
size: "small",
|
|
232
|
+
rowClassName: (s) => (d == null ? void 0 : d.id) === s.id ? "ant-table-row-selected" : "",
|
|
233
|
+
onRow: (s) => ({ onClick: () => m(s), style: { cursor: "pointer" } }),
|
|
234
|
+
locale: { emptyText: "暂无项目" }
|
|
235
|
+
}
|
|
236
|
+
)
|
|
237
|
+
}
|
|
238
|
+
),
|
|
239
|
+
/* @__PURE__ */ e.jsx(
|
|
240
|
+
B,
|
|
241
|
+
{
|
|
242
|
+
size: "small",
|
|
243
|
+
style: { flex: 1, overflow: "auto" },
|
|
244
|
+
styles: { body: { padding: 16 } },
|
|
245
|
+
title: d ? /* @__PURE__ */ e.jsxs(T, { children: [
|
|
246
|
+
/* @__PURE__ */ e.jsx(Pe, {}),
|
|
247
|
+
d.name,
|
|
248
|
+
" · 任务列表"
|
|
249
|
+
] }) : "项目详情",
|
|
250
|
+
children: d ? /* @__PURE__ */ e.jsxs(xe, { spinning: g, children: [
|
|
251
|
+
/* @__PURE__ */ e.jsxs(w, { size: "small", bordered: !0, column: 2, style: { marginBottom: 16 }, children: [
|
|
252
|
+
/* @__PURE__ */ e.jsx(w.Item, { label: "项目名称", span: 2, children: d.name }),
|
|
253
|
+
/* @__PURE__ */ e.jsx(w.Item, { label: "描述", span: 2, children: d.description || "无" }),
|
|
254
|
+
/* @__PURE__ */ e.jsx(w.Item, { label: "负责人", children: d.ownerId || "未指定" }),
|
|
255
|
+
/* @__PURE__ */ e.jsx(w.Item, { label: "状态", children: d.status === 1 ? /* @__PURE__ */ e.jsx(z, { color: "green", children: "进行中" }) : /* @__PURE__ */ e.jsx(z, { children: "已归档" }) }),
|
|
256
|
+
/* @__PURE__ */ e.jsx(
|
|
257
|
+
w.Item,
|
|
258
|
+
{
|
|
259
|
+
label: "创建时间",
|
|
260
|
+
children: X(d.createdAt)
|
|
261
|
+
}
|
|
262
|
+
),
|
|
263
|
+
/* @__PURE__ */ e.jsx(w.Item, { label: "项目ID", children: d.id })
|
|
264
|
+
] }),
|
|
265
|
+
/* @__PURE__ */ e.jsx(
|
|
266
|
+
q,
|
|
267
|
+
{
|
|
268
|
+
size: "small",
|
|
269
|
+
header: /* @__PURE__ */ e.jsxs("b", { children: [
|
|
270
|
+
"任务项 (",
|
|
271
|
+
P.length,
|
|
272
|
+
")"
|
|
273
|
+
] }),
|
|
274
|
+
bordered: !0,
|
|
275
|
+
dataSource: P,
|
|
276
|
+
locale: { emptyText: "该项目下暂无任务" },
|
|
277
|
+
renderItem: (s) => /* @__PURE__ */ e.jsx(
|
|
278
|
+
q.Item,
|
|
279
|
+
{
|
|
280
|
+
actions: [
|
|
281
|
+
/* @__PURE__ */ e.jsx(
|
|
282
|
+
b,
|
|
283
|
+
{
|
|
284
|
+
size: "small",
|
|
285
|
+
type: "primary",
|
|
286
|
+
icon: /* @__PURE__ */ e.jsx(se, {}),
|
|
287
|
+
disabled: s.status === 2,
|
|
288
|
+
onClick: () => N(s.id),
|
|
289
|
+
children: "完成"
|
|
290
|
+
},
|
|
291
|
+
"complete"
|
|
292
|
+
)
|
|
293
|
+
],
|
|
294
|
+
children: /* @__PURE__ */ e.jsx(
|
|
295
|
+
q.Item.Meta,
|
|
296
|
+
{
|
|
297
|
+
title: /* @__PURE__ */ e.jsxs(T, { children: [
|
|
298
|
+
s.title,
|
|
299
|
+
U(s.status),
|
|
300
|
+
/* @__PURE__ */ e.jsxs(z, { children: [
|
|
301
|
+
"优先级 ",
|
|
302
|
+
s.priority ?? "-"
|
|
303
|
+
] })
|
|
304
|
+
] }),
|
|
305
|
+
description: /* @__PURE__ */ e.jsxs("span", { style: { color: "#888", fontSize: 12 }, children: [
|
|
306
|
+
"截止: ",
|
|
307
|
+
X(s.dueDate),
|
|
308
|
+
" · ID: ",
|
|
309
|
+
s.id
|
|
310
|
+
] })
|
|
311
|
+
}
|
|
312
|
+
)
|
|
313
|
+
}
|
|
314
|
+
)
|
|
315
|
+
}
|
|
316
|
+
)
|
|
317
|
+
] }) : /* @__PURE__ */ e.jsx(Z, { description: "请从左侧选择一个项目", style: { marginTop: 80 } })
|
|
318
|
+
}
|
|
319
|
+
)
|
|
320
|
+
] }),
|
|
321
|
+
/* @__PURE__ */ e.jsx(
|
|
322
|
+
ue,
|
|
323
|
+
{
|
|
324
|
+
title: o ? `编辑项目 - ${o.name}` : "新建项目",
|
|
325
|
+
size: "large",
|
|
326
|
+
open: r,
|
|
327
|
+
onClose: () => u(!1),
|
|
328
|
+
destroyOnHidden: !0,
|
|
329
|
+
extra: /* @__PURE__ */ e.jsxs(T, { children: [
|
|
330
|
+
/* @__PURE__ */ e.jsx(b, { onClick: () => u(!1), children: "取消" }),
|
|
331
|
+
/* @__PURE__ */ e.jsx(b, { type: "primary", onClick: E, children: "保存" })
|
|
332
|
+
] }),
|
|
333
|
+
children: /* @__PURE__ */ e.jsxs(y, { form: C, layout: "vertical", preserve: !1, children: [
|
|
334
|
+
/* @__PURE__ */ e.jsx(y.Item, { name: "name", label: "项目名称", rules: [{ required: !0, message: "请输入项目名称" }], children: /* @__PURE__ */ e.jsx(F, { placeholder: "例如: 一人公司" }) }),
|
|
335
|
+
/* @__PURE__ */ e.jsx(y.Item, { name: "description", label: "项目描述", children: /* @__PURE__ */ e.jsx(F.TextArea, { rows: 3, placeholder: "可选" }) }),
|
|
336
|
+
/* @__PURE__ */ e.jsx(y.Item, { name: "status", label: "状态", initialValue: 1, children: /* @__PURE__ */ e.jsx(
|
|
337
|
+
R,
|
|
338
|
+
{
|
|
339
|
+
options: [
|
|
340
|
+
{ label: "进行中", value: 1 },
|
|
341
|
+
{ label: "已归档", value: 0 }
|
|
342
|
+
]
|
|
343
|
+
}
|
|
344
|
+
) })
|
|
345
|
+
] })
|
|
346
|
+
}
|
|
347
|
+
)
|
|
348
|
+
] });
|
|
349
|
+
}
|
|
350
|
+
const Y = {
|
|
351
|
+
// 卡片表面
|
|
352
|
+
surfaceAlt: "#fafbfc",
|
|
353
|
+
// 次级表面 (表格 hover 等)
|
|
354
|
+
border: "#e5e7eb",
|
|
355
|
+
text: "#111827",
|
|
356
|
+
// 主文本
|
|
357
|
+
textMuted: "#6b7280"
|
|
358
|
+
}, Ie = {
|
|
359
|
+
md: 12
|
|
360
|
+
};
|
|
361
|
+
function Ee({
|
|
362
|
+
icon: t,
|
|
363
|
+
title: l = "暂无数据",
|
|
364
|
+
description: i,
|
|
365
|
+
actionText: n,
|
|
366
|
+
onAction: c,
|
|
367
|
+
size: r = "md",
|
|
368
|
+
style: u
|
|
369
|
+
}) {
|
|
370
|
+
const o = { sm: 24, md: 40, lg: 64 }, a = { sm: 14, md: 16, lg: 20 };
|
|
371
|
+
return /* @__PURE__ */ e.jsxs(
|
|
372
|
+
"div",
|
|
373
|
+
{
|
|
374
|
+
role: "status",
|
|
375
|
+
"aria-live": "polite",
|
|
376
|
+
style: {
|
|
377
|
+
padding: o[r] || o.md,
|
|
378
|
+
textAlign: "center",
|
|
379
|
+
background: "#ffffff",
|
|
380
|
+
borderRadius: Ie.md,
|
|
381
|
+
border: "1px dashed #e5e7eb",
|
|
382
|
+
...u
|
|
383
|
+
},
|
|
384
|
+
children: [
|
|
385
|
+
/* @__PURE__ */ e.jsx("div", { style: {
|
|
386
|
+
display: "inline-flex",
|
|
387
|
+
alignItems: "center",
|
|
388
|
+
justifyContent: "center",
|
|
389
|
+
width: 56,
|
|
390
|
+
height: 56,
|
|
391
|
+
borderRadius: "50%",
|
|
392
|
+
background: Y.surfaceAlt,
|
|
393
|
+
marginBottom: 16,
|
|
394
|
+
fontSize: 28,
|
|
395
|
+
color: "#9ca3af"
|
|
396
|
+
}, children: t || /* @__PURE__ */ e.jsx(fe, {}) }),
|
|
397
|
+
/* @__PURE__ */ e.jsx("div", { style: {
|
|
398
|
+
fontSize: a[r],
|
|
399
|
+
fontWeight: 600,
|
|
400
|
+
color: Y.text,
|
|
401
|
+
marginBottom: i ? 6 : 16
|
|
402
|
+
}, children: l }),
|
|
403
|
+
i && /* @__PURE__ */ e.jsx("div", { style: {
|
|
404
|
+
fontSize: 13,
|
|
405
|
+
color: Y.textMuted,
|
|
406
|
+
lineHeight: 1.6,
|
|
407
|
+
maxWidth: 360,
|
|
408
|
+
margin: "0 auto 16px"
|
|
409
|
+
}, children: i }),
|
|
410
|
+
n && c && /* @__PURE__ */ e.jsx(
|
|
411
|
+
b,
|
|
412
|
+
{
|
|
413
|
+
type: "primary",
|
|
414
|
+
onClick: c,
|
|
415
|
+
style: {
|
|
416
|
+
background: "linear-gradient(135deg, #7c3aed 0%, #6d28d9 100%)",
|
|
417
|
+
border: "none",
|
|
418
|
+
minHeight: 36
|
|
419
|
+
},
|
|
420
|
+
children: n
|
|
421
|
+
}
|
|
422
|
+
)
|
|
423
|
+
]
|
|
424
|
+
}
|
|
425
|
+
);
|
|
426
|
+
}
|
|
427
|
+
function ie({
|
|
428
|
+
error: t,
|
|
429
|
+
title: l = "加载失败",
|
|
430
|
+
description: i,
|
|
431
|
+
onRetry: n,
|
|
432
|
+
retryText: c = "重新加载",
|
|
433
|
+
variant: r = "inline",
|
|
434
|
+
style: u
|
|
435
|
+
}) {
|
|
436
|
+
var o;
|
|
437
|
+
const a = r === "full", d = (o = t == null ? void 0 : t.response) == null ? void 0 : o.data, k = d && typeof d == "object" && (typeof d.message == "string" && d.message || typeof d.msg == "string" && d.msg) || null, P = k || (typeof t == "string" ? t : (t == null ? void 0 : t.message) || (t == null ? void 0 : t.msg) || (t ? String(t) : null)), S = i || (k ? `原因: ${k}` : P ? `原因: ${P}。请检查网络或稍后重试。` : "请检查网络或稍后重试。");
|
|
438
|
+
return /* @__PURE__ */ e.jsxs(
|
|
439
|
+
"div",
|
|
440
|
+
{
|
|
441
|
+
role: "alert",
|
|
442
|
+
"aria-live": "assertive",
|
|
443
|
+
style: {
|
|
444
|
+
padding: a ? "48px 24px" : "20px 24px",
|
|
445
|
+
background: a ? "#ffffff" : "#fef2f2",
|
|
446
|
+
border: a ? `1px dashed ${Y.border}` : "1px solid #fecaca",
|
|
447
|
+
borderRadius: Ie.md,
|
|
448
|
+
textAlign: a ? "center" : "left",
|
|
449
|
+
display: "flex",
|
|
450
|
+
flexDirection: a ? "column" : "row",
|
|
451
|
+
alignItems: a ? "center" : "flex-start",
|
|
452
|
+
gap: a ? 12 : 16,
|
|
453
|
+
...u
|
|
454
|
+
},
|
|
455
|
+
children: [
|
|
456
|
+
/* @__PURE__ */ e.jsx("div", { style: {
|
|
457
|
+
display: "inline-flex",
|
|
458
|
+
alignItems: "center",
|
|
459
|
+
justifyContent: "center",
|
|
460
|
+
width: a ? 56 : 36,
|
|
461
|
+
height: a ? 56 : 36,
|
|
462
|
+
borderRadius: "50%",
|
|
463
|
+
background: a ? "#fef2f2" : "#ffffff",
|
|
464
|
+
color: "#dc2626",
|
|
465
|
+
fontSize: a ? 28 : 18,
|
|
466
|
+
flexShrink: 0
|
|
467
|
+
}, children: /* @__PURE__ */ e.jsx(Se, {}) }),
|
|
468
|
+
/* @__PURE__ */ e.jsxs("div", { style: { flex: 1, minWidth: 0 }, children: [
|
|
469
|
+
/* @__PURE__ */ e.jsx("div", { style: {
|
|
470
|
+
fontSize: a ? 16 : 14,
|
|
471
|
+
fontWeight: 600,
|
|
472
|
+
color: "#991b1b",
|
|
473
|
+
marginBottom: 4
|
|
474
|
+
}, children: l }),
|
|
475
|
+
/* @__PURE__ */ e.jsx("div", { style: {
|
|
476
|
+
fontSize: 13,
|
|
477
|
+
color: "#7f1d1d",
|
|
478
|
+
lineHeight: 1.6,
|
|
479
|
+
wordBreak: "break-word"
|
|
480
|
+
}, children: S }),
|
|
481
|
+
n && /* @__PURE__ */ e.jsx(
|
|
482
|
+
b,
|
|
483
|
+
{
|
|
484
|
+
type: "primary",
|
|
485
|
+
danger: !0,
|
|
486
|
+
icon: /* @__PURE__ */ e.jsx(ye, {}),
|
|
487
|
+
onClick: n,
|
|
488
|
+
size: a ? "middle" : "small",
|
|
489
|
+
style: { marginTop: 12 },
|
|
490
|
+
children: c
|
|
491
|
+
}
|
|
492
|
+
)
|
|
493
|
+
] })
|
|
494
|
+
]
|
|
495
|
+
}
|
|
496
|
+
);
|
|
497
|
+
}
|
|
498
|
+
function _e({
|
|
499
|
+
title: t,
|
|
500
|
+
subtitle: l,
|
|
501
|
+
breadcrumb: i,
|
|
502
|
+
extra: n,
|
|
503
|
+
back: c,
|
|
504
|
+
onBack: r
|
|
505
|
+
}) {
|
|
506
|
+
const u = Re();
|
|
507
|
+
return /* @__PURE__ */ e.jsx("div", { style: {
|
|
508
|
+
marginBottom: 12,
|
|
509
|
+
paddingBottom: 10,
|
|
510
|
+
borderBottom: "1px solid #f1f5f9"
|
|
511
|
+
}, children: /* @__PURE__ */ e.jsxs("div", { style: {
|
|
512
|
+
display: "flex",
|
|
513
|
+
alignItems: "center",
|
|
514
|
+
justifyContent: "space-between",
|
|
515
|
+
gap: 12,
|
|
516
|
+
flexWrap: "wrap"
|
|
517
|
+
}, children: [
|
|
518
|
+
/* @__PURE__ */ e.jsxs("div", { style: {
|
|
519
|
+
display: "flex",
|
|
520
|
+
alignItems: "center",
|
|
521
|
+
gap: 10,
|
|
522
|
+
minWidth: 0,
|
|
523
|
+
flexWrap: "wrap"
|
|
524
|
+
}, children: [
|
|
525
|
+
c && /* @__PURE__ */ e.jsx(
|
|
526
|
+
"button",
|
|
527
|
+
{
|
|
528
|
+
onClick: () => {
|
|
529
|
+
r ? r() : u(-1);
|
|
530
|
+
},
|
|
531
|
+
"aria-label": "返回上一页",
|
|
532
|
+
style: {
|
|
533
|
+
width: 28,
|
|
534
|
+
height: 28,
|
|
535
|
+
borderRadius: 6,
|
|
536
|
+
border: "1px solid #e5e7eb",
|
|
537
|
+
background: "#ffffff",
|
|
538
|
+
color: "#6b7280",
|
|
539
|
+
cursor: "pointer",
|
|
540
|
+
display: "inline-flex",
|
|
541
|
+
alignItems: "center",
|
|
542
|
+
justifyContent: "center",
|
|
543
|
+
fontSize: 13,
|
|
544
|
+
transition: "all 150ms ease",
|
|
545
|
+
flexShrink: 0
|
|
546
|
+
},
|
|
547
|
+
onMouseEnter: (o) => {
|
|
548
|
+
o.currentTarget.style.background = "#f8fafc", o.currentTarget.style.color = "#111827", o.currentTarget.style.borderColor = "#7c3aed";
|
|
549
|
+
},
|
|
550
|
+
onMouseLeave: (o) => {
|
|
551
|
+
o.currentTarget.style.background = "#ffffff", o.currentTarget.style.color = "#6b7280", o.currentTarget.style.borderColor = "#e5e7eb";
|
|
552
|
+
},
|
|
553
|
+
children: "←"
|
|
554
|
+
}
|
|
555
|
+
),
|
|
556
|
+
i && i.length > 0 ? /* @__PURE__ */ e.jsx(
|
|
557
|
+
Te,
|
|
558
|
+
{
|
|
559
|
+
items: i.map((o, a) => {
|
|
560
|
+
const d = a === i.length - 1;
|
|
561
|
+
return {
|
|
562
|
+
title: o.href && !d ? /* @__PURE__ */ e.jsx("a", { onClick: (k) => {
|
|
563
|
+
k.preventDefault(), u(o.href);
|
|
564
|
+
}, children: o.label }) : /* @__PURE__ */ e.jsx("span", { style: d ? {
|
|
565
|
+
fontWeight: 600,
|
|
566
|
+
color: "#111827"
|
|
567
|
+
} : void 0, children: o.label })
|
|
568
|
+
};
|
|
569
|
+
})
|
|
570
|
+
}
|
|
571
|
+
) : t && /* @__PURE__ */ e.jsx("span", { role: "heading", "aria-level": 1, style: {
|
|
572
|
+
fontSize: 15,
|
|
573
|
+
fontWeight: 600,
|
|
574
|
+
color: "#111827",
|
|
575
|
+
lineHeight: 1.4
|
|
576
|
+
}, children: t }),
|
|
577
|
+
l && /* @__PURE__ */ e.jsx("span", { title: l, style: {
|
|
578
|
+
fontSize: 12,
|
|
579
|
+
color: "#94a3b8",
|
|
580
|
+
lineHeight: 1.4,
|
|
581
|
+
whiteSpace: "nowrap",
|
|
582
|
+
overflow: "hidden",
|
|
583
|
+
textOverflow: "ellipsis",
|
|
584
|
+
maxWidth: 360
|
|
585
|
+
}, children: l })
|
|
586
|
+
] }),
|
|
587
|
+
n && /* @__PURE__ */ e.jsx("div", { style: {
|
|
588
|
+
display: "flex",
|
|
589
|
+
gap: 8,
|
|
590
|
+
flexShrink: 0
|
|
591
|
+
}, children: n })
|
|
592
|
+
] }) });
|
|
593
|
+
}
|
|
594
|
+
function Ve({ left: t, right: l, extra: i }) {
|
|
595
|
+
return /* @__PURE__ */ e.jsxs(
|
|
596
|
+
"div",
|
|
597
|
+
{
|
|
598
|
+
style: {
|
|
599
|
+
display: "flex",
|
|
600
|
+
alignItems: "center",
|
|
601
|
+
justifyContent: "space-between",
|
|
602
|
+
gap: 12,
|
|
603
|
+
marginBottom: 12,
|
|
604
|
+
flexWrap: "wrap"
|
|
605
|
+
},
|
|
606
|
+
children: [
|
|
607
|
+
/* @__PURE__ */ e.jsx(T, { size: 8, wrap: !0, children: t }),
|
|
608
|
+
/* @__PURE__ */ e.jsxs(T, { size: 8, wrap: !0, children: [
|
|
609
|
+
l,
|
|
610
|
+
i
|
|
611
|
+
] })
|
|
612
|
+
]
|
|
613
|
+
}
|
|
614
|
+
);
|
|
615
|
+
}
|
|
616
|
+
const { Paragraph: qe } = he, ae = {
|
|
617
|
+
0: { label: "待办", color: "default" },
|
|
618
|
+
1: { label: "进行中", color: "blue" },
|
|
619
|
+
2: { label: "已完成", color: "green" }
|
|
620
|
+
}, ne = {
|
|
621
|
+
1: { label: "低", color: "default" },
|
|
622
|
+
2: { label: "中", color: "orange" },
|
|
623
|
+
3: { label: "高", color: "red" }
|
|
624
|
+
};
|
|
625
|
+
function He({ taskId: t, open: l, onClose: i, onChanged: n, onEdit: c }) {
|
|
626
|
+
const [r, u] = p(null), [o, a] = p(!1);
|
|
627
|
+
W(() => {
|
|
628
|
+
!l || !t || (a(!0), v.getTaskDetail(t).then((g) => u((g == null ? void 0 : g.data) || g)).catch(() => u(null)).finally(() => a(!1)));
|
|
629
|
+
}, [l, t]);
|
|
630
|
+
const d = async () => {
|
|
631
|
+
try {
|
|
632
|
+
await v.completeTask(t), u((g) => ({ ...g, status: 2 })), n == null || n();
|
|
633
|
+
} catch {
|
|
634
|
+
}
|
|
635
|
+
}, k = async () => {
|
|
636
|
+
try {
|
|
637
|
+
await v.deleteTask(t), n == null || n(), i == null || i();
|
|
638
|
+
} catch {
|
|
639
|
+
}
|
|
640
|
+
}, P = ae[r == null ? void 0 : r.status] || ae[0], S = ne[r == null ? void 0 : r.priority] || ne[1];
|
|
641
|
+
return /* @__PURE__ */ e.jsx(
|
|
642
|
+
ue,
|
|
643
|
+
{
|
|
644
|
+
title: (r == null ? void 0 : r.title) || "任务详情",
|
|
645
|
+
size: "large",
|
|
646
|
+
open: l,
|
|
647
|
+
onClose: i,
|
|
648
|
+
loading: o,
|
|
649
|
+
footer: /* @__PURE__ */ e.jsxs("div", { style: { display: "flex", justifyContent: "space-between" }, children: [
|
|
650
|
+
/* @__PURE__ */ e.jsx(
|
|
651
|
+
je,
|
|
652
|
+
{
|
|
653
|
+
title: "确认删除此任务?",
|
|
654
|
+
onConfirm: k,
|
|
655
|
+
okText: "删除",
|
|
656
|
+
cancelText: "取消",
|
|
657
|
+
okButtonProps: { danger: !0 },
|
|
658
|
+
children: /* @__PURE__ */ e.jsx(b, { danger: !0, icon: /* @__PURE__ */ e.jsx(te, {}), children: "删除" })
|
|
659
|
+
}
|
|
660
|
+
),
|
|
661
|
+
/* @__PURE__ */ e.jsxs(T, { children: [
|
|
662
|
+
(r == null ? void 0 : r.status) !== 2 && /* @__PURE__ */ e.jsx(b, { type: "primary", icon: /* @__PURE__ */ e.jsx(se, {}), onClick: d, children: "完成任务" }),
|
|
663
|
+
/* @__PURE__ */ e.jsx(b, { icon: /* @__PURE__ */ e.jsx(Q, {}), onClick: () => c == null ? void 0 : c(r), children: "编辑" })
|
|
664
|
+
] })
|
|
665
|
+
] }),
|
|
666
|
+
children: r && /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
|
|
667
|
+
/* @__PURE__ */ e.jsxs(w, { column: 2, bordered: !0, size: "small", style: { marginBottom: 24 }, children: [
|
|
668
|
+
/* @__PURE__ */ e.jsx(w.Item, { label: "状态", children: /* @__PURE__ */ e.jsx(z, { color: P.color, children: P.label }) }),
|
|
669
|
+
/* @__PURE__ */ e.jsx(w.Item, { label: "优先级", children: /* @__PURE__ */ e.jsx(z, { color: S.color, children: S.label }) }),
|
|
670
|
+
/* @__PURE__ */ e.jsx(w.Item, { label: "项目 ID", children: r.projectId }),
|
|
671
|
+
/* @__PURE__ */ e.jsx(w.Item, { label: "列表 ID", children: r.listId }),
|
|
672
|
+
/* @__PURE__ */ e.jsx(w.Item, { label: "截止时间", span: 2, children: r.dueDate || "未设置" }),
|
|
673
|
+
/* @__PURE__ */ e.jsx(w.Item, { label: "创建时间", children: r.createdAt || "-" }),
|
|
674
|
+
/* @__PURE__ */ e.jsx(w.Item, { label: "更新时间", children: r.updatedAt || "-" })
|
|
675
|
+
] }),
|
|
676
|
+
r.description && /* @__PURE__ */ e.jsxs("div", { style: { marginBottom: 24 }, children: [
|
|
677
|
+
/* @__PURE__ */ e.jsx("div", { style: { fontWeight: 600, marginBottom: 8 }, children: "描述" }),
|
|
678
|
+
/* @__PURE__ */ e.jsx(qe, { style: { whiteSpace: "pre-wrap", color: "#595959" }, children: r.description })
|
|
679
|
+
] })
|
|
680
|
+
] })
|
|
681
|
+
}
|
|
682
|
+
);
|
|
683
|
+
}
|
|
684
|
+
function Ne({ open: t, task: l, projects: i, onClose: n, onSaved: c }) {
|
|
685
|
+
const [r] = y.useForm(), u = !!(l != null && l.id);
|
|
686
|
+
W(() => {
|
|
687
|
+
t && l ? r.setFieldsValue({
|
|
688
|
+
title: l.title,
|
|
689
|
+
description: l.description,
|
|
690
|
+
projectId: l.projectId,
|
|
691
|
+
listId: l.listId,
|
|
692
|
+
status: l.status,
|
|
693
|
+
priority: l.priority,
|
|
694
|
+
dueDate: l.dueDate
|
|
695
|
+
}) : t && r.resetFields();
|
|
696
|
+
}, [t, l, r]);
|
|
697
|
+
const o = async () => {
|
|
698
|
+
try {
|
|
699
|
+
const a = await r.validateFields();
|
|
700
|
+
u ? (await v.updateTask(l.id, a), I.success("任务已更新")) : (await v.createTask(a), I.success("任务已创建")), c == null || c(), n == null || n();
|
|
701
|
+
} catch (a) {
|
|
702
|
+
if (a != null && a.errorFields) return;
|
|
703
|
+
I.error("保存失败: " + ((a == null ? void 0 : a.message) || a));
|
|
704
|
+
}
|
|
705
|
+
};
|
|
706
|
+
return /* @__PURE__ */ e.jsx(
|
|
707
|
+
pe,
|
|
708
|
+
{
|
|
709
|
+
title: u ? "编辑任务" : "新建任务",
|
|
710
|
+
open: t,
|
|
711
|
+
onCancel: n,
|
|
712
|
+
onOk: o,
|
|
713
|
+
destroyOnHidden: !0,
|
|
714
|
+
size: "large",
|
|
715
|
+
children: /* @__PURE__ */ e.jsxs(y, { form: r, layout: "vertical", preserve: !1, children: [
|
|
716
|
+
/* @__PURE__ */ e.jsx(
|
|
717
|
+
y.Item,
|
|
718
|
+
{
|
|
719
|
+
name: "title",
|
|
720
|
+
label: "任务标题",
|
|
721
|
+
rules: [{ required: !0, message: "请输入任务标题" }],
|
|
722
|
+
children: /* @__PURE__ */ e.jsx(F, { placeholder: "例如: 实现 xx 功能" })
|
|
723
|
+
}
|
|
724
|
+
),
|
|
725
|
+
/* @__PURE__ */ e.jsx(y.Item, { name: "description", label: "描述", children: /* @__PURE__ */ e.jsx(F.TextArea, { rows: 3, placeholder: "任务描述 (可选)" }) }),
|
|
726
|
+
/* @__PURE__ */ e.jsxs("div", { style: { display: "flex", gap: 16 }, children: [
|
|
727
|
+
/* @__PURE__ */ e.jsx(
|
|
728
|
+
y.Item,
|
|
729
|
+
{
|
|
730
|
+
name: "projectId",
|
|
731
|
+
label: "所属项目",
|
|
732
|
+
rules: [{ required: !0 }],
|
|
733
|
+
style: { flex: 1 },
|
|
734
|
+
children: /* @__PURE__ */ e.jsx(
|
|
735
|
+
R,
|
|
736
|
+
{
|
|
737
|
+
options: i.map((a) => ({ label: a.name, value: a.id })),
|
|
738
|
+
placeholder: "选择项目"
|
|
739
|
+
}
|
|
740
|
+
)
|
|
741
|
+
}
|
|
742
|
+
),
|
|
743
|
+
/* @__PURE__ */ e.jsx(y.Item, { name: "listId", label: "列表 ID", style: { flex: 1 }, children: /* @__PURE__ */ e.jsx(F, { type: "number", placeholder: "默认 1" }) })
|
|
744
|
+
] }),
|
|
745
|
+
/* @__PURE__ */ e.jsxs("div", { style: { display: "flex", gap: 16 }, children: [
|
|
746
|
+
/* @__PURE__ */ e.jsx(y.Item, { name: "status", label: "状态", initialValue: 0, style: { flex: 1 }, children: /* @__PURE__ */ e.jsx(
|
|
747
|
+
R,
|
|
748
|
+
{
|
|
749
|
+
options: [
|
|
750
|
+
{ label: "待办", value: 0 },
|
|
751
|
+
{ label: "进行中", value: 1 },
|
|
752
|
+
{ label: "已完成", value: 2 }
|
|
753
|
+
]
|
|
754
|
+
}
|
|
755
|
+
) }),
|
|
756
|
+
/* @__PURE__ */ e.jsx(y.Item, { name: "priority", label: "优先级", initialValue: 1, style: { flex: 1 }, children: /* @__PURE__ */ e.jsx(
|
|
757
|
+
R,
|
|
758
|
+
{
|
|
759
|
+
options: [
|
|
760
|
+
{ label: "低", value: 1 },
|
|
761
|
+
{ label: "中", value: 2 },
|
|
762
|
+
{ label: "高", value: 3 }
|
|
763
|
+
]
|
|
764
|
+
}
|
|
765
|
+
) })
|
|
766
|
+
] }),
|
|
767
|
+
/* @__PURE__ */ e.jsx(y.Item, { name: "dueDate", label: "截止时间", children: /* @__PURE__ */ e.jsx(we, { style: { width: "100%" }, placeholder: "选择截止日期" }) })
|
|
768
|
+
] })
|
|
769
|
+
}
|
|
770
|
+
);
|
|
771
|
+
}
|
|
772
|
+
function oe({ apiBaseURL: t, back: l }) {
|
|
773
|
+
const [i, n] = p([]), [c, r] = p(null), [u, o] = p([]), [a, d] = p(!1), [k, P] = p(null), [S, g] = p(null), [L, C] = p(!1), [j, m] = p(!1), [D, M] = p(!1), [$, E] = p(null), [_] = y.useForm(), N = async () => {
|
|
774
|
+
try {
|
|
775
|
+
const x = await v.listMyProjects(), f = (x == null ? void 0 : x.data) || x || [];
|
|
776
|
+
n(f), g(null), f.length > 0 && !c && r(f[0].id);
|
|
777
|
+
} catch (x) {
|
|
778
|
+
g((x == null ? void 0 : x.message) || "加载项目失败");
|
|
779
|
+
}
|
|
780
|
+
}, A = async (x) => {
|
|
781
|
+
if (!x) {
|
|
782
|
+
o([]);
|
|
783
|
+
return;
|
|
784
|
+
}
|
|
785
|
+
d(!0), P(null);
|
|
786
|
+
try {
|
|
787
|
+
const f = await v.listTasksByProject(x);
|
|
788
|
+
o((f == null ? void 0 : f.data) || f || []);
|
|
789
|
+
} catch (f) {
|
|
790
|
+
P((f == null ? void 0 : f.message) || "加载任务失败");
|
|
791
|
+
} finally {
|
|
792
|
+
d(!1);
|
|
793
|
+
}
|
|
794
|
+
};
|
|
795
|
+
W(() => {
|
|
796
|
+
N();
|
|
797
|
+
}, []), W(() => {
|
|
798
|
+
A(c);
|
|
799
|
+
}, [c]);
|
|
800
|
+
const U = () => {
|
|
801
|
+
if (!c) {
|
|
802
|
+
I.warning("请先选择项目");
|
|
803
|
+
return;
|
|
804
|
+
}
|
|
805
|
+
_.resetFields(), _.setFieldsValue({ projectId: c, listId: 1, status: 1, priority: 1 }), C(!0);
|
|
806
|
+
}, s = async () => {
|
|
807
|
+
try {
|
|
808
|
+
const x = await _.validateFields();
|
|
809
|
+
await v.createTask(x), I.success("任务已创建"), C(!1), A(c);
|
|
810
|
+
} catch (x) {
|
|
811
|
+
if (x != null && x.errorFields) return;
|
|
812
|
+
I.error("创建失败: " + ((x == null ? void 0 : x.message) || x));
|
|
813
|
+
}
|
|
814
|
+
}, h = async (x) => {
|
|
815
|
+
try {
|
|
816
|
+
await v.completeTask(x), I.success("任务已完成"), A(c);
|
|
817
|
+
} catch (f) {
|
|
818
|
+
I.error("操作失败: " + ((f == null ? void 0 : f.message) || f));
|
|
819
|
+
}
|
|
820
|
+
}, K = [
|
|
821
|
+
{ title: "ID", dataIndex: "id", width: 60 },
|
|
822
|
+
{ title: "标题", dataIndex: "title" },
|
|
823
|
+
{ title: "项目ID", dataIndex: "projectId", width: 80 },
|
|
824
|
+
{
|
|
825
|
+
title: "状态",
|
|
826
|
+
dataIndex: "status",
|
|
827
|
+
width: 100,
|
|
828
|
+
render: (x) => {
|
|
829
|
+
const f = { 0: "待办", 1: "进行中", 2: "已完成" }, ke = { 0: "default", 1: "blue", 2: "green" }[x] || "default";
|
|
830
|
+
return /* @__PURE__ */ e.jsx(z, { color: ke, children: f[x] || x });
|
|
831
|
+
}
|
|
832
|
+
},
|
|
833
|
+
{ title: "优先级", dataIndex: "priority", width: 80 },
|
|
834
|
+
{ title: "截止时间", dataIndex: "dueDate", width: 180 },
|
|
835
|
+
{
|
|
836
|
+
title: "操作",
|
|
837
|
+
width: 200,
|
|
838
|
+
fixed: "right",
|
|
839
|
+
render: (x, f) => /* @__PURE__ */ e.jsxs(T, { children: [
|
|
840
|
+
/* @__PURE__ */ e.jsx(
|
|
841
|
+
b,
|
|
842
|
+
{
|
|
843
|
+
size: "small",
|
|
844
|
+
icon: /* @__PURE__ */ e.jsx(De, {}),
|
|
845
|
+
onClick: () => {
|
|
846
|
+
E(f), m(!0);
|
|
847
|
+
},
|
|
848
|
+
children: "查看"
|
|
849
|
+
}
|
|
850
|
+
),
|
|
851
|
+
/* @__PURE__ */ e.jsx(
|
|
852
|
+
b,
|
|
853
|
+
{
|
|
854
|
+
size: "small",
|
|
855
|
+
type: "primary",
|
|
856
|
+
icon: /* @__PURE__ */ e.jsx(se, {}),
|
|
857
|
+
onClick: () => h(f.id),
|
|
858
|
+
disabled: f.status === 2,
|
|
859
|
+
children: "完成"
|
|
860
|
+
}
|
|
861
|
+
)
|
|
862
|
+
] })
|
|
863
|
+
}
|
|
864
|
+
], ve = !a && !k && u.length === 0 && c;
|
|
865
|
+
return /* @__PURE__ */ e.jsxs("div", { children: [
|
|
866
|
+
/* @__PURE__ */ e.jsx(
|
|
867
|
+
_e,
|
|
868
|
+
{
|
|
869
|
+
title: "任务管理",
|
|
870
|
+
subtitle: "按项目维度组织任务, 支持新建、完成等操作",
|
|
871
|
+
breadcrumb: [{ label: "任务中心" }, { label: "任务列表" }],
|
|
872
|
+
back: !!l
|
|
873
|
+
}
|
|
874
|
+
),
|
|
875
|
+
/* @__PURE__ */ e.jsx(
|
|
876
|
+
Ve,
|
|
877
|
+
{
|
|
878
|
+
left: /* @__PURE__ */ e.jsx(
|
|
879
|
+
R,
|
|
880
|
+
{
|
|
881
|
+
value: c,
|
|
882
|
+
onChange: r,
|
|
883
|
+
style: { width: 240 },
|
|
884
|
+
placeholder: "选择项目",
|
|
885
|
+
options: i.map((x) => ({ label: x.name, value: x.id }))
|
|
886
|
+
}
|
|
887
|
+
),
|
|
888
|
+
right: /* @__PURE__ */ e.jsx(b, { type: "primary", icon: /* @__PURE__ */ e.jsx(me, {}), onClick: U, children: "新建任务" })
|
|
889
|
+
}
|
|
890
|
+
),
|
|
891
|
+
S && /* @__PURE__ */ e.jsx("div", { style: { marginBottom: 16 }, children: /* @__PURE__ */ e.jsx(
|
|
892
|
+
ie,
|
|
893
|
+
{
|
|
894
|
+
error: S,
|
|
895
|
+
onRetry: N,
|
|
896
|
+
title: "加载项目列表失败"
|
|
897
|
+
}
|
|
898
|
+
) }),
|
|
899
|
+
k && /* @__PURE__ */ e.jsx("div", { style: { marginBottom: 16 }, children: /* @__PURE__ */ e.jsx(ie, { error: k, onRetry: () => A(c) }) }),
|
|
900
|
+
/* @__PURE__ */ e.jsx("div", { style: {
|
|
901
|
+
background: "#ffffff",
|
|
902
|
+
borderRadius: 16,
|
|
903
|
+
padding: 20,
|
|
904
|
+
boxShadow: "0 1px 3px rgba(15, 23, 42, 0.04), 0 1px 2px rgba(15, 23, 42, 0.06)"
|
|
905
|
+
}, children: ve ? /* @__PURE__ */ e.jsx(
|
|
906
|
+
Ee,
|
|
907
|
+
{
|
|
908
|
+
title: "该项目下还没有任务",
|
|
909
|
+
description: "把目标拆解成可执行的任务, 一项项推进",
|
|
910
|
+
actionText: "新建第一个任务",
|
|
911
|
+
onAction: U
|
|
912
|
+
}
|
|
913
|
+
) : /* @__PURE__ */ e.jsx(
|
|
914
|
+
ee,
|
|
915
|
+
{
|
|
916
|
+
rowKey: "id",
|
|
917
|
+
columns: K,
|
|
918
|
+
dataSource: u,
|
|
919
|
+
loading: a,
|
|
920
|
+
pagination: { pageSize: 10 }
|
|
921
|
+
}
|
|
922
|
+
) }),
|
|
923
|
+
/* @__PURE__ */ e.jsx(
|
|
924
|
+
pe,
|
|
925
|
+
{
|
|
926
|
+
title: "新建任务",
|
|
927
|
+
open: L,
|
|
928
|
+
onCancel: () => C(!1),
|
|
929
|
+
onOk: s,
|
|
930
|
+
destroyOnHidden: !0,
|
|
931
|
+
children: /* @__PURE__ */ e.jsxs(y, { form: _, layout: "vertical", preserve: !1, children: [
|
|
932
|
+
/* @__PURE__ */ e.jsx(y.Item, { name: "title", label: "任务标题", rules: [{ required: !0, message: "请输入任务标题" }], children: /* @__PURE__ */ e.jsx(F, { placeholder: "例如: 实现 xx 功能" }) }),
|
|
933
|
+
/* @__PURE__ */ e.jsx(y.Item, { name: "projectId", label: "所属项目", rules: [{ required: !0 }], children: /* @__PURE__ */ e.jsx(
|
|
934
|
+
R,
|
|
935
|
+
{
|
|
936
|
+
options: i.map((x) => ({ label: x.name, value: x.id })),
|
|
937
|
+
placeholder: "从数据库捞出的项目列表"
|
|
938
|
+
}
|
|
939
|
+
) }),
|
|
940
|
+
/* @__PURE__ */ e.jsx(y.Item, { name: "listId", label: "列表ID", rules: [{ required: !0 }], children: /* @__PURE__ */ e.jsx(F, { type: "number", placeholder: "默认 1" }) }),
|
|
941
|
+
/* @__PURE__ */ e.jsx(y.Item, { name: "priority", label: "优先级", initialValue: 1, children: /* @__PURE__ */ e.jsx(R, { options: [{ label: "低", value: 1 }, { label: "中", value: 2 }, { label: "高", value: 3 }] }) })
|
|
942
|
+
] })
|
|
943
|
+
}
|
|
944
|
+
),
|
|
945
|
+
/* @__PURE__ */ e.jsx(
|
|
946
|
+
He,
|
|
947
|
+
{
|
|
948
|
+
taskId: $ == null ? void 0 : $.id,
|
|
949
|
+
open: j,
|
|
950
|
+
onClose: () => {
|
|
951
|
+
m(!1), E(null);
|
|
952
|
+
},
|
|
953
|
+
onChanged: A,
|
|
954
|
+
onEdit: (x) => {
|
|
955
|
+
E(x), m(!1), M(!0);
|
|
956
|
+
}
|
|
957
|
+
}
|
|
958
|
+
),
|
|
959
|
+
/* @__PURE__ */ e.jsx(
|
|
960
|
+
Ne,
|
|
961
|
+
{
|
|
962
|
+
open: D,
|
|
963
|
+
task: $,
|
|
964
|
+
projects: i,
|
|
965
|
+
onClose: () => {
|
|
966
|
+
M(!1), E(null);
|
|
967
|
+
},
|
|
968
|
+
onSaved: A
|
|
969
|
+
}
|
|
970
|
+
)
|
|
971
|
+
] });
|
|
972
|
+
}
|
|
973
|
+
const { Text: ce, Title: st } = he, de = {
|
|
974
|
+
0: { text: "待办", color: "default", icon: /* @__PURE__ */ e.jsx(ge, {}) },
|
|
975
|
+
1: { text: "进行中", color: "blue", icon: /* @__PURE__ */ e.jsx(be, {}) },
|
|
976
|
+
2: { text: "已完成", color: "green", icon: /* @__PURE__ */ e.jsx(J, {}) }
|
|
977
|
+
};
|
|
978
|
+
function Ue({ apiBaseURL: t }) {
|
|
979
|
+
const [l, i] = p([]), [n, c] = p(null), [r, u] = p([]), [o, a] = p(!1), [d, k] = p(!1), P = async () => {
|
|
980
|
+
k(!0);
|
|
981
|
+
try {
|
|
982
|
+
const j = await v.listMyProjects(), m = (j == null ? void 0 : j.data) || j || [];
|
|
983
|
+
i(m), m.length > 0 && !n && c(m[0].id);
|
|
984
|
+
} catch {
|
|
985
|
+
i([]);
|
|
986
|
+
} finally {
|
|
987
|
+
k(!1);
|
|
988
|
+
}
|
|
989
|
+
}, S = async (j) => {
|
|
990
|
+
if (!j) {
|
|
991
|
+
u([]);
|
|
992
|
+
return;
|
|
993
|
+
}
|
|
994
|
+
a(!0);
|
|
995
|
+
try {
|
|
996
|
+
const m = await v.listTasksByProject(j);
|
|
997
|
+
u((m == null ? void 0 : m.data) || m || []);
|
|
998
|
+
} catch {
|
|
999
|
+
u([]);
|
|
1000
|
+
} finally {
|
|
1001
|
+
a(!1);
|
|
1002
|
+
}
|
|
1003
|
+
};
|
|
1004
|
+
W(() => {
|
|
1005
|
+
P();
|
|
1006
|
+
}, []), W(() => {
|
|
1007
|
+
S(n);
|
|
1008
|
+
}, [n]);
|
|
1009
|
+
const g = r.reduce((j, m) => {
|
|
1010
|
+
j.total += 1;
|
|
1011
|
+
const D = m.status ?? 0;
|
|
1012
|
+
return D === 0 ? j.todo += 1 : D === 1 ? j.doing += 1 : D === 2 && (j.done += 1), j;
|
|
1013
|
+
}, { total: 0, todo: 0, doing: 0, done: 0 }), L = g.total > 0 ? Math.round(g.done / g.total * 100) : 0, C = [1, 2, 3].map((j) => ({
|
|
1014
|
+
priority: j,
|
|
1015
|
+
list: r.filter((m) => (m.priority ?? 1) === j)
|
|
1016
|
+
}));
|
|
1017
|
+
return /* @__PURE__ */ e.jsxs("div", { style: { display: "flex", flexDirection: "column", gap: 16 }, children: [
|
|
1018
|
+
/* @__PURE__ */ e.jsx(B, { children: /* @__PURE__ */ e.jsxs(T, { wrap: !0, children: [
|
|
1019
|
+
/* @__PURE__ */ e.jsx(Ce, { style: { fontSize: 18, color: "#1677ff" } }),
|
|
1020
|
+
/* @__PURE__ */ e.jsx(ce, { strong: !0, children: "选择项目:" }),
|
|
1021
|
+
/* @__PURE__ */ e.jsx(
|
|
1022
|
+
R,
|
|
1023
|
+
{
|
|
1024
|
+
value: n,
|
|
1025
|
+
onChange: c,
|
|
1026
|
+
style: { width: 280 },
|
|
1027
|
+
loading: d,
|
|
1028
|
+
placeholder: "选择项目",
|
|
1029
|
+
options: l.map((j) => ({ label: j.name, value: j.id }))
|
|
1030
|
+
}
|
|
1031
|
+
),
|
|
1032
|
+
/* @__PURE__ */ e.jsxs("a", { onClick: () => P(), children: [
|
|
1033
|
+
/* @__PURE__ */ e.jsx(ye, {}),
|
|
1034
|
+
" 刷新项目"
|
|
1035
|
+
] })
|
|
1036
|
+
] }) }),
|
|
1037
|
+
/* @__PURE__ */ e.jsxs(xe, { spinning: o, children: [
|
|
1038
|
+
/* @__PURE__ */ e.jsxs(le, { gutter: 16, children: [
|
|
1039
|
+
/* @__PURE__ */ e.jsx(H, { span: 6, children: /* @__PURE__ */ e.jsx(B, { children: /* @__PURE__ */ e.jsx(G, { title: "总任务数", value: g.total }) }) }),
|
|
1040
|
+
/* @__PURE__ */ e.jsx(H, { span: 6, children: /* @__PURE__ */ e.jsx(B, { children: /* @__PURE__ */ e.jsx(
|
|
1041
|
+
G,
|
|
1042
|
+
{
|
|
1043
|
+
title: "待办",
|
|
1044
|
+
value: g.todo,
|
|
1045
|
+
styles: { content: { color: "#8c8c8c" } },
|
|
1046
|
+
prefix: /* @__PURE__ */ e.jsx(ge, {})
|
|
1047
|
+
}
|
|
1048
|
+
) }) }),
|
|
1049
|
+
/* @__PURE__ */ e.jsx(H, { span: 6, children: /* @__PURE__ */ e.jsx(B, { children: /* @__PURE__ */ e.jsx(
|
|
1050
|
+
G,
|
|
1051
|
+
{
|
|
1052
|
+
title: "进行中",
|
|
1053
|
+
value: g.doing,
|
|
1054
|
+
styles: { content: { color: "#1677ff" } },
|
|
1055
|
+
prefix: /* @__PURE__ */ e.jsx(be, {})
|
|
1056
|
+
}
|
|
1057
|
+
) }) }),
|
|
1058
|
+
/* @__PURE__ */ e.jsx(H, { span: 6, children: /* @__PURE__ */ e.jsx(B, { children: /* @__PURE__ */ e.jsx(
|
|
1059
|
+
G,
|
|
1060
|
+
{
|
|
1061
|
+
title: "已完成",
|
|
1062
|
+
value: g.done,
|
|
1063
|
+
styles: { content: { color: "#52c41a" } },
|
|
1064
|
+
prefix: /* @__PURE__ */ e.jsx(J, {})
|
|
1065
|
+
}
|
|
1066
|
+
) }) })
|
|
1067
|
+
] }),
|
|
1068
|
+
/* @__PURE__ */ e.jsx(B, { style: { marginTop: 16 }, title: "完成率", children: /* @__PURE__ */ e.jsx(ze, { percent: L, status: L === 100 ? "success" : "active" }) }),
|
|
1069
|
+
/* @__PURE__ */ e.jsx(le, { gutter: 16, style: { marginTop: 16 }, children: C.map(({ priority: j, list: m }) => /* @__PURE__ */ e.jsx(H, { span: 8, children: /* @__PURE__ */ e.jsx(B, { size: "small", title: /* @__PURE__ */ e.jsxs(T, { children: [
|
|
1070
|
+
/* @__PURE__ */ e.jsx(z, { color: j === 3 ? "red" : j === 2 ? "orange" : "default", children: j === 3 ? "高" : j === 2 ? "中" : "低" }),
|
|
1071
|
+
/* @__PURE__ */ e.jsxs("span", { children: [
|
|
1072
|
+
"优先级 (",
|
|
1073
|
+
m.length,
|
|
1074
|
+
")"
|
|
1075
|
+
] })
|
|
1076
|
+
] }), children: m.length === 0 ? /* @__PURE__ */ e.jsx(Z, { image: Z.PRESENTED_IMAGE_SIMPLE, description: "无任务" }) : /* @__PURE__ */ e.jsx(
|
|
1077
|
+
q,
|
|
1078
|
+
{
|
|
1079
|
+
size: "small",
|
|
1080
|
+
dataSource: m.slice(0, 8),
|
|
1081
|
+
renderItem: (D) => {
|
|
1082
|
+
const M = de[D.status ?? 0] || de[0];
|
|
1083
|
+
return /* @__PURE__ */ e.jsx(q.Item, { children: /* @__PURE__ */ e.jsx(
|
|
1084
|
+
q.Item.Meta,
|
|
1085
|
+
{
|
|
1086
|
+
avatar: M.icon,
|
|
1087
|
+
title: /* @__PURE__ */ e.jsxs(T, { children: [
|
|
1088
|
+
/* @__PURE__ */ e.jsx(ce, { children: D.title }),
|
|
1089
|
+
/* @__PURE__ */ e.jsx(z, { color: M.color, style: { margin: 0 }, children: M.text })
|
|
1090
|
+
] }),
|
|
1091
|
+
description: D.dueDate ? `截止: ${D.dueDate}` : "无截止时间"
|
|
1092
|
+
}
|
|
1093
|
+
) });
|
|
1094
|
+
}
|
|
1095
|
+
}
|
|
1096
|
+
) }) }, j)) })
|
|
1097
|
+
] })
|
|
1098
|
+
] });
|
|
1099
|
+
}
|
|
1100
|
+
function lt() {
|
|
1101
|
+
return /* @__PURE__ */ e.jsxs(Me, { children: [
|
|
1102
|
+
/* @__PURE__ */ e.jsx(V, { index: !0, element: /* @__PURE__ */ e.jsx(Ae, { to: "dashboard", replace: !0 }) }),
|
|
1103
|
+
/* @__PURE__ */ e.jsx(V, { path: "dashboard", element: /* @__PURE__ */ e.jsx(Ue, {}) }),
|
|
1104
|
+
/* @__PURE__ */ e.jsx(V, { path: "project", element: /* @__PURE__ */ e.jsx(re, {}) }),
|
|
1105
|
+
/* @__PURE__ */ e.jsx(V, { path: "project/*", element: /* @__PURE__ */ e.jsx(re, {}) }),
|
|
1106
|
+
/* @__PURE__ */ e.jsx(V, { path: "task", element: /* @__PURE__ */ e.jsx(oe, {}) }),
|
|
1107
|
+
/* @__PURE__ */ e.jsx(V, { path: "task/*", element: /* @__PURE__ */ e.jsx(oe, {}) })
|
|
1108
|
+
] });
|
|
1109
|
+
}
|
|
1110
|
+
export {
|
|
1111
|
+
re as ProjectList,
|
|
1112
|
+
tt as ProjectSelect,
|
|
1113
|
+
lt as TaskApp,
|
|
1114
|
+
Ze as TaskCard,
|
|
1115
|
+
Ue as TaskDashboard,
|
|
1116
|
+
oe as TaskList,
|
|
1117
|
+
et as TaskTable,
|
|
1118
|
+
v as api,
|
|
1119
|
+
v as taskApi
|
|
1120
|
+
};
|