import {InputNumber, Modal, Icon} from 'antd'; import isEmpty from 'lodash/isEmpty'; import isArray from 'lodash/isArray' import {WeaDatePicker,WeaTimePicker} from "ecCom" import equals from 'deep-equal' class Main extends React.Component { constructor(props){ super(props) this.state={ dateValue: '', timeValue: '' } if (!isEmpty(props.value)) { if (props.value[0]) this.state.dateValue = props.value[0]; if (props.value[1]) this.state.timeValue = props.value[1]; } } componentWillReceiveProps(nextProps){ if (!equals(this.props.value,nextProps.value)) { let dateValue = '', timeValue = ''; if (!isEmpty(nextProps.value)) { dateValue = nextProps.value[0]; timeValue = nextProps.value[1]; } this.setState({dateValue, timeValue}); } } onChangeDate(value) { this.setState({dateValue: value}); const {timeValue = ''} = this.state; this.props.onChange && this.props.onChange([value, timeValue]); } onChangeTime(value) { this.setState({timeValue: value}); const {dateValue = ''} = this.state; this.props.onChange && this.props.onChange([dateValue, value]); } render(){ const {dateValue, timeValue, } = this.state; const {viewAttr,otherParams,startValue="",endValue="",isTimeShow='1',type,domkey}=this.props; let name = domkey&&domkey[0]; let timename = ''; if(name==='begindate'){ timename ='begintime'; }else if(name==='enddate'){ timename ='endtime'; }else if(name==='actualbegindate'){ timename ='actualbegintime'; }else if(name==='actualenddate'){ timename ='actualendtime'; } return(