1234567891011121314151617181920212223242526272829 |
- import { TreeSelect } from 'antd';
- import { connect } from 'dva';
- function DepartmentField(props) {
- const { value, onChange, depUserTree } = props;
- const onChangeValue = newValue => {
- let dep = depUserTree.find(dep => dep.id == newValue);
- onChange(String(dep?.ID));
- };
- return (
- <TreeSelect
- showSearch
- multiple
- allowClear
- dropdownStyle={{
- maxHeight: 400,
- overflow: 'auto',
- }}
- style={{ width: '100%' }}
- placeholder="请选择部门"
- treeData={depUserTree}
- onChange={onChangeValue}
- />
- );
- }
- export default connect(({ user }) => ({ depUserTree: user.depUserTree }))(DepartmentField);
|