import React, { Component } from 'react'
import TdReact from 'td-react-2.0'
const UserSelect = TdReact.UserSelect
const UserSelectSingle = TdReact.UserSelectSingle //选人

class UserSelectField extends Component {
	render() {
		let {
			value,
			type_of_data
		} = this.props
		
		if(type_of_data === 'db'){
			value = value && value instanceof Object === true? value : {}
			return (<UserSelectSingle data={value} module_id={'bi'} onChange={(data)=> this.props.onChange(data)} />)
		}else{
			value = value && value instanceof Array === true ? value : []
			return (
				<UserSelect
					data={value}
					module_id={'bi'}
					onChange={(data)=> this.props.onChange([...data])} />
			)
		}
	}
}

export default UserSelectField
