Skip to content

Commit cddfe9b

Browse files
authored
feature: 数据配比增加通过更新时间来配置 (#95)
* feature: 数据配比增加通过更新时间来配置 * fix: 修复配比时间参数传递的问题
1 parent 955ffff commit cddfe9b

File tree

10 files changed

+453
-590
lines changed

10 files changed

+453
-590
lines changed

frontend/src/pages/RatioTask/Create/CreateRatioTask.tsx

Lines changed: 2 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import { useNavigate } from "react-router";
77
import SelectDataset from "@/pages/RatioTask/Create/components/SelectDataset.tsx";
88
import BasicInformation from "@/pages/RatioTask/Create/components/BasicInformation.tsx";
99
import RatioConfig from "@/pages/RatioTask/Create/components/RatioConfig.tsx";
10-
import RatioTransfer from "./components/RatioTransfer";
1110

1211
export default function CreateRatioTask() {
1312
const navigate = useNavigate();
@@ -36,27 +35,12 @@ export default function CreateRatioTask() {
3635
message.error("请配置配比项");
3736
return;
3837
}
39-
// Build request payload
40-
const ratio_method =
41-
ratioTaskForm.ratioType === "dataset" ? "DATASET" : "TAG";
4238
const totals = String(values.totalTargetCount);
4339
const config = ratioTaskForm.ratioConfigs.map((c) => {
44-
if (ratio_method === "DATASET") {
45-
return {
46-
datasetId: String(c.source),
47-
counts: String(c.quantity ?? 0),
48-
filter_conditions: "",
49-
};
50-
}
51-
// TAG mode: source key like `${datasetId}_${label}`
52-
const source = String(c.source || "");
53-
const idx = source.indexOf("_");
54-
const datasetId = idx > 0 ? source.slice(0, idx) : source;
55-
const label = idx > 0 ? source.slice(idx + 1) : "";
5640
return {
57-
datasetId,
41+
datasetId: c.id,
5842
counts: String(c.quantity ?? 0),
59-
filter_conditions: label ? JSON.stringify({ label }) : "",
43+
filterConditions: { label: c.labelFilter, dateRange: String(c.dateRange ?? 0)},
6044
};
6145
});
6246

@@ -65,7 +49,6 @@ export default function CreateRatioTask() {
6549
name: values.name,
6650
description: values.description,
6751
totals,
68-
ratio_method,
6952
config,
7053
});
7154
message.success("配比任务创建成功");
@@ -108,13 +91,6 @@ export default function CreateRatioTask() {
10891
totalTargetCount={ratioTaskForm.totalTargetCount}
10992
/>
11093

111-
{/* <RatioTransfer
112-
ratioTaskForm={ratioTaskForm}
113-
distributions={distributions}
114-
updateRatioConfig={updateRatioConfig}
115-
updateLabelRatioConfig={updateLabelRatioConfig}
116-
/> */}
117-
11894
<div className="flex h-full">
11995
<SelectDataset
12096
selectedDatasets={ratioTaskForm.selectedDatasets}

frontend/src/pages/RatioTask/Create/components/BasicInformation.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ const BasicInformation: React.FC<BasicInformationProps> = ({
2727
<Input type="number" placeholder="目标总数量" min={1} />
2828
</Form.Item>
2929
<Form.Item label="任务描述" name="description" className="col-span-2">
30-
<TextArea placeholder="描述配比任务的目的和要求(可选)" rows={2} />
30+
<TextArea placeholder="描述配比任务的目的和要求" rows={2} />
3131
</Form.Item>
3232
</div>
3333
);

0 commit comments

Comments
 (0)