import React from 'react'
import { Row, Col, Card, Tree, DatePicker, Radio,Form, Select, Input,InputNumber, Button } from 'antd';


import ImageUpload from '@/components/XForm/ImageUpload';

const { Option } = Select;
const FormItem = Form.Item;
const {RangePicker}=DatePicker

const formItemLayout = {
    labelCol: { span: 6 },
    wrapperCol: { span: 14 },
};

class TreedataFrom extends React.Component {
  handleSubmit = e => {
    e.preventDefault();
    this.props.form.validateFields((err, values) => {
      if (!err) {
        console.log('Received values of form: ', values);
      }
    });
  };

  handleSelectChange = value => {
    console.log(value);
    this.props.form.setFieldsValue({
      note: `Hi, ${value === 'male' ? 'man' : 'lady'}!`,
    });
  };

  render() {
    const { getFieldDecorator } = this.props.form;
    return (
      <Form {...formItemLayout} onSubmit={this.handleSubmit}>
        <FormItem label="照片" help="建议尺寸：750px*600px，比例5:4，格式：jpg，用于：列表和详情">
          {
            getFieldDecorator('curriculumImg', {
              rules: [
                { required: true, message: '请上传照片' }
              ]
            })(
              <ImageUpload />
            )
          }
        </FormItem>
        <FormItem label="姓名">
          {getFieldDecorator('note', {
            rules: [{ required: true, message: '请输入姓名!' }],
          })(<Input />)}
        </FormItem>
        <FormItem label="年龄" >
           {
            getFieldDecorator('weight', {
              rules: [{ required: true, message: '请输入年龄' }]
            })(
              <InputNumber min='18' />
            )
          }
        </FormItem>
        <FormItem label="性别">
          {
            getFieldDecorator('type', {
              rules: [
                { required: true, message: '请选择性别' }
              ]
            })(
              <Radio.Group  style={{ width: '500px' }} defaultValue={1}>
                {/* onChange={e => setContentType(e.target.value)} */}
                <Radio value={1}>男</Radio>
                <Radio value={2}>女</Radio>
              </Radio.Group>
            )
          }
        </FormItem>
        <FormItem label="工作总时间" style={{ marginBottom: 0 }} help="如未离职,结束日期和开始日期一样即可">
          <FormItem style={{ display: 'inline-block' }} >
            <RangePicker style={{width: '255px'}}/>
          </FormItem>
        </FormItem>
        <FormItem label="Gender">
          {getFieldDecorator('gender', {
            rules: [{ required: true, message: 'Please select your gender!' }],
          })(
            <Select
              placeholder="Select a option and change input text above"
              onChange={this.handleSelectChange}
            >
              <Option value="male">male</Option>
              <Option value="female">female</Option>
            </Select>,
          )}
        </FormItem>
        <FormItem wrapperCol={{ span: 12, offset: 5 }}>
          <Button type="primary" htmlType="submit">
            Submit
          </Button>
        </FormItem>
      </Form>
    );
  }
}


TreedataFrom = Form.create({})(TreedataFrom);

export default TreedataFrom




// import React from 'react'

// class Hello extends React.Component{
//     render(){
//         return<h1>asdasdasdas</h1>
//     }
// }


// export default Hello