|
@@ -30,8 +30,9 @@ import { useStore as useTagStore } from '@/app/components/base/tag-management/st
|
|
|
import { useAppContext } from '@/context/app-context'
|
|
|
import { useExternalApiPanel } from '@/context/external-api-panel-context'
|
|
|
import { SimpleSelect } from '@/app/components/base/select'
|
|
|
-import { fetchTypes } from '@/service/common'
|
|
|
+import { fetchDepts, fetchTypes } from '@/service/common'
|
|
|
import Statistic from '@/app/(commonLayout)/datasets/Statistic'
|
|
|
+import { TreeSelect as AntdTreeSelect } from 'antd'
|
|
|
|
|
|
const Container = () => {
|
|
|
const { t } = useTranslation()
|
|
@@ -103,6 +104,19 @@ const Container = () => {
|
|
|
setOptionsType(res.data.map((v: any) => ({ name: v.name, value: v.id })) || [])
|
|
|
})
|
|
|
}, [])
|
|
|
+ const [dept, setDept] = useState<any>()
|
|
|
+ const [optionsDept, setOptionsDept] = useState<any>([])
|
|
|
+ useEffect(() => {
|
|
|
+ fetchDepts({
|
|
|
+ url: '/xxx',
|
|
|
+ params: {
|
|
|
+ page: 1,
|
|
|
+ limit: 1000,
|
|
|
+ },
|
|
|
+ }).then((res: any) => {
|
|
|
+ setOptionsDept(res.data || [])
|
|
|
+ })
|
|
|
+ }, [])
|
|
|
return (
|
|
|
<div ref={containerRef} className='scroll-container relative flex grow flex-col overflow-y-auto bg-background-body'>
|
|
|
<div className='sticky top-0 z-10 flex flex-wrap justify-between gap-y-2 bg-background-body px-12 pb-2 pt-4 leading-[56px]'>
|
|
@@ -113,6 +127,18 @@ const Container = () => {
|
|
|
/>
|
|
|
{activeTab === 'dataset' && (
|
|
|
<div className='flex items-center justify-center gap-2'>
|
|
|
+ <AntdTreeSelect
|
|
|
+ showSearch
|
|
|
+ style={{ width: '200px' }}
|
|
|
+ value={dept}
|
|
|
+ dropdownStyle={{ maxHeight: 400, overflow: 'auto' }}
|
|
|
+ placeholder="请选择部门"
|
|
|
+ allowClear
|
|
|
+ treeDefaultExpandAll
|
|
|
+ onChange={v => setDept(v || '')}
|
|
|
+ treeData={optionsDept}
|
|
|
+ fieldNames={{ label: 'name', value: 'id' }}
|
|
|
+ />
|
|
|
<SimpleSelect
|
|
|
wrapperClassName="h-[32px] w-[200px]"
|
|
|
defaultValue={type}
|
|
@@ -154,7 +180,7 @@ const Container = () => {
|
|
|
</div>
|
|
|
{activeTab === 'dataset' && (
|
|
|
<>
|
|
|
- <Datasets containerRef={containerRef} tags={tagIDs} keywords={searchKeywords} includeAll={includeAll} type={searchType} />
|
|
|
+ <Datasets containerRef={containerRef} tags={tagIDs} keywords={searchKeywords} includeAll={includeAll} type={searchType} dept={dept} />
|
|
|
<DatasetFooter />
|
|
|
{showTagManagementModal && (
|
|
|
<TagManagementModal type='knowledge' show={showTagManagementModal} />
|