| | |
| | | class QuarterPicker extends Component { |
| | | static propTpyes = { |
| | | dict: PropTypes.object, // 字典项 |
| | | card: PropTypes.object, // 搜索配置 |
| | | onChange: PropTypes.func |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | UNSAFE_componentWillMount () { |
| | | const { year } = this.state |
| | | const { card } = this.props |
| | | const { selectYear } = this.state |
| | | let year = this.state.year |
| | | |
| | | if (card.initval && card.initval[0]) { |
| | | let _type = card.initval[0] |
| | | let _val = parseInt(card.initval[1]) |
| | | |
| | | if (_type === 'year' && _val) { |
| | | this.setState({selectYear: selectYear - _val}) |
| | | year = Math.floor((selectYear - _val) / 10) * 10 |
| | | } |
| | | } |
| | | |
| | | this.setState({ |
| | | yearlist: [ |
| | |
| | | [{value: year + 2, type: ''}, {value: year + 3, type: ''}, {value: year + 4, type: ''}], |
| | | [{value: year + 5, type: ''}, {value: year + 6, type: ''}, {value: year + 7, type: ''}], |
| | | [{value: year + 8, type: ''}, {value: year + 9, type: ''}, {value: year + 10, type: 'down'}], |
| | | ] |
| | | ], |
| | | year |
| | | }) |
| | | } |
| | | |