import {Modal, ModalSelect} from '@components'; import {FC, useEffect} from 'react'; import {useFormState} from './hooks'; import {useDictionaryWidthCode} from '@hooks'; type Props = { visible: boolean; onClose: () => void; onFetch: () => void; id: string; code: string; softwareCode: string; }; const PutModal: FC = function({ visible, onClose, onFetch, id, code, softwareCode, }) { const [{data: materialOptions, isFetching}, onMaterialSearch] = useDictionaryWidthCode( '物料字典', {findValue: state => state.code}, ); const [ {data: SearviceMaterialOptions, isFetching: searviceMaterialFetching}, onServiceMaterialSearch, ] = useDictionaryWidthCode( '物料字典', {findValue: state => state.code}, ); useEffect( function() { onMaterialSearch(code); onServiceMaterialSearch(softwareCode); }, [code, onMaterialSearch, onServiceMaterialSearch, softwareCode], ); const [ {control, isLoading}, {onSubmit}, ] = useFormState({ visible, id, onFetch, onClose, code, softwareCode, }); return ( ); }; export default PutModal;