feat: 任务/模板备注展示与 Worker 运行数量配置

- 新建任务可填写备注;详情页头部展示备注(列表原有 RemarkEditor 保留)
- 任务模板支持备注与 Worker 数量,应用/另存为模板时同步带入
- 新建任务高级设置与模板均可单独设置 Worker 运行数量(0=回落全局默认)
- schema/API/引擎贯通:tasks.worker_count、task_templates.remark/worker_count
This commit is contained in:
RuoJi6 committed 2026-10-23 19:01:21 +08:00
1 parent 620ca5d96c
commit 45d4e4e67b
15 files changed
+250 -26

No files matched your search

+10
View File
@@ -1182,10 +1182,12 @@ function route(m: string, path: string, seg: string[], q: URLSearchParams, b: Re
const created: Task = {
id,
name: String(b.name ?? ""),
remark: typeof b.remark === "string" ? b.remark.trim() : "",
category_id: category?.id,
category_name: category?.name,
description: String(b.description ?? "新任务"),
goal: String(b.goal ?? ""),
worker_count: typeof b.worker_count === "number" ? Math.min(50, Math.max(0, Math.floor(b.worker_count))) : 0,
status: "created",
created_at: now.toISOString(),
created_unix: Math.floor(now.getTime() / 1000),
@@ -1315,6 +1317,10 @@ function route(m: string, path: string, seg: string[], q: URLSearchParams, b: Re
name,
description,
goal,
remark: typeof b.remark === "string" ? b.remark.trim() : "",
category_id: typeof b.category_id === "number" ? b.category_id : null,
intercept_rules: Array.isArray(b.intercept_rules) ? b.intercept_rules : [],
worker_count: typeof b.worker_count === "number" ? Math.min(50, Math.max(0, Math.floor(b.worker_count))) : 0,
created_at: now,
updated_at: now,
};
@@ -1338,6 +1344,10 @@ function route(m: string, path: string, seg: string[], q: URLSearchParams, b: Re
template.name = name;
template.description = description;
template.goal = goal;
if (typeof b.remark === "string") template.remark = b.remark.trim();
if ("category_id" in b) template.category_id = typeof b.category_id === "number" ? b.category_id : null;
if (Array.isArray(b.intercept_rules)) template.intercept_rules = b.intercept_rules;
if (typeof b.worker_count === "number") template.worker_count = Math.min(50, Math.max(0, Math.floor(b.worker_count)));
template.updated_at = new Date().toISOString();
mockTaskTemplates.sort((a, b) => b.updated_at.localeCompare(a.updated_at) || b.id - a.id);
return template;