import React, { Component } from 'react'
import TdReact from 'td-react-2.0'
const DeptSelect = TdReact.DeptSelect
const DeptSelectSingle = TdReact.DeptSelectSingle //选部门

class DeptSelectField extends Component {
	render() {
		let {
			value,
			type_of_data
		} = this.props

		if(type_of_data === 'db'){
			value = value && value instanceof Object === true? value : {}
			return (<DeptSelectSingle data={value} module_id={'bi'} onChange={(data)=> this.props.onChange(data)} />)
		}else{
			value = value && value instanceof Array === true ? value : []
			return (
				<DeptSelect
					data={value}
					module_id={'bi'}
					onChange={(data)=> this.props.onChange([...data])} />
			)
		}
	}
}

export default DeptSelectField
