import React, { Component } from 'react'; import { connect } from 'dva'; import moment from 'moment'; import { Form, Input, Select, Button, Upload, Icon, Modal, Alert, DatePicker, InputNumber, message } from 'antd'; import style from 'styled-components'; import * as ajax from '../../../services/api'; import PFromUpload from '../../../components/Pro/PFromUpload'; // import styles from './Company.less'; import './Company.less'; import PSelect from '../../../components/Pro/PSelect'; const FormItem = Form.Item; const { Option } = Select; const InputGroup = Input.Group; const { confirm } = Modal; const { TextArea } = Input; const dateFormat = 'YYYY-MM-DD'; @connect(state => ({ profile: state.profile, currentUser: state.user.currentUser.userName, companyInfo: state.global.companyInfo })) @Form.create() /** 企业认证信息 */ export default class Authentication extends Component { constructor(props, context) { super(props, context); this.state = { selectedIdCardType: '', status: '', conf_securityLicenseUrl: '', //行业资质 图片上传 // "comCerUrl":'', // "conf_securityLicenseUrl":"", conf_armedLevel: [], //武装押运守护等级 conf_association: [], //所属行业保安协会 conf_manpowerLevel: [], //人力防范等级 conf_riskLevel: [], //风险评估等级 conf_safeRange: [], //安全范围 conf_safeTechLevel: [], //安全技术防范等级 message: '', loading: false, btnVisible: true, getting: false, //获取验证码,判断是否正在获取中,true,正在获取中 countDown: 60, //倒计时60秒 gettingNoPhone: false, //法人手机号未验证时 countDownNoPhone: 60, //法人手机号未验证时倒计时 certificationData: { legalRepName: '', nationality: '', idCardNo: '', certificationType: '', //企业 legalRepPhone: '', idCardType: '', regAmount: '', fixedAssets: '', annualTurnover: '', annualProfitTax: '', comCerType: '', comCerUrl: '', comCerNo: '', authStatus: '0' //认证状态 }, qualificationsData: { conf_armedLevel: [], //武装押运守护等级 conf_association: [], //所属行业保安协会 conf_manpowerLevel: [], //人力防范等级 conf_riskLevel: [], //风险评估等级 conf_safeRange: [], //安全范围 conf_safeTechLevel: [], //安全技术防范等级 conf_securityLicenseNum: '', //保安服务许可证号 conf_securityLicenseUrl: '' //保安服务许可证 }, idCardType: [], //身份证选择 nationality: [], //国籍 certificationType: [], //企业 visibleCode: false, //法人手机号存在时验证码弹窗 visibleNoPhoneCode: false, //法人手机号不存在时验证码弹窗 phoneHas: '123', // phoneLegalRepCode:'',//法人手机验证码 modalLegPerson: true, modalFooter: true, //是否显示modal的footer noPhoneContent: '', //法人手机号为空时是否展示下一个弹窗 hasPnone: '', modalFooterNoPhone: true, //法人手机号为空时是否显示modal的footer phone_yin: '', //手机号中间隐藏四位 color_abc: true, //验证码下的P标签是否出现 statusBianDisabled: false, showIndustry: false, //隐藏特殊资质信息;10-11,冠男取消隐藏 institutionType: '', //企业基础信息,企业机构类型 specialArray: [], administratorRelative: { administrator: '', // 管理员名字 phoneValue: '', // 管理员电话 openValidAdminModal: false, phoneValueHiddenMiddle: '', // 带*号的管理员手机号 hasValidCode: false, // 管理员手机验证码 isValidCode: false, // 管理员手机验证码是否正确 countDownNoPhone: 60 // 管理员手机验证码倒计时 } }; } /**** * 特殊字段 */ showSpecialFields = () => { const arr = this.state.specialArray.map((value, index) => { return (
{this.renderMap( value.fieldType, value.fieldName, value.fieldCode, parseInt(value.isRequired, 10), value.fieldValue, value.maxLength, value.fieldOptions, value.scriptFunction, value.isEdit, )}
); }); return arr; }; renderMap = ( fieldType, fieldName, fieldCode, isRequired, fieldValue, maxLength, fieldOptions, scriptFunction, isEdit, ) => { const formItemLayout = { labelCol: { xs: { span: 24 }, sm: { span: 7 } }, wrapperCol: { xs: { span: 24 }, sm: { span: 12 }, md: { span: 10 } } }; const { getFieldDecorator } = this.props.form; if (fieldType === '1') { return ( {getFieldDecorator(`${fieldCode}`, { initialValue: fieldValue || '', rules: [ { required: isRequired, message: `请输入${fieldName}` } ] })( )} ); } else if (fieldType === '2') { let max; if (maxLength) { max = Number(1 + new Array(parseInt(maxLength, 10) + 1).join('0')) - 1; } else { max = 999999; } return ( {getFieldDecorator(`${fieldCode}`, { initialValue: fieldValue || '', rules: [ { required: isRequired, message: `请输入${fieldName}` } ] })( )} ); } else if (fieldType === '3') { return ( {getFieldDecorator(`${fieldCode}`, { initialValue: fieldValue ? moment(fieldValue, dateFormat) : null, rules: [ { required: isRequired, message: `请选择${fieldName}` }, { validator: (rule, value, callback) => { const moment = require('moment'); scriptFunction ? eval(`${scriptFunction}`)(rule, value, callback) : callback(); } } ] })( )} ); } else if (fieldType === '4') { return ( {getFieldDecorator(`${fieldCode}`, { initialValue: fieldValue || '', rules: [ { required: isRequired, message: `请选择${fieldName}` } ] })( )} ); } else if (fieldType === '5') { return ( {getFieldDecorator(`${fieldCode}`, { initialValue: fieldValue || '', rules: [ { required: isRequired, message: `请选择${fieldName}` } ] })( )} ); } else if (fieldType === '8') { return ( {getFieldDecorator(`${fieldCode}`, { initialValue: fieldValue || '', rules: [ { required: isRequired, message: `请选择${fieldName}` } ] })()} 每张不超过:8M,格式为:jpg,jpeg,png ); } else if (fieldType === '9') { return ( {getFieldDecorator(`${fieldCode}`, { initialValue: fieldValue ? moment(fieldValue, dateFormat) : null, rules: [ { required: isRequired, message: `请选择${fieldName}` } ] })( )} ); } else if (fieldType === '10') { return ( {getFieldDecorator(`${fieldCode}`, { initialValue: fieldValue || '', rules: [ { // required: isRequired, message: `请选择${fieldName}`, required: isRequired, message: `请输入${fieldName}` } ] })(