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,
showQuickJumper: true,
pageSize: 10,
// pageSize: 10,
showTotal: formatPaginationTotal,
}
: false

View File

@@ -169,17 +169,7 @@ const GroupTagCore: React.FC<GroupTagCoreProps> = (props) => {
id: tagsModalValue?.id,
...value,
});
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);
fetchTagsApi();
}
setVisible(false);
message.success('修改成功');
@@ -195,7 +185,8 @@ const GroupTagCore: React.FC<GroupTagCoreProps> = (props) => {
setCurrentGroup(newGroups[0]);
}
} else {
tagsApi.delete(id);
await tagsApi.delete(id);
fetchTagsApi();
}
};

View File

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

View File

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

View File

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

View File

@@ -128,18 +128,6 @@ const SampleTagDetail = <T extends Record<string, any>>(
const handleDownloadAll = async () => {
const ids = data?.map((sample) => sample.id) as number[];
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 = () => {
@@ -221,7 +209,7 @@ const SampleTagDetail = <T extends Record<string, any>>(
}) || [];
await updateSamples(newData);
props?.onRefresh?.();
message.success('更新成功');
message.success('更新样本名称成功');
}
},
}}
@@ -242,6 +230,7 @@ const SampleTagDetail = <T extends Record<string, any>>(
}) || [];
await updateSamples(newData);
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[]) {
try {
const response = await downloadSample(ids);