import React, { Component } from "react";
import { Form, Button, Radio, Modal, Input, message, Switch } from "antd";
import { knowledgeList, auditList, addDeductionList, } from "@/dataDic.js";

/**
 * 知识产权
 */

const RadioButton = Radio.Button;
const RadioGroup = Radio.Group;
const radioStyle = {
  display: 'block',
  height: '30px',
  lineHeight: '30px',
};


const FormItem = Form.Item;
class Property extends Component {
  constructor(props) {
    super(props);
    this.state = {

    }
  }


  componentDidMount() {
  }

  componentWillUnmount() {

  }

  componentWillReceiveProps(nextProps) {
    // const { patentStatus } = this.props
    // if (patentStatus != null) {
    //   this.setState({
    //     isProperty: 1,
    //   })
    // }
  }




  render() {
    const { isCreat = false, isProperty, patentStatus } = this.props
    return (
      <div>
        {
          // 是否可编辑
          isCreat ?
            <div className="clearfix">
              <div className="clearfix">
                <FormItem
                  labelCol={{ span: 5 }}
                  wrapperCol={{ span: 16 }}
                  label={
                    <span>
                      <strong style={{ color: "#f00" }}>*</strong>
                      知识产权情况
                    </span>
                  }
                >
                  <div>
                    <div>
                      <RadioGroup
                        value={isProperty}
                        onChange={e => {
                          this.props.setProperty(e.target.value)
                        }}>
                        <RadioButton value={1}>纯知识产权合同</RadioButton>
                        <RadioButton value={2}>非知识产权合同</RadioButton>
                      </RadioGroup>
                    </div>
                    {
                      isProperty == 2 &&
                      <div style={{ marginTop: 10 }}>
                        <RadioGroup
                          value={patentStatus}
                          onChange={e => {
                            this.props.setPatentS(e.target.value)
                          }}>
                          <Radio value={1}>客户自己完成</Radio>
                          <Radio value={2}>非客户自己完成</Radio>
                        </RadioGroup>
                      </div>
                    }
                  </div>
                </FormItem>
              </div>
            </div> : (patentStatus == 0 || patentStatus == 1 || patentStatus == 2) &&
            <div className="clearfix">
              <div className="clearfix">
                <FormItem
                  labelCol={{ span: 5 }}
                  wrapperCol={{ span: 16 }}
                  label={
                    <span>
                      <strong style={{ color: "#f00" }}>*</strong>
                      知识产权情况
                    </span>
                  }
                >
                  <div>
                    <div>
                      <Button type="primary" size="default">
                        {patentStatus != 0 ? "非知识产权合同" : "纯知识产权合同"}
                      </Button>
                    </div>
                    {patentStatus != 0 &&
                      <div>
                        <Button type="primary" size="default">
                          {patentStatus == 2 ? "非客户自己完成" : " 客户自己完成 "}
                        </Button>
                      </div>}
                  </div>
                </FormItem>
              </div>
            </div>
        }
      </div >
    );
  }
}

export default Property;
