feat: 标签管理增加分组

This commit is contained in:
2026-03-02 13:39:34 +08:00
parent 4418a95822
commit 95338a3ddf
7 changed files with 28 additions and 29 deletions

View File

@@ -83,7 +83,7 @@ function EnhancedProTable<T extends BaseRecord, U extends ParamsType = any>(
? { ? {
showSizeChanger: true, showSizeChanger: true,
showQuickJumper: true, showQuickJumper: true,
pageSize: 10, // pageSize: 10,
showTotal: formatPaginationTotal, showTotal: formatPaginationTotal,
} }
: false : false

View File

@@ -169,17 +169,7 @@ const GroupTagCore: React.FC<GroupTagCoreProps> = (props) => {
id: tagsModalValue?.id, id: tagsModalValue?.id,
...value, ...value,
}); });
fetchTagsApi();
const newTag = currentGroup?.tags?.map((tag) => {
if (tag.id === tagsModalValue?.id) {
return { ...tag, tagName: value.tagName };
} else {
return tag;
}
});
const newGroup = { ...currentGroup, tags: newTag };
setCurrentGroup(newGroup as GroupItem);
} }
setVisible(false); setVisible(false);
message.success('修改成功'); message.success('修改成功');
@@ -195,7 +185,8 @@ const GroupTagCore: React.FC<GroupTagCoreProps> = (props) => {
setCurrentGroup(newGroups[0]); setCurrentGroup(newGroups[0]);
} }
} else { } else {
tagsApi.delete(id); await tagsApi.delete(id);
fetchTagsApi();
} }
}; };

View File

@@ -1,5 +1,6 @@
import { Form, Input, Modal, Select } from 'antd'; import { Form, Input, Modal, Select } from 'antd';
import { useEffect, useState } from 'react'; import { useEffect, useState } from 'react';
import { getGroupListByYagId } from '@/services/ai/sample';
interface TagsModalProps { interface TagsModalProps {
visible: boolean; visible: boolean;
@@ -24,8 +25,19 @@ const TagsModal = (props: TagsModalProps) => {
const { value, visible, type, modalType, groups, onCancel, onConfirm } = const { value, visible, type, modalType, groups, onCancel, onConfirm } =
props; props;
const onGroupListByYagId = async (id: number) => {
const groupItem: { id?: number; groupName?: string }[] =
await getGroupListByYagId(id);
form.setFieldsValue({
groupIds: groupItem.map((item) => item.id),
});
};
useEffect(() => { useEffect(() => {
form.setFieldsValue(value); form.setFieldsValue(value);
console.log('value', value);
if (visible && type === 'tag' && value.id) {
onGroupListByYagId(value.id);
}
return () => { return () => {
form.resetFields(); form.resetFields();
setLoading(false); setLoading(false);
@@ -61,7 +73,7 @@ const TagsModal = (props: TagsModalProps) => {
wrapperCol={{ span: 20 }} wrapperCol={{ span: 20 }}
style={{ maxWidth: 600, marginTop: 30 }} style={{ maxWidth: 600, marginTop: 30 }}
> >
{type === 'tag' && modalType === 'add' && ( {type === 'tag' && (
<Form.Item <Form.Item
label="分组" label="分组"
name="groupIds" name="groupIds"

View File

@@ -112,7 +112,7 @@ const ModelPage = () => {
columns={columns} columns={columns}
request={onFetch} request={onFetch}
toolbarActions={toolbarActions} toolbarActions={toolbarActions}
headerTitle="租户列表" headerTitle="模型管理"
showIndex={false} showIndex={false}
showSelection={false} showSelection={false}
search={false} search={false}

View File

@@ -72,7 +72,7 @@ export const baseTenantColumns: ProColumns<AiSampleRespVO>[] = [
}, },
}} }}
editable editable
placeholder="请选择技术栈" placeholder="请选择标签"
/> />
); );
}, },

View File

@@ -128,18 +128,6 @@ const SampleTagDetail = <T extends Record<string, any>>(
const handleDownloadAll = async () => { const handleDownloadAll = async () => {
const ids = data?.map((sample) => sample.id) as number[]; const ids = data?.map((sample) => sample.id) as number[];
downloadZipFile(ids); downloadZipFile(ids);
// const res = await downloadSample(ids);
// console.log(res);
// const downloadUrl = window.URL.createObjectURL(res);
// const link = document.createElement("a");
// link.href = downloadUrl;
// link.download = downloadUrl; // 设置下载的文件名
// link.style.display = "none";
// document.body.appendChild(link);
// link.click();
// document.body.removeChild(link);
// // const blob = new Blob([response.data], { type: 'application/pdf' });
// // const url = window.URL.createObjectURL(blob);
}; };
const handleTagManager = () => { const handleTagManager = () => {
@@ -221,7 +209,7 @@ const SampleTagDetail = <T extends Record<string, any>>(
}) || []; }) || [];
await updateSamples(newData); await updateSamples(newData);
props?.onRefresh?.(); props?.onRefresh?.();
message.success('更新成功'); message.success('更新样本名称成功');
} }
}, },
}} }}
@@ -242,6 +230,7 @@ const SampleTagDetail = <T extends Record<string, any>>(
}) || []; }) || [];
await updateSamples(newData); await updateSamples(newData);
props?.onRefresh?.(); props?.onRefresh?.();
message.success('更新注释成功');
} }
}, },
}} }}

View File

@@ -257,6 +257,13 @@ export const downloadSample = async (ids: number[]) => {
}); });
}; };
export const getGroupListByYagId = async (id: number) => {
return request("/ai/sampleTag/group-list-by-tag-id", {
method: "GET",
params: { tagId: id },
});
};
export async function downloadZipFile(ids: number[]) { export async function downloadZipFile(ids: number[]) {
try { try {
const response = await downloadSample(ids); const response = await downloadSample(ids);