import {
  getparameter
} from "@/api/system/dictionary.js"
export default {
  data() {
    return {
      // 自定义表单的 固定字段
      defaultFormList: [{
        name: '姓名',
        field: 'username',
        rule: 'required',
        edit_input: "text",
        help: '请输入姓名',
        need_fill: 0,
        belong_user: 1,
        belong_user_table: 'username'
      }, {
        name: '性别',
        field: 'sex',
        rule: 'required',
        edit_input: "radio",
        help: '请选择性别',
        select_item: [{
          key: '男',
          value: '男'
        }, {
          key: '女',
          value: '女'
        }],
        need_fill: 0,
        belong_user: 1,
        belong_user_table: 'sex'
      }, {
        name: '出生年月',
        field: 'birthday',
        rule: '',
        edit_input: "date",
        help: '请选择出生年月',
        need_fill: 0,
        belong_user: 1,
        belong_user_table: 'birthday'
      }, {
        name: '联系方式',
        field: 'mobile',
        rule: 'required',
        edit_input: "text",
        help: '请输入联系方式',
        need_fill: 0,
        belong_user: 1,
        belong_user_table: 'mobile'
      }, {
        name: '身份证号',
        field: 'idcard',
        rule: 'idcard',
        edit_input: "text",
        help: '请输入身份证号',
        need_fill: 0,
        belong_user: 1,
        select_item: [],
        is_open: false,
        belong_user_table: 'idcard'
      }, {
        name: '学历',
        field: 'education',
        rule: '',
        edit_input: "radio",
        help: '请选择学历',
        need_fill: 0,
        belong_user: 1,
        select_item: [],
        is_open: false,
        belong_user_table: 'education'
      }, {
        name: '公司名称',
        field: 'company_name',
        rule: '',
        edit_input: "text",
        help: '请输入公司名称',
        need_fill: 0,
        belong_user: 1,
        belong_user_table: 'company_name'
      }, {
        name: '职务',
        field: 'company_position',
        rule: '',
        edit_input: "text",
        help: '请输入职务',
        need_fill: 0,
        belong_user: 1,
        belong_user_table: 'company_position'
      }, {
        name: '有无股份',
        field: 'company_has_share',
        rule: '',
        edit_input: "radio",
        help: '请选择有无股份',
        need_fill: 0,
        belong_user: 1,
        select_item: [{
          key: '有',
          value: '有'
        }, {
          key: '无',
          value: '无'
        }],
        is_open: false,
        belong_user_table: 'company_has_share'
      }, {
        name: '人才类型',
        field: 'type',
        rule: '',
        edit_input: "radio",
        help: '请选择人才类型',
        need_fill: 0,
        belong_user: 1,
        select_item: [],
        is_open: false,
        belong_user_table: 'type'
      }, {
        name: '企业性质',
        field: 'company_type',
        rule: '',
        edit_input: "checkbox",
        help: '请选择企业性质',
        need_fill: 0,
        belong_user: 1,
        select_item: [],
        is_open: false, // 控制开启关闭的 参数不做保存
        belong_user_table: 'company_type'
      }, {
        name: '融资情况',
        field: 'company_fund',
        rule: '',
        edit_input: "text",
        help: '请输入融资情况',
        need_fill: 0,
        belong_user: 1,
        belong_user_table: 'company_fund'
      }, {
        name: '所在区域',
        field: 'company_area',
        rule: '',
        edit_input: "radio",
        help: '请选择所在区域',
        need_fill: 0,
        belong_user: 1,
        select_item: [],
        is_open: false,
        belong_user_table: 'company_area'
      }, {
        name: '公司地址',
        field: 'company_address',
        rule: '',
        edit_input: "text",
        help: '请填写公司地址',
        need_fill: 0,
        belong_user: 1,
        select_item: [],
        is_open: false,
        belong_user_table: 'company_address'
      }, {
        name: '所属行业',
        field: 'company_industry',
        rule: '',
        edit_input: "radio",
        help: '请选择所属行业',
        need_fill: 0,
        belong_user: 1,
        select_item: [],
        is_open: false,
        belong_user_table: 'company_industry'
      }, {
        name: '产品',
        field: 'company_product',
        rule: '',
        edit_input: "text",
        help: '请输入产品',
        need_fill: 0,
        belong_user: 1,
        belong_user_table: 'company_product'
      }, {
        name: '毕业院校',
        field: 'school',
        rule: '',
        edit_input: "text",
        help: '请输入产品',
        need_fill: 0,
        belong_user: 1,
        belong_user_table: 'school'
      }, {
        name: '专业',
        field: 'speciality',
        rule: '',
        edit_input: "text",
        help: '请输入专业',
        need_fill: 0,
        belong_user: 1,
        belong_user_table: 'speciality'
      }, {
        name: '海外经验',
        field: 'overseas_experience',
        rule: '',
        edit_input: "text",
        help: '请输入海外经验',
        need_fill: 0,
        belong_user: 1,
        belong_user_table: 'overseas_experience'
      }, {
        name: '报名渠道',
        field: 'sign_from',
        rule: '',
        edit_input: "radio",
        help: '请选择报名渠道',
        need_fill: 0,
        belong_user: 1,
        belong_user_table: 'sign_from'
      }, {
        name: '邮箱',
        field: 'email',
        rule: '',
        edit_input: "text",
        help: '请输入邮箱',
        need_fill: 0,
        belong_user: 1,
        belong_user_table: 'email'
      }],
      // 自定义表单的 扩展字段 可填可不填
      selectFormList: [{
        name: '姓名',
        field: 'username',
        rule: 'required',
        edit_input: "text",
        help: '请输入姓名',
        need_fill: 0,
        belong_user: 1,
        belong_user_table: 'username',
        sort: 0,
      }, {
        name: '性别',
        field: 'sex',
        rule: 'required',
        edit_input: "radio",
        help: '请选择性别',
        select_item: [{
          key: '男',
          value: '男'
        }, {
          key: '女',
          value: '女'
        }],
        need_fill: 0,
        belong_user: 1,
        belong_user_table: 'sex',
        sort: 0,
      }, {
        name: '出生年月',
        field: 'birthday',
        rule: '',
        edit_input: "date",
        help: '请选择出生年月',
        need_fill: 0,
        belong_user: 1,
        belong_user_table: 'birthday',
        sort: 0,
      }, {
        name: '联系方式',
        field: 'mobile',
        rule: 'required',
        edit_input: "text",
        help: '请输入联系方式',
        need_fill: 0,
        belong_user: 1,
        belong_user_table: 'mobile',
        sort: 0,
      }, {
        name: '身份证号',
        field: 'idcard',
        rule: 'idcard',
        edit_input: "text",
        help: '请输入身份证号',
        need_fill: 0,
        belong_user: 1,
        select_item: [],
        is_open: false,
        belong_user_table: 'idcard',
        sort: 0,
      }, {
        name: '学历',
        field: 'education',
        rule: '',
        edit_input: "radio",
        help: '请选择学历',
        need_fill: 0,
        belong_user: 1,
        select_item: [],
        is_open: false,
        belong_user_table: 'education',
        sort: 0,
      }, {
        name: '公司',
        field: 'company_name',
        rule: '',
        edit_input: "text",
        help: '请输入公司',
        need_fill: 0,
        belong_user: 1,
        belong_user_table: 'company_name',
        sort: 0,
        span: 2
      }, {
        name: '职务',
        field: 'company_position',
        rule: '',
        edit_input: "text",
        help: '请输入职务',
        need_fill: 0,
        belong_user: 1,
        belong_user_table: 'company_position',
        sort: 0,
      }, {
        name: '股份',
        field: 'company_has_share',
        rule: '',
        edit_input: "radio",
        help: '请选择有无股份',
        need_fill: 0,
        belong_user: 1,
        select_item: [{
          key: '有',
          value: '有'
        }, {
          key: '无',
          value: '无'
        }],
        is_open: false,
        belong_user_table: 'company_has_share',
        sort: 0,
      }, {
        name: '人才类别',
        field: 'type',
        rule: '',
        edit_input: "radio",
        help: '请选择人才类别',
        need_fill: 0,
        belong_user: 1,
        select_item: [],
        is_open: false,
        belong_user_table: 'type',
        sort: 0,
        span: 2
      }, {
        name: '企业性质',
        field: 'company_type',
        rule: '',
        edit_input: "checkbox",
        help: '请选择企业性质',
        need_fill: 0,
        belong_user: 1,
        select_item: [],
        is_open: false, // 控制开启关闭的 参数不做保存
        belong_user_table: 'company_type',
        sort: 0,
        span: 2
      }, {
        name: '融资情况',
        field: 'company_fund',
        rule: '',
        edit_input: "text",
        help: '请输入融资情况',
        need_fill: 0,
        belong_user: 1,
        belong_user_table: 'company_fund',
        sort: 0,
        span: 2
      }, {
        name: '板块',
        field: 'company_area',
        rule: '',
        edit_input: "radio",
        help: '请选择板块',
        need_fill: 0,
        belong_user: 1,
        select_item: [],
        is_open: false,
        belong_user_table: 'company_area',
        sort: 0,
      }, {
        name: '所属领域',
        field: 'company_industry',
        rule: '',
        edit_input: "radio",
        help: '请选择所属领域',
        need_fill: 0,
        belong_user: 1,
        select_item: [],
        is_open: false,
        belong_user_table: 'company_industry',
        sort: 0,
      }, {
        name: '公司地址',
        field: 'company_address',
        rule: '',
        edit_input: "text",
        help: '请填写公司地址',
        need_fill: 0,
        belong_user: 1,
        is_open: false,
        belong_user_table: 'company_address',
        sort: 0,
        span: 2
      }, {
        name: '产品',
        field: 'company_product',
        rule: '',
        edit_input: "text",
        help: '请输入产品',
        need_fill: 0,
        belong_user: 1,
        belong_user_table: 'company_product',
        sort: 0,
        span: 2
      }, {
        name: '毕业院校',
        field: 'school',
        rule: '',
        edit_input: "text",
        help: '请输入毕业院校',
        need_fill: 0,
        belong_user: 1,
        belong_user_table: 'school',
        sort: 0,
        span: 2
      }, {
        name: '专业',
        field: 'speciality',
        rule: '',
        edit_input: "text",
        help: '请输入专业',
        need_fill: 0,
        belong_user: 1,
        belong_user_table: 'speciality',
        sort: 0,
      }, {
        name: '海外经验',
        field: 'overseas_experience',
        rule: '',
        edit_input: "text",
        help: '请输入海外经验',
        need_fill: 0,
        belong_user: 1,
        belong_user_table: 'overseas_experience',
        sort: 0,
      }, {
        name: '报名渠道',
        field: 'sign_from',
        rule: '',
        edit_input: "radio",
        help: '请选择报名渠道',
        need_fill: 0,
        select_item: [],
        belong_user: 1,
        belong_user_table: 'sign_from',
        sort: 0,
      }, {
        name: '邮箱',
        field: 'email',
        rule: 'email',
        edit_input: "text",
        help: '请输入邮箱',
        need_fill: 0,
        belong_user: 1,
        belong_user_table: 'email',
        sort: 0,
      }, {
        name: '销售额/亿',
        field: 'sales_volume',
        rule: '',
        edit_input: "text",
        help: '请输入销售额/亿',
        need_fill: 0,
        belong_user: 1,
        belong_user_table: 'sales_volume',
        sort: 0,
      }, {
        name: '估值',
        field: 'valuation',
        rule: '',
        edit_input: "text",
        help: '请输入估值',
        need_fill: 0,
        belong_user: 1,
        belong_user_table: 'valuation',
        sort: 0,
      }, {
        name: '市值',
        field: 'market_value',
        rule: '',
        edit_input: "text",
        help: '请输入市值',
        need_fill: 0,
        belong_user: 1,
        belong_user_table: 'market_value',
        sort: 0,
      }, {
        name: '是否为元禾投资企业',
        field: 'is_yuanhe',
        rule: '',
        edit_input: "text",
        help: '请选择',
        need_fill: 0,
        belong_user: 1,
        select_item: [{
          key: '是',
          value: '是'
        }, {
          key: '否',
          value: '否'
        }],
        belong_user_table: 'is_yuanhe',
        sort: 0,
      }],
      sexList: [{
        key: '男',
        value: '男'
      }, {
        key: '女',
        value: '女'
      }],
      shareList: [{
        key: '有',
        value: '有'
      }, {
        key: '无',
        value: '无'
      }],
      yuanheList:[{
        key: '是',
        value: '是'
      }, {
        key: '否',
        value: '否'
      }],
      formSelect: {
        // company_position: [],
        company_type: [],
        company_area: [],
        company_industry: [],
        type: [],
        education: [],
        sign_from: []
      },

    }
  },
  computed: {},
  created() {
    this.getAllPara()
  },
  mounted() {},
  methods: {
    getAllPara() {
      let number = ['company_type', 'company_area', 'company_industry', 'type', 'education',
        'sign_from'
      ]
      getparameter({
        number: number
      }).then(res => {
        // 获取数据字典插入到 select中
        res.map(item => {
          for (var k in this.formSelect) {
            if (item.number === k) {
              this.formSelect[k] = item.detail
            }
          }
        })
        // 数据插入到 selectFormList 的select_item中{key:'',value:''}
        this.selectFormList.map(sform => {
          for (var k in this.formSelect) {
            if (sform.field === k) {
              this.formSelect[k].map(kf => {
                sform.select_item.push({
                  key: kf.value,
                  value: kf.value
                })
              })
            }
          }
        })
        console.log("this.selectFormList123", this.selectFormList)
      })
    }
  },
};
