瀏覽代碼

创建人查询

CzRger 2 月之前
父節點
當前提交
21807b05ae

+ 24 - 3
web/app/(commonLayout)/apps/Apps.tsx

@@ -41,6 +41,7 @@ const getKey = (
   keywords: string,
   dept: string,
   authType: number,
+  creator: string,
 ) => {
   if (!pageIndex || previousPageData.has_more) {
     const params: any = { url: 'apps', params: { page: pageIndex + 1, limit: 30, name: keywords, is_created_by_me: isCreatedByMe } }
@@ -53,9 +54,11 @@ const getKey = (
     if (tags.length)
       params.params.tag_ids = tags
     if (dept)
-      params.params.creatorDept = dept
+      params.params.creator_dept = dept
     if (authType)
-      params.params.authType = authType
+      params.params.auth_type = authType
+    if (creator)
+      params.params.creator = creator
     return params
   }
   return null
@@ -95,8 +98,17 @@ const Apps = () => {
     { name: '授权编辑', value: '3' },
     { name: '授权可见', value: '4' },
   ]
+  const [creator, setCreator] = useState('')
+  const [searchCreator, setSearchCreator] = useState('')
+  const { run: handleSearchCreator } = useDebounceFn(() => {
+    setSearchCreator(creator)
+  }, { wait: 500 })
+  const handleCreatorChange = (value: string) => {
+    setCreator(value)
+    handleSearchCreator()
+  }
   const { data, isLoading, setSize, mutate } = useSWRInfinite(
-    (pageIndex: number, previousPageData: AppListResponse) => getKey(pageIndex, previousPageData, activeTab, isCreatedByMe, tagIDs, searchKeywords, dept, authType),
+    (pageIndex: number, previousPageData: AppListResponse) => getKey(pageIndex, previousPageData, activeTab, isCreatedByMe, tagIDs, searchKeywords, dept, authType, searchCreator),
     fetchAppList,
     { revalidateFirstPage: true },
   )
@@ -168,6 +180,15 @@ const Apps = () => {
           options={options}
         />
         <div className='flex items-center gap-2'>
+          <Input
+            showLeftIcon
+            showClearIcon
+            wrapperClassName='w-[200px]'
+            value={creator}
+            onChange={e => handleCreatorChange(e.target.value)}
+            onClear={() => handleCreatorChange('')}
+            placeholder="请输入创建人"
+          />
           <SimpleSelect
             wrapperClassName="h-[32px] w-[200px]"
             defaultValue={authType}

+ 1 - 0
web/app/(commonLayout)/apps/hooks/useAppsQueryState.ts

@@ -4,6 +4,7 @@ import { useCallback, useEffect, useMemo, useState } from 'react'
 type AppsQuery = {
   tagIDs?: string[]
   keywords?: string
+  creator?: string
   isCreatedByMe?: boolean
 }
 

+ 21 - 1
web/app/(commonLayout)/datasets/Container.tsx

@@ -68,6 +68,17 @@ const Container = () => {
     setKeywords(value)
     handleSearch()
   }
+
+  const [creator, setCreator] = useState('')
+  const [searchCreator, setSearchCreator] = useState('')
+  const { run: handleSearchCreator } = useDebounceFn(() => {
+    setSearchCreator(creator)
+  }, { wait: 500 })
+  const handleCreatorChange = (value: string) => {
+    setCreator(value)
+    handleSearchCreator()
+  }
+
   const [tagFilterValue, setTagFilterValue] = useState<string[]>([])
   const [tagIDs, setTagIDs] = useState<string[]>([])
   const { run: handleTagsUpdate } = useDebounceFn(() => {
@@ -127,6 +138,15 @@ const Container = () => {
         />
         {activeTab === 'dataset' && (
           <div className='flex items-center justify-center gap-2'>
+            <Input
+              showLeftIcon
+              showClearIcon
+              wrapperClassName='w-[200px]'
+              value={creator}
+              onChange={e => handleCreatorChange(e.target.value)}
+              onClear={() => handleCreatorChange('')}
+              placeholder="请输入创建人"
+            />
             <SimpleSelect
               wrapperClassName="h-[32px] w-[200px]"
               defaultValue={authType}
@@ -191,7 +211,7 @@ const Container = () => {
       </div>
       {activeTab === 'dataset' && (
         <>
-          <Datasets containerRef={containerRef} tags={tagIDs} keywords={searchKeywords} includeAll={includeAll} type={searchType} dept={dept} authType={authType} />
+          <Datasets containerRef={containerRef} tags={tagIDs} keywords={searchKeywords} includeAll={includeAll} type={searchType} dept={dept} authType={authType} creator={searchCreator} />
           <DatasetFooter />
           {showTagManagementModal && (
             <TagManagementModal type='knowledge' show={showTagManagementModal} />

+ 6 - 1
web/app/(commonLayout)/datasets/Datasets.tsx

@@ -19,6 +19,7 @@ const getKey = (
   type: string,
   dept: string,
   authType: string,
+  creator: string,
 ) => {
   if (!pageIndex || previousPageData.has_more) {
     const params: FetchDatasetsParams = {
@@ -39,6 +40,8 @@ const getKey = (
       params.params.creatorDept = dept
     if (authType)
       params.params.authType = authType
+    if (creator)
+      params.params.creator = creator
     return params
   }
   return null
@@ -52,6 +55,7 @@ type Props = {
   type: string,
   dept: string,
   authType: string,
+  creator: string,
 }
 
 const Datasets = ({
@@ -62,10 +66,11 @@ const Datasets = ({
   type,
   dept,
   authType,
+  creator,
 }: Props) => {
   const { isCurrentWorkspaceEditor } = useAppContext()
   const { data, isLoading, setSize, mutate } = useSWRInfinite(
-    (pageIndex: number, previousPageData: DataSetListResponse) => getKey(pageIndex, previousPageData, tags, keywords, includeAll, type, dept, authType),
+    (pageIndex: number, previousPageData: DataSetListResponse) => getKey(pageIndex, previousPageData, tags, keywords, includeAll, type, dept, authType, creator),
     fetchDatasets,
     { revalidateFirstPage: false, revalidateAll: true },
   )