import React from 'react';
import { Select, Input, Row, Col } from'antd';
import _ from'underscore';
import'./index.less';
const Option=Select.Option;
const uiPrefix= "certificate-field"class CertificateField extends React.Component {
constructor(props) {
super(props);this.state ={
yearlists: [],//时间下拉框列表
cities: [],//城市下拉框列表
years: undefined,
cityId: undefined,
warrantNumber: undefined,
};
}
static defaultProps={
cities: [],
yearlists: [],
hasYear:true,
hasCity:true,
readonly:true,
hasWarrantNum:true,
years: (newDate()).getFullYear(),
cityId:1,
}
getStateFromProps(props) {
let { value= {} } =props;return { ...this.parseDataFromInput(value) };
}
parseDataFromInput(value) {
let { years, cityId, warrantNumber }=value;
years= years ? ('' +years) : undefined;
cityId= cityId ? ('' +cityId) : undefined;
warrantNumber= warrantNumber ? ('' +warrantNumber) : undefinedreturn{ years, cityId, warrantNumber };
}
onBlur= () =>{
let { years, cityId, warrantNumber }= this.state;
let yearlistsName= this.getTextFromValue("yearlist");
let citieName= this.getTextFromValue("citie");
const { onBlur }= this.props;if(onBlur) {
const {
hasYear,
hasCity,
hasWarrantNum,
}= this.props;</