diff --git a/config/proxy.ts b/config/proxy.ts index 8110d09..9237e61 100644 --- a/config/proxy.ts +++ b/config/proxy.ts @@ -17,7 +17,7 @@ export default { // http://192.168.1.231:48080 伟强 // http://192.168.1.89:48086 子杰 // https://petshy.tashowz.com/ - target: 'http://192.168.1.89:48086', + target: 'http://192.168.1.89:48080', changeOrigin: true, }, }, diff --git a/src/components/GroupTag/GroupTagCore.tsx b/src/components/GroupTag/GroupTagCore.tsx index b5c98f4..81c835a 100644 --- a/src/components/GroupTag/GroupTagCore.tsx +++ b/src/components/GroupTag/GroupTagCore.tsx @@ -32,6 +32,7 @@ const GroupTagCore: React.FC = (props) => { const [type, setType] = useState<'group' | 'tag'>('group'); const [visible, setVisible] = useState(false); const [name, setName] = useState(''); + const [tagName, setTagName] = useState(''); const [total, setTotal] = useState(0); const [currentId, setCurrentId] = useState(); const [tagsModalValue, setTagsModalValue] = useState<{ @@ -56,7 +57,11 @@ const GroupTagCore: React.FC = (props) => { const fetchTagsApi = useCallback(async () => { try { setLoadingTags(true); - const res = await tagsApi.get({ groupId: currentId, pageNo: 1 }); + const res = await tagsApi.get({ + groupId: currentId, + pageNo: 1, + tagName: tagName, + }); const newGroup = { ...currentGroup, tags: res.list }; const newData = groups.map((g) => (g.id === currentId ? newGroup : g)); setGroups(newData as GroupItem[]); @@ -238,6 +243,7 @@ const GroupTagCore: React.FC = (props) => { const onSearchTags = async (e: React.KeyboardEvent) => { const searchValue = (e.target as HTMLInputElement).value; + setTagName(searchValue); const res = await tagsApi.get({ groupId: currentId, pageNo: 1, @@ -247,11 +253,15 @@ const GroupTagCore: React.FC = (props) => { ...currentGroup, tags: res.list, }; + setTotal(res.total); document.getElementById('scrollableDiv')?.scrollTo(0, 0); setCurrentGroup(newGroup as GroupItem); setPageNo(1); }; - + const onSearchTagsClear = async () => { + setTagName(''); + fetchTagsApi(); + }; return (
@@ -260,6 +270,7 @@ const GroupTagCore: React.FC = (props) => { placeholder="搜索" onPressEnter={onSearchTags} allowClear + onClear={onSearchTagsClear} disabled={isInEditMode} />
diff --git a/src/components/GroupTag/component.tsx b/src/components/GroupTag/component.tsx index ea6f16d..58b8111 100644 --- a/src/components/GroupTag/component.tsx +++ b/src/components/GroupTag/component.tsx @@ -116,7 +116,7 @@ export const renderTags = (data: GroupTagProps) => { ); } - console.log(list.length); + console.log(list, total); return ( { }; const onFetch = async (params: { pageSize?: number; current?: number }) => { - const data = await getModelList(params); + const data = await getModelList({ ...params, pageNo: params.current }); return { data: data.list, success: true, diff --git a/src/pages/ai/sample-tag/config.tsx b/src/pages/ai/sample-tag/config.tsx index f7b162b..f8da7aa 100644 --- a/src/pages/ai/sample-tag/config.tsx +++ b/src/pages/ai/sample-tag/config.tsx @@ -1,4 +1,5 @@ import type { ProColumns } from '@ant-design/pro-components'; +import { Tag } from 'antd'; import GroupTagSelect from '@/components/GroupTag/GroupTagSelect'; import { type AiSampleRespVO, @@ -15,13 +16,32 @@ export const baseTenantColumns: ProColumns[] = [ { title: '样本名称', dataIndex: 'sampleName', - // width: 500, + width: 200, + ellipsis: true, + }, + { + title: '文件格式', + width: 100, + dataIndex: 'sampleMineType', + }, + { + title: '标签', + dataIndex: 'tags', + width: 200, + hideInSearch: true, + render: (_, record) => { + return record.tags?.map((tag) => { + return {tag.tagName}; + }); + }, }, { title: '注释', + width: 100, dataIndex: 'remark', hideInSearch: true, }, + { title: '标签', hideInTable: true, @@ -57,11 +77,6 @@ export const baseTenantColumns: ProColumns[] = [ ); }, }, - { - title: '样本格式', - hideInTable: true, - dataIndex: 'sample_mine_type', - }, ]; // export const formColumns = (data: { diff --git a/src/pages/ai/sample-tag/detail.tsx b/src/pages/ai/sample-tag/detail.tsx index 040b6f8..0155abc 100644 --- a/src/pages/ai/sample-tag/detail.tsx +++ b/src/pages/ai/sample-tag/detail.tsx @@ -20,6 +20,8 @@ import { deleteSampleTag, deleteSampleTagGroup, deleteSampleTagRelate, + downloadSample, + downloadZipFile, getSampleTagGroup, getSampleTagPage, relateSample, @@ -123,7 +125,22 @@ const SampleTagDetail = >( }; // 下载 - const handleDownloadAll = () => {}; + 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 = () => { setTagManagerVisible(true); @@ -158,6 +175,16 @@ const SampleTagDetail = >( setTagManagerVisible(false); }; + const onDownload = () => { + const item = data?.[0]; + const link = document.createElement('a'); + link.href = item?.sampleFilePath; + link.download = item?.sampleName; // 设置下载的文件名 + link.style.display = 'none'; + document.body.appendChild(link); + link.click(); + document.body.removeChild(link); + }; return ( <> @@ -312,7 +339,7 @@ const SampleTagDetail = >( onCancel={() => setTagManagerVisible(false)} > -