fix the ratio task config (#224)

* fix: fix the dataset card icon

* fix: fix the dataset file tag distribution and ratio task

* refactor: change dateRange config from latest to start-end
This commit is contained in:
hefanli
2026-01-05 17:02:28 +08:00
committed by GitHub
parent 3f1ad6a872
commit a15a6134ff
6 changed files with 44 additions and 37 deletions

View File

@@ -7,6 +7,7 @@ import { useNavigate } from "react-router";
import SelectDataset from "@/pages/RatioTask/Create/components/SelectDataset.tsx";
import BasicInformation from "@/pages/RatioTask/Create/components/BasicInformation.tsx";
import RatioConfig from "@/pages/RatioTask/Create/components/RatioConfig.tsx";
import {formatDate} from "@/utils/unit.ts";
export default function CreateRatioTask() {
const navigate = useNavigate();
@@ -37,10 +38,11 @@ export default function CreateRatioTask() {
}
const totals = String(values.totalTargetCount);
const config = ratioTaskForm.ratioConfigs.map((c) => {
const dateRange = c.dateRange ? [formatDate(c.dateRange[0]), formatDate(c.dateRange[1])] : []
return {
datasetId: c.source,
counts: String(c.quantity ?? 0),
filterConditions: { label: c.labelFilter, dateRange: String(c.dateRange ?? 0)},
filterConditions: { label: c.labelFilter, dateRange: dateRange},
};
});

View File

@@ -6,6 +6,7 @@ import {
Select,
Table,
InputNumber,
DatePicker
} from "antd";
import { BarChart3 } from "lucide-react";
import type { Dataset } from "@/pages/DataManagement/dataset.model.ts";
@@ -31,7 +32,7 @@ interface RatioConfigItem {
percentage: number;
source: string; // dataset id
labelFilter?: LabelFilter;
dateRange?: number;
dateRange?: [Date | null, Date | null] | null;
}
interface RatioConfigProps {
@@ -303,20 +304,18 @@ const RatioConfig: FC<RatioConfigProps> = ({
title: "标签更新时间",
dataIndex: "dateRange",
key: "dateRange",
render: (_: any, record: RatioConfigItem) => (
<Select
style={{ width: "140px" }}
placeholder="选择标签更新时间"
value={record.dateRange}
options={TIME_RANGE_OPTIONS}
allowClear
onChange={(value) =>
updateConfig(record.id, {
dateRange: value || undefined,
})
}
/>
),
render: (_: any, record: RatioConfigItem) => {
return (
<DatePicker.RangePicker
value={record.dateRange as any}
onChange={(date) => {
updateConfig(record.id, { dateRange: date });
}}
placeholder={["开始时间", "结束时间"]}
allowClear
/>
);
},
},
{
title: "数量",