You've already forked DataMate
feat(data-management): 添加数据集类型判断并控制按行分割功能显示
- 从 dataset.model 中导入 DatasetType 类型定义 - 新增 isTextDataset 变量用于判断当前数据集是否为文本类型 - 将按行分割配置项包裹在条件渲染中,仅在文本数据集时显示 - 保持原有非文本文件禁用逻辑不变
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import { Select, Input, Form, Radio, Modal, Button, UploadFile, Switch, Tooltip } from "antd";
|
||||
import { InboxOutlined, QuestionCircleOutlined } from "@ant-design/icons";
|
||||
import { dataSourceOptions } from "../../dataset.const";
|
||||
import { Dataset, DataSource } from "../../dataset.model";
|
||||
import { Dataset, DatasetType, DataSource } from "../../dataset.model";
|
||||
import { useCallback, useEffect, useMemo, useState } from "react";
|
||||
import { queryTasksUsingGet } from "@/pages/DataCollection/collection.apis";
|
||||
import { updateDatasetByIdUsingPut } from "../../dataset.api";
|
||||
@@ -159,6 +159,7 @@ export default function ImportConfiguration({
|
||||
if (files.length === 0) return false;
|
||||
return files.some((file) => !isTextUploadFile(file));
|
||||
}, [importConfig.files]);
|
||||
const isTextDataset = data?.datasetType === DatasetType.TEXT;
|
||||
|
||||
// 本地上传文件相关逻辑
|
||||
|
||||
@@ -363,6 +364,7 @@ export default function ImportConfiguration({
|
||||
>
|
||||
<Switch />
|
||||
</Form.Item>
|
||||
{isTextDataset && (
|
||||
<Form.Item
|
||||
label={
|
||||
<span>
|
||||
@@ -383,6 +385,7 @@ export default function ImportConfiguration({
|
||||
>
|
||||
<Switch disabled={hasNonTextFile} />
|
||||
</Form.Item>
|
||||
)}
|
||||
<Form.Item
|
||||
label="上传文件"
|
||||
name="files"
|
||||
|
||||
Reference in New Issue
Block a user