index.js 716 B

1234567891011121314151617181920212223242526272829
  1. import React from 'react';
  2. import { message, Select } from 'antd';
  3. import { connect } from 'dva';
  4. const { Option } = Select;
  5. function InnerContactField(props) {
  6. const { value, userList, onChange } = props;
  7. return (
  8. <Select
  9. showSearch
  10. onChange={value => {
  11. onChange(String(value));
  12. // onChange(JSON.stringify([value]));
  13. }}
  14. filterOption={(input, option) => option.children.toLowerCase().includes(input.toLowerCase())}
  15. >
  16. {(userList || []).map(item => (
  17. <Option key={item.ID} value={item.ID}>
  18. {item.CName}
  19. </Option>
  20. ))}
  21. </Select>
  22. );
  23. }
  24. export default connect(({ user }) => ({
  25. userList: user.list,
  26. }))(InnerContactField);