提交 05606e8e authored 作者: 王鹏飞's avatar 王鹏飞

chore: update

上级 350da781
...@@ -2,6 +2,7 @@ import { useState, useImperativeHandle, forwardRef } from 'react' ...@@ -2,6 +2,7 @@ import { useState, useImperativeHandle, forwardRef } from 'react'
import { Table, Form, Button, Space, Flex } from 'antd' import { Table, Form, Button, Space, Flex } from 'antd'
import type { TableProps } from 'antd' import type { TableProps } from 'antd'
import { useQuery } from '@tanstack/react-query' import { useQuery } from '@tanstack/react-query'
import { debounce } from 'lodash-es'
export interface QueryParams { export interface QueryParams {
[key: string]: any [key: string]: any
...@@ -45,9 +46,9 @@ const AppList = forwardRef<AppListRef, AppListProps>( ...@@ -45,9 +46,9 @@ const AppList = forwardRef<AppListRef, AppListProps>(
// 提交筛选 // 提交筛选
const handleSearch = (values: Record<string, any>) => { const handleSearch = (values: Record<string, any>) => {
console.log(values)
setQueryParams((prev) => ({ ...prev, ...values, page: 1 })) setQueryParams((prev) => ({ ...prev, ...values, page: 1 }))
} }
const handleSearchDebounce = debounce(handleSearch, 500)
const handleReset = () => { const handleReset = () => {
form.resetFields() form.resetFields()
...@@ -71,9 +72,14 @@ const AppList = forwardRef<AppListRef, AppListProps>( ...@@ -71,9 +72,14 @@ const AppList = forwardRef<AppListRef, AppListProps>(
const filterElement = ( const filterElement = (
<div className="app-list-filter" style={{ marginBottom: 20 }}> <div className="app-list-filter" style={{ marginBottom: 20 }}>
<Flex justify="space-between"> <Flex justify="space-between">
<Form layout="inline" autoComplete="off" form={form} onFinish={handleSearch}> <Form
layout="inline"
autoComplete="off"
form={form}
onFinish={handleSearch}
onValuesChange={handleSearchDebounce}>
{filters.map((item, index) => ( {filters.map((item, index) => (
<Form.Item label={item.label} name={item.name} key={index}> <Form.Item label={item.label} name={item.name} key={index} style={{ minWidth: 140 }}>
{item.element} {item.element}
</Form.Item> </Form.Item>
))} ))}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论