import React, { Component } from "react";
import { Select, } from "antd";

/**
 * 驳回位置选择
 */

class SelectReject extends Component {
  constructor(props) {
    super(props);
    this.state = {
      selValue: 0,
      // 0 退单退款
      theArr0: [
        { value: 0, lable: "营销员", },
        { value: 1, lable: "营销经理", },
        { value: 2, lable: "营销管理员", },
        { value: 3, lable: "技术员", },
        { value: 4, lable: "技术经理", },
        { value: 5, lable: "技术总监", },
        { value: 6, lable: "财务专员", },
        { value: 7, lable: "财务总监", },
        { value: 8, lable: "公司/部门管理", },
        { value: 9, lable: "董事长", },
      ],
      // 1 项目&金额
      theArr1: [
        { value: 0, lable: "营销员", },
        { value: 1, lable: "营销经理", },
        { value: 2, lable: "营销管理员", },
        { value: 3, lable: "技术员", },
        { value: 4, lable: "技术经理", },
        { value: 5, lable: "技术总监", },
        { value: 6, lable: "财务专员", },
        { value: 7, lable: "财务总监", },
        { value: 8, lable: "公司/部门管理", },
      ],
      // 2 仅项目
      theArr2: [
        { value: 0, lable: "营销员", },
        { value: 1, lable: "营销经理", },
        { value: 2, lable: "营销管理员", },
        { value: 3, lable: "技术员", },
        { value: 4, lable: "技术经理", },
        { value: 5, lable: "技术总监", },
        { value: 6, lable: "财务专员", },
        { value: 7, lable: "财务总监", },
        { value: 8, lable: "公司/部门管理", },
      ],
      // 3 仅金额
      theArr3: [
        { value: 0, lable: "营销员", },
        { value: 1, lable: "营销经理", },
        { value: 2, lable: "营销管理员", },
        { value: 5, lable: "技术总监", },
        { value: 6, lable: "财务专员", },
        { value: 7, lable: "财务总监", },
        { value: 8, lable: "公司/部门管理", },
      ],
      // 4 重报
      theArr4: [
        { value: 0, lable: "营销员", },
        { value: 1, lable: "营销经理", },
        { value: 2, lable: "营销管理员", },
        { value: 3, lable: "技术员", },
        { value: 4, lable: "技术经理", },
        { value: 6, lable: "财务专员", },
        { value: 7, lable: "财务总监", },
        { value: 8, lable: "公司/部门管理", },
      ],
      // 5 赠送
      theArr5: [
        { value: 0, lable: "营销员", },
        { value: 1, lable: "营销经理", },
        { value: 2, lable: "营销管理员", },
        { value: 6, lable: "财务专员", },
        { value: 8, lable: "公司/部门管理", },
      ],
      // 6 退单不退款
      theArr6: [
        { value: 0, lable: "营销员", },
        { value: 1, lable: "营销经理", },
        { value: 2, lable: "营销管理员", },
        { value: 3, lable: "技术员", },
        { value: 4, lable: "技术经理", },
        { value: 5, lable: "技术总监", },
        { value: 6, lable: "财务专员", },
        { value: 7, lable: "财务总监", },
        { value: 8, lable: "公司/部门管理", },
      ],
      // 7 仅变更合同
      theArr7: [
        { value: 0, lable: "营销员", },
        { value: 2, lable: "营销管理员", },
      ],
      // 8 框架协议
      theArr8: [
        { value: 0, lable: "营销员", },
        { value: 1, lable: "营销经理", },
        { value: 2, lable: "营销管理员", },
        { value: 6, lable: "财务专员", },
      ],
    };
    this.onChange = this.onChange.bind(this);
  }


  componentDidMount() {

  }

  componentWillUnmount() {

  }

  componentWillReceiveProps(nextProps) {

  }


  onChange(e) {
    const { onSelect } = this.props
    this.setState({
      selValue: e
    })
    onSelect(e)
  }

  render() {
    const { selValue, theArr0, theArr1, theArr2, theArr3, theArr4, theArr5, theArr6, theArr7, theArr8 } = this.state
    const { processState, type } = this.props
    const opList = type == 0
      ? theArr0 : type == 1
        ? theArr1 : type == 2
          ? theArr2 : type == 3
            ? theArr3 : type == 4
              ? theArr4 : type == 5
                ? theArr5 : type == 6
                  ? theArr6 : type == 7
                    ? theArr7 : type == 8 && theArr8
    return (
      opList.length > 0 &&
      <Select
        value={selValue}
        style={{ width: 120 }}
        onChange={this.onChange}
      >
        {
          opList.map(item =>
            <Option
              value={item.value}
              key={item.value}
              style={{ display: processState > item.value ? "block" : "none", }}
            >{item.lable}</Option>
          )
        }
      </Select>
    );
  }
}

export default SelectReject;