Feat: Filter document by running status and file type. #3221 (#7340)

### What problem does this PR solve?
Feat: Filter document by running status and file type. #3221

### Type of change


- [x] New Feature (non-breaking change which adds functionality)
This commit is contained in:
balibabu
2025-04-27 14:39:05 +08:00
committed by GitHub
parent dadd8d9f94
commit bdebd1b2e3
17 changed files with 392 additions and 76 deletions

View File

@ -1,3 +1,4 @@
import { useHandleFilterSubmit } from '@/components/list-filter-bar/use-handle-filter-submit';
import {
IKnowledge,
IKnowledgeResult,
@ -72,8 +73,8 @@ export const useTestRetrieval = () => {
export const useFetchNextKnowledgeListByPage = () => {
const { searchString, handleInputChange } = useHandleSearchChange();
const { pagination, setPagination } = useGetPaginationWithRouter();
const [ownerIds, setOwnerIds] = useState<string[]>([]);
const debouncedSearchString = useDebounce(searchString, { wait: 500 });
const { filterValue, handleFilterSubmit } = useHandleFilterSubmit();
const { data, isFetching: loading } = useQuery<IKnowledgeResult>({
queryKey: [
@ -81,7 +82,7 @@ export const useFetchNextKnowledgeListByPage = () => {
{
debouncedSearchString,
...pagination,
ownerIds,
filterValue,
},
],
initialData: {
@ -97,7 +98,7 @@ export const useFetchNextKnowledgeListByPage = () => {
page: pagination.current,
},
{
owner_ids: ownerIds,
owner_ids: filterValue.owner,
},
);
@ -113,11 +114,6 @@ export const useFetchNextKnowledgeListByPage = () => {
[handleInputChange],
);
const handleOwnerIdsChange = useCallback((ids: string[]) => {
// setPagination({ page: 1 }); // TODO: 这里导致重复请求
setOwnerIds(ids);
}, []);
return {
...data,
searchString,
@ -125,8 +121,8 @@ export const useFetchNextKnowledgeListByPage = () => {
pagination: { ...pagination, total: data?.total },
setPagination,
loading,
setOwnerIds: handleOwnerIdsChange,
ownerIds,
filterValue,
handleFilterSubmit,
};
};