| | |
| | | import { useState, useEffect } from 'react'; |
| | | import { |
| | | Button, useListContext, SelectInput, |
| | | required, |
| | | required, SelectArrayInput, |
| | | useTranslate, useNotify |
| | | } from 'react-admin'; |
| | | import request from '@/utils/request'; |
| | | |
| | | const DictionarySelect = (props) => { |
| | | const { dictTypeCode, name, ...parmas } = props; |
| | | const { dictTypeCode, name, multiple = false, ...parmas } = props; |
| | | const translate = useTranslate(); |
| | | const notify = useNotify(); |
| | | const [list, setList] = useState([]) |
| | |
| | | notify(res.data.msg); |
| | | } |
| | | } |
| | | const InputComponent = multiple ? SelectArrayInput : SelectInput; |
| | | |
| | | return ( |
| | | <SelectInput |
| | | <InputComponent |
| | | source={name} |
| | | choices={list} |
| | | |
| | | {...parmas} |
| | | /> |
| | | |
| | | ); |
| | | }; |
| | | |