import React, { Component } from 'react'
import TdReact from 'td-react-2.0'
const PrivSelect = TdReact.PrivSelect
const PrivSelectSingle = TdReact.PrivSelectSingle //选角色

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

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

export default PrivSelectField
