import { useEffect, useState } from 'react'; import { Select } from 'antd'; import { getCooperativeList, getCooperativeDetail } from '@/services/cooperative'; const Option = Select.Option; export default (props) => { const { value, onChange, ...otherProps } = props; const [list, setList] = useState([]); const searchData = (val) => { getCooperativeList({ name: val, pageSize: 9999 }).then((res) => { setList(res.records || []); }); }; const handleSearch = (text) => { if (text) { searchData(text); } }; useEffect(() => { if (value) { getCooperativeDetail(value).then((res) => { setList([res]); }); } }, [value]); return ( ); };