mirror of
https://github.com/RuoJi6/ARTEX.git
synced 2026-12-02 20:01:51 +08:00
支持计划任务日期范围
This commit is contained in:
1 parent
6a2bba4637
commit
98321d8262
12 files changed
+238
-35
No files matched your search
@@ -5,6 +5,7 @@ import * as React from "react";
|
||||
import { CalendarClock, Loader2, Pause, Play, Plus, Search, Trash2, Zap } from "lucide-react";
|
||||
import { toast } from "sonner";
|
||||
|
||||
import { DateSelect } from "@/components/date-select";
|
||||
import { TimeSelect } from "@/components/time-select";
|
||||
import { Badge } from "@/components/ui/badge";
|
||||
import { Button } from "@/components/ui/button";
|
||||
@@ -145,9 +146,25 @@ function ScheduleForm({
|
||||
</div>
|
||||
</div>
|
||||
{draft.schedule_type === "once" ? (
|
||||
<div className="grid gap-2">
|
||||
<Label>执行日期</Label>
|
||||
<Input type="date" value={draft.run_date ?? ""} onChange={(e) => set({ run_date: e.target.value })} />
|
||||
<div className="grid grid-cols-2 gap-3">
|
||||
<div className="grid gap-2">
|
||||
<Label>开始日期</Label>
|
||||
<DateSelect
|
||||
value={draft.run_date ?? ""}
|
||||
onValueChange={(value) => set({ run_date: value })}
|
||||
aria-label="开始日期"
|
||||
/>
|
||||
</div>
|
||||
<div className="grid gap-2">
|
||||
<Label>截止日期(可选)</Label>
|
||||
<DateSelect
|
||||
value={draft.end_date ?? ""}
|
||||
onValueChange={(value) => set({ end_date: value })}
|
||||
optional
|
||||
placeholder="不设置截止日期"
|
||||
aria-label="截止日期,可选"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
) : (
|
||||
<div className="grid gap-2">
|
||||
@@ -186,7 +203,7 @@ function ScheduleForm({
|
||||
</div>
|
||||
</div>
|
||||
<p className="text-muted-foreground text-xs">
|
||||
结束时间为空表示开始后持续运行;结束时间早于开始时间表示跨午夜窗口。
|
||||
一次性计划可设置截止日期;截止日期为空时仅按结束时间控制。结束时间为空表示持续运行,结束时间早于开始时间表示跨午夜窗口。
|
||||
</p>
|
||||
<div className="flex items-center gap-2 text-sm">
|
||||
<Checkbox
|
||||
@@ -344,6 +361,7 @@ export default function SchedulesPage() {
|
||||
timezone_mode: item.timezone_mode,
|
||||
schedule_type: item.schedule_type,
|
||||
run_date: item.run_date,
|
||||
end_date: item.end_date,
|
||||
weekdays: item.weekdays,
|
||||
start_time: item.start_time.slice(0, 5),
|
||||
end_time: item.end_time?.slice(0, 5),
|
||||
|
||||
@@ -45,10 +45,12 @@ import {
|
||||
import { toast } from "sonner";
|
||||
|
||||
import { AssetInterceptRulesEditor } from "@/components/asset-intercept-rules-editor";
|
||||
import { DateSelect } from "@/components/date-select";
|
||||
import { StatusBadge } from "@/components/status-badge";
|
||||
import { TablePagination } from "@/components/table-pagination";
|
||||
import { TaskLLMProfileChain } from "@/components/task-llm-profile-chain";
|
||||
import { TaskTemplateControls } from "@/components/task-template-controls";
|
||||
import { TimeSelect } from "@/components/time-select";
|
||||
import {
|
||||
AlertDialog,
|
||||
AlertDialogAction,
|
||||
@@ -117,7 +119,6 @@ import { Switch } from "@/components/ui/switch";
|
||||
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "@/components/ui/table";
|
||||
import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs";
|
||||
import { Textarea } from "@/components/ui/textarea";
|
||||
import { TimeSelect } from "@/components/time-select";
|
||||
import { Tooltip, TooltipContent, TooltipTrigger } from "@/components/ui/tooltip";
|
||||
import { api, type ScheduleInput } from "@/lib/api";
|
||||
import { getLocalStorageValue, setLocalStorageValue } from "@/lib/local-storage.client";
|
||||
@@ -3101,6 +3102,7 @@ function CreateTaskSheet({
|
||||
const [schedule, setSchedule] = React.useState<ScheduleInput>({
|
||||
name: "新建任务计划",
|
||||
schedule_type: "weekly",
|
||||
end_date: "",
|
||||
weekdays: [6, 7],
|
||||
start_time: "18:00",
|
||||
end_time: "",
|
||||
@@ -3197,6 +3199,7 @@ function CreateTaskSheet({
|
||||
setSchedule({
|
||||
name: "新建任务计划",
|
||||
schedule_type: "weekly",
|
||||
end_date: "",
|
||||
weekdays: [6, 7],
|
||||
start_time: "18:00",
|
||||
end_time: "",
|
||||
@@ -3321,14 +3324,26 @@ function CreateTaskSheet({
|
||||
</Field>
|
||||
</div>
|
||||
{schedule.schedule_type === "once" ? (
|
||||
<Field>
|
||||
<FieldLabel>执行日期</FieldLabel>
|
||||
<Input
|
||||
type="date"
|
||||
value={schedule.run_date ?? ""}
|
||||
onChange={(e) => setSchedule({ ...schedule, run_date: e.target.value })}
|
||||
/>
|
||||
</Field>
|
||||
<div className="grid grid-cols-2 gap-3">
|
||||
<Field>
|
||||
<FieldLabel>开始日期</FieldLabel>
|
||||
<DateSelect
|
||||
value={schedule.run_date ?? ""}
|
||||
onValueChange={(value) => setSchedule({ ...schedule, run_date: value })}
|
||||
aria-label="开始日期"
|
||||
/>
|
||||
</Field>
|
||||
<Field>
|
||||
<FieldLabel>截止日期(可选)</FieldLabel>
|
||||
<DateSelect
|
||||
value={schedule.end_date ?? ""}
|
||||
onValueChange={(value) => setSchedule({ ...schedule, end_date: value })}
|
||||
optional
|
||||
placeholder="不设置截止日期"
|
||||
aria-label="截止日期,可选"
|
||||
/>
|
||||
</Field>
|
||||
</div>
|
||||
) : (
|
||||
<Field>
|
||||
<FieldLabel>星期(1=周一,7=周日)</FieldLabel>
|
||||
|
||||
Reference in new issue
Block a user