import RadioCard from "@/components/RadioCard"; import { Input, Select, Form } from "antd"; import { datasetTypes } from "../../dataset.const"; import { useEffect, useState } from "react"; import { queryDatasetTagsUsingGet } from "../../dataset.api"; import {queryTasksUsingGet} from "@/pages/DataCollection/collection.apis.ts"; export default function BasicInformation({ data, setData, hidden = [], }: { data: any; setData: any; hidden?: string[]; }) { const [tagOptions, setTagOptions] = useState< { label: JSX.Element; title: string; options: { label: JSX.Element; value: string }[]; }[] >([]); const [collectionOptions, setCollectionOptions] = useState([]); // 获取标签 const fetchTags = async () => { if (hidden.includes("tags")) return; try { const { data } = await queryDatasetTagsUsingGet(); const customTags = data.map((tag) => ({ label: tag.name, value: tag.name, })); setTagOptions(customTags); } catch (error) { console.error("Error fetching tags: ", error); } }; // 获取归集任务 const fetchCollectionTasks = async () => { try { const res = await queryTasksUsingGet({ page: 0, size: 100 }); const options = res.data.content.map((task: any) => ({ label: task.name, value: task.id, })); setCollectionOptions(options); } catch (error) { console.error("Error fetching collection tasks:", error); } }; useEffect(() => { fetchTags(); fetchCollectionTasks(); }, []); return ( <> {!hidden.includes("description") && ( )} {/* 数据集类型选择 - 使用卡片形式 */} {!hidden.includes("datasetType") && ( setData({ ...data, datasetType })} /> )} {!hidden.includes("tags") && ( )} ); }