// 新增报名页面 import React, { Component } from 'react'; import { connect } from 'dva'; import { Breadcrumb, Alert, Form, Row, Col, Input, Upload, Icon, InputNumber, Cascader, Table, DatePicker, Select, Button, Popconfirm, Modal, message } from 'antd'; import { Link } from 'dva/router'; import { getBayBaseInfo, getTreeperBydepart, checkIsSetRegulator, getDistrictData, getConfigBayzgzSb, bayzgzTempSave, bayzgzSave, getBayzgzSbInfoById, bayzgzCheckResubmit, getPerAuthRecordbyId, checkIsExistsEffectBayzgz, getComContractListByPerId } from '../../../../../services/api'; import PFromUpload from '../../../../../components/Pro/PFromUpload'; import $perModal from '../../../../../utils/modal/perModal'; import moment from 'moment'; import PSelect from '../../../../../components/Pro/PSelect'; import { withRouter } from 'dva/router'; import SelectContactByPerId, { colFn } from '../../../../../components/contranct/SelectContactByPerId'; import { checkMember, checkPerCanSignUp } from '../../../../../utils/utils'; import { formItemLayout, formLayout, photoItemLayout, addressLayout, tipLayout } from '../../../../../constants/formItemLayout'; import { Box, NoTipRow } from '../style'; import PCascader from '../../../../../components/Pro/PCascader'; import AddForm from './AddForm'; const dateFormat = 'YYYY-MM-DD'; const { Option } = Select; @connect(state => ({ companyInfo: state.global.companyInfo })) @Form.create() @withRouter export default class FillIn extends Component { bayFamilyMemberDtoList = 0; bayWorkExperienceDtoList = 0; constructor(props, context) { super(props, context); this.state = { isAddOrEdit: true, //编辑或者是新增页面(true是新增,false是编辑,默认是新增页面) basicInfoStatus: false, //基础信息是否展示(新增页面要判断有无选择人员,修改页面默认展示) bayzgzSbId: '', // treeData: [ // 部门数据 //树 { title: '', key: '' } ], comName: this.props.companyInfo.comName, areas: [], //省市区 bayFamilyMemberDtoList: [], bayWorkExperienceDtoList: [], //保安员工作经历 perInfo: { //人员基础信息 name: null, mobilePhone: null, idCardNo: null, birthday: null, sex: null, height: null, education: null, domicileProvince: null, domicileCity: null, domicileArea: null, domicileAddress: null, nation: null }, perId: null, perIdName: '', //perId对应的人名 bayConfigInfo: [], //保安员的配置信息 photo: { colourPhotoUrl: '', idCardFrontUrl: '', idCardReverseUrl: '', eduCerUrl: '', hospitalExamProveUrl: '' }, isConfig: true, //新增页面判断是否有配置 key: 0, //用来重置图片的路径用 repetitionStatus: false, //选中的人员是否重复 buttonStatus: false, //提交按钮是否置灰 comContractList: [], //选中的合同列表 isPersonPhoto: false,//选中的人员是否有人口库照片 checkAreaCodeValue:this.props.location.checkAreaCodeValue,//区域是否是延安的 }; } componentWillMount() { this.__getDepart(); // this.__getDistrict(); this.__getConfigBayzgzSb(); if (this.props.location.bayzgzSbId) { //是编辑页面 // this._getBayzgzSbInfoById(this.props.location.bayzgzSbId); //获取人员的详细信息 this.getPersonInfo(this.props.location.bayzgzSbId); //获取人员的详细信息 this.setState({ isAddOrEdit: false, bayzgzSbId: this.props.location.bayzgzSbId, basicInfoStatus: true }); } else { //是新增页面 /** *先判断该企业是否有配置 *0:代表未设置 1:代表已设置 */ this.__checkIsSetRegulator(); this.setState({ isAddOrEdit: true, basicInfoStatus: false, }, () => { if (this.props.location.perInfo) { //未持证列表跳转过来的页面 const info = JSON.parse(this.props.location.perInfo); this.setState({ perId: info.perId || null, perIdName: info.perIdName || '', perInfo: { ...this.state.perInfo, ...info }, basicInfoStatus: true, }, () => { this.__getComContractListByPerId(); }); } }); } } componentDidMount() { } // 判断是否是北京地区(北京地区隐藏劳动合同、户籍类型、户籍所在地三个字段) checkBeijinCode() { let regProvince = String(this.props.companyInfo.regProvince); return regProvince && regProvince.indexOf('110') == 0 } //该企业是否有配置 __checkIsSetRegulator() { checkIsSetRegulator({ regulatorType: '2' }).then(data => { const that = this; if (data.retType === '0') { if (data.data === '1') { this.setState({ isConfig: true }); } else { this.setState({ isConfig: false }); Modal.warning({ title: '该企业暂未设置监管机构,请先设置', okText: '前往设置', onOk() { that.props.history.replace('/enterprise/regulator-set'); } }); } } }); } // 获取人员合同列表 __getComContractListByPerId() { const { perId, comContractId } = this.state; getComContractListByPerId({ perId, pageNumber: 1, pageSize: 100 }).then(res => { const contractInfo = res.data.data.find(item => item.comContractId == comContractId); const comContractList = []; contractInfo && comContractList.push(contractInfo); this.setState({ comContractList }); }); } //修改页面中获取详情信息 _getBayzgzSbInfoById(bayzgzSbId) { getBayzgzSbInfoById({ bayzgzSbId }).then(res => { log(res.data, 'res.data') if (res.retType === '0') { const { comContractId } = res.data; this.setState({ bayFamilyMemberDtoList: res.data.bayFamilyMemberDtoList ? res.data.bayFamilyMemberDtoList : [], bayWorkExperienceDtoList: res.data.bayWorkExperienceDtoList ? res.data.bayWorkExperienceDtoList : [], perInfo: { ...res.data }, perId: bayzgzSbId, comContractId, photo: { colourPhotoUrl: res.data.colourPhotoUrl || '', idCardFrontUrl: res.data.idCardFrontUrl || '', idCardReverseUrl: res.data.idCardReverseUrl || '', eduCerUrl: res.data.eduCerUrl || '', hospitalExamProveUrl: res.data.hospitalExamProveUrl || '' }, perIdName: res.data.name }, () => { if (comContractId) { this.props.form.setFieldsValue({ idCardFrontUrl: res.data.idCardFrontUrl || '', idCardReverseUrl: res.data.idCardReverseUrl || '' }); this.__getComContractListByPerId(); } }); } }); } //获取部门树数据 __getDepart = cb => { getTreeperBydepart().then( response => { const responseData = checkMember(response.data); this.setState({ treeData: responseData }); }, err => { this.setState({ loading: false }); console.log(err, 'err-部门人员-getTreeperBydepart'); } ); }; //获取人员信息 getPersonInfo(perId, isPersonPhoto = '2') { getBayBaseInfo({ perId }).then(res => { const that = this; if (res.retType === '0') { that.setState({ perInfo: res.data, basicInfoStatus: true, bayWorkExperienceDtoList: [], bayFamilyMemberDtoList: [], perId, photo: { colourPhotoUrl: res.data.colourPhotoUrl || '', idCardFrontUrl: res.data.idCardFrontUrl || '', idCardReverseUrl: res.data.idCardReverseUrl || '', eduCerUrl: res.data.eduCerUrl || '', hospitalExamProveUrl: res.data.hospitalExamProveUrl || '' }, }, () => { const { setFieldsValue } = this.props.form; this.props.form.resetFields() setFieldsValue({ perIdName: this.state.perInfo.name, name: this.state.perInfo.name, mobilePhone: this.state.perInfo.mobilePhone, idCardNo: this.state.perInfo.idCardNo, colourPhotoUrl: res.data.colourPhotoUrl, birthday: this.state.perInfo.birthday ? moment(this.state.perInfo.birthday, dateFormat) : null, sex: this.state.perInfo.sex, height: this.state.perInfo.height, nation: this.state.perInfo.nation, residentFullAddress: this.state.perInfo.residentFullAddress, domicile: this.state.perInfo.domicileProvince ? [ this.state.perInfo.domicileProvince, this.state.perInfo.domicileCity, this.state.perInfo.domicileArea ] : [], domicileAddress: this.state.perInfo.domicileAddress, idCardFrontUrl: this.state.photo.idCardFrontUrl, idCardReverseUrl: this.state.photo.idCardReverseUrl, }); this.setState({ key: Math.random(), }); }); if (isPersonPhoto == '2' && !!!res.data.colourPhotoUrl) { Modal.warning({ title: '此人暂未有一寸免冠白底彩照,请通知该员工登录App-工作-证件照采集页面进行采集。' }); } } }); } //获取保安员配置是否必填 __getConfigBayzgzSb() { getConfigBayzgzSb().then(res => { if (res.retType === '0') { this.setState({ bayConfigInfo: res.data }); } }); } //校验该保安员资格证是否重复提交 _bayzgzCheckResubmit(perId, cb) { bayzgzCheckResubmit({ perId }).then(res => { // const that = this if (res.retType === '0') { if (res.data === 0) { //不可以报名 this.props.form.resetFields(); this.setState({ repetitionStatus: 0, perId: null, perIdName: '' }); Modal.warning({ title: '不可以报名:报名已经审核通过或者审核中', okText: '确定', onOk() { } }); } else if (res.data === 2) { //不可以报名 this.props.form.resetFields(); this.setState({ // basicInfoStatus: false repetitionStatus: 2, perId: null, perIdName: '' }); Modal.warning({ title: '不可以报名:此人报名存在暂存未提交记录', okText: '确定', onOk() { } }); } else { //可以报名 this.setState({ // basicInfoStatus: false repetitionStatus: false }); cb && cb(); //可以提交的时候再去请求人员数据信息 // this.getPersonInfo(perId); } } }); } errModal(param) { Modal.warning({ title: param }); this.setState({ buttonStatus: false }); } _renderConTable = () => { const columns = colFn.call(this); columns.push({ title: '操作', dataIndex: 'op', key: 'op', render: () => { return ( { this.setState({ comContractList: [] }); }}>移除关联 ); } }); return ( ); } //提交(跟提交并添加) async _submit(param) { if (!!!this.state.perId) { this.errModal('请先选择人员'); return; } if (this.state.isPersonPhoto == '2' && !!!this.state.photo.colourPhotoUrl) { this.errModal( '此人暂未有一寸免冠彩照,请通知该员工登录App-工作-证件照采集页面进行采集。' ); return; } let param2 = true; if (this.props.location.bayzgzSbId !== '') { //是编辑页面,1、有暂存过的,可以提交。2、有提交过的,不能提交 if (this.state.repetitionStatus === 2) { //有提交过的 param2 = false; this.errModal('不可以报名:此人报名存在暂存未提交记录'); return; } } else { //是新增页面。1、有暂存过的,不能提交。2、有提交过的,不能提交 if (this.state.repetitionStatus === 0) { //有暂存过的 param2 = false; this.errModal('不可以报名:报名已经审核通过或者审核中'); return; } if (this.state.repetitionStatus === 2) { //有提交过的 param2 = false; this.errModal('不可以报名:此人报名存在暂存未提交记录'); return; } } if(!this.state.checkAreaCodeValue){ for (let i = 0; i < this.state.bayFamilyMemberDtoList.length; i++) { for (let j = i + 1; j < this.state.bayFamilyMemberDtoList.length; j++) { if ( this.state.bayFamilyMemberDtoList[i].idCardNo === this.state.bayFamilyMemberDtoList[j].idCardNo ) { param2 = true; this.errModal('家庭成员不能有相同的身份证号码'); return; } } } } const comContractId = this.state.comContractList.length > 0 ? this.state.comContractList[0].comContractId : ''; // if (!comContractId && this.state.bayConfigInfo.isComContractRequired == '1') { // this.errModal('请选择合同'); // return; // } if (param2) { this.props.form.validateFields((err, values) => { let data = values; let hasError = false; if (!err) { if (!this.state.checkAreaCodeValue&&this.state.bayFamilyMemberDtoList.length > 0) { //如果家庭成员信息不完善 const data = this.state.bayFamilyMemberDtoList; for (let i = 0; i < data.length; i++) { if ( !!!data[i].name || !!!data[i].relation || !!!data[i].contactPhone || !!!data[i].idCardType || !!!data[i].idCardNo ) { this.errModal('请填写完整家庭成员信息'); hasError = true; return; } } } if (!this.state.checkAreaCodeValue&&this.state.bayWorkExperienceDtoList.length > 0) { //如果工作经历信息不完善 const data = this.state.bayWorkExperienceDtoList; for (let i = 0; i < data.length; i++) { if ( !!!data[i].comName || !!!data[i].position || !!!data[i].workContent || !!!data[i].entryDate || !!!data[i].leaveDate || !!!data[i].leaveReason ) { this.errModal('请填写完整工作经历信息'); hasError = true; return; } } } if (!!!hasError) { //信息都完善的情况下 if ( data.birthday && data.birthday !== undefined && data.birthday !== null ) { data.birthday = data['birthday'].format(dateFormat); } else { data.birthday = ''; } let value = { // ...data, perId: this.state.perId, name: data.name, idCardNo: data.idCardNo, sex: data.sex, birthday: data.birthday, mobilePhone: data.mobilePhone, domicileProvince: data.domicile[0], domicileCity: data.domicile[1], domicileArea: data.domicile[2], domicileAddress: data.domicileAddress, residenceAddress: data.residentFullAddress, education: data.education, height: data.height, comName: data.comName, ...this.state.photo, hospitalExamProveUrl: data.hospitalExamProveUrl, }; if(!this.state.checkAreaCodeValue){ value={ ...value, comContractId: this.state.comContractList.length > 0 ? this.state.comContractList[0].comContractId : '', nation: data.nation, residentPlaceType: data.residentPlaceType, residentType: data.residentType, bayFamilyMemberDtoListStr: JSON.stringify( this.state.bayFamilyMemberDtoList ), bayWorkExperienceDtoListStr: JSON.stringify( this.state.bayWorkExperienceDtoList ), } } bayzgzSave(value) .then(data => { const that = this; if (data.retType === '0') { //提交完成之后放开按钮的可提交状态 this.setState({ buttonStatus: false }); if (param === 'goOn') { Modal.success({ title: '提交成功!', content: '您可以在报名列表查看该人员的报名信息。', // okText: '到《未持证人员》列表中接续报名', okText: '到列表中接续报名', onOk() { // that.props.history.push('/PoliceDeclare/sign-up?tab=2'); // that.props.history.push('/Printing/SignUp/FillIn'); that.props.form.resetFields() } }); } else { Modal.success({ title: '提交成功!', content: '您可以在报名列表查看该人员的报名信息。', okText: '返回报名列表', onOk() { that.props.history.push('/Printing/SignUp'); } }); } } }) .catch(() => { //提交完成之后放开按钮的可提交状态 this.setState({ buttonStatus: false }); }); } } else { this.setState({ buttonStatus: false }); } }); } } render() { const { getFieldDecorator } = this.props.form; return ( 学员列表 {this.state.isAddOrEdit ? '新增报名' : '修改报名'} 人员若存在申报中/申报通过的报名记录,则无法再重新报名;申报不通过/已撤销的可以重新提交报名。 } type="warning" showIcon style={{ marginBottom: 15, marginTop: 10 }} /> {/* form表单 */}

报名基础信息

{getFieldDecorator('comName', { initialValue: this.props.companyInfo.comName, rules: [ { required: true } ] })( )} { !this.state.basicInfoStatus && {getFieldDecorator('perIdName', { initialValue: this.state.perIdName || '', rules: [ { required: true, message: '请先选择人员' } ] })( { $perModal({ type: 'radio', onOk: async (values, close) => { const { perId } = values[0] // const { regProvince } = this.props.companyInfo; checkIsExistsEffectBayzgz({ perId }).then(res => { // if(res.data != 0) { if (res.data == 1) { return; // Modal.warning({ // title: '该人员已存在保安员资格证,无法报名。' // }); } else { this.setState({ isPersonPhoto: res.data }) getPerAuthRecordbyId({ perId }).then(result => { if (result.data.authStatus != 1) { Modal.warning({ title: '该人员尚未完成实名认证,无法报名。需通过实名认证,才可进行报名。' }); } else { this._bayzgzCheckResubmit(perId, () => { this.setState({ perId, perIdName: values[0].name, key: Math.random() }, () => { this.getPersonInfo(perId, res.data); this.__getComContractListByPerId(); close(); }); }); } }); } }); } }); }} /> )} }
{ this.state.isPersonPhoto == '2' ? 注:支持上传1M以内的jpeg|jpg文件} style={{ marginBottom: 0 }} > {getFieldDecorator(`colourPhotoUrl`, { initialValue: this.state.photo.colourPhotoUrl || '', rules: [ { required: this.state.bayConfigInfo.isColourPhotoRequired === '1' ? true : false, message: `请上传一寸免冠白底彩照` } ] })( { this.setState({ photo: { ...this.state.photo, colourPhotoUrl: url } }); }} /> )} :
该人员有人口库照片,无需再上传报名照片。
}
{getFieldDecorator('name', { initialValue: this.state.perInfo.name || '', rules: [ { required: true, message: '请输入姓名' } ] })()} {getFieldDecorator('mobilePhone', { initialValue: this.state.perInfo.mobilePhone || '', rules: [ { required: true, message: '请输入手机号码' } ] })()} {getFieldDecorator('idCardNo', { initialValue: this.state.perInfo.idCardNo, rules: [ { required: true, message: '请输入身份证号' } ] })()} {getFieldDecorator('birthday', { initialValue: this.state.perInfo.birthday ? moment(this.state.perInfo.birthday, dateFormat) : null, rules: [ { required: true, message: '请选择出生年月' } ] })()} {getFieldDecorator('sex', { initialValue: this.state.perInfo.sex, rules: [ { required: true, message: '请选择性别' } ] })( )} {getFieldDecorator('height', { initialValue: this.state.perInfo.height, rules: [ { required: this.state.bayConfigInfo.isHeightRequired === '1' ? true : false, message: '请输入身高' } ] })()} {getFieldDecorator('education', { initialValue: this.state.perInfo.education, rules: [ { required: true, message: '请选择文化程度' } ] })()} { !this.state.checkAreaCodeValue&& {getFieldDecorator('nation', { initialValue: this.state.perInfo.nation, rules: [ { required: this.state.bayConfigInfo.isNationRequired === '1' ? true : false, message: '请选择民族' } ] })( )} } { !this.state.checkAreaCodeValue && !this.checkBeijinCode() && {getFieldDecorator('residentPlaceType', { initialValue: this.state.perInfo.residentPlaceType, rules: [ { required:false, // this.state.bayConfigInfo.isResidentPlaceTypeRequired === '1' // ? true // : false, message: '请选择户籍所在地' } ] })( )} {getFieldDecorator('residentType', { initialValue: this.state.perInfo.residentType, rules: [ { required: this.state.bayConfigInfo.isResidentTypeRequired === '1' ? true : false, message: '请选择户籍类型' } ] })( )} } {this.state.checkAreaCodeValue?"户籍地址":"身份证住址"}} style={{ paddingRight: '-10px' }} > {getFieldDecorator('residentFullAddress', { initialValue: this.state.perInfo.residentFullAddress, rules: [ { required: this.state.bayConfigInfo.isResidenceRequired === '1' ? true : false, message: '请输入保安员住址信息' } ] })( )} 注:请报名人员仔细核对地址,在填写框不要重复省市信息,以免证书打印的时候出现重复,造成证件作废。 } > // 注:请报名人员仔细核对地址,在填写框不要重复省市信息,以免证书打印的时候出现重复,造成证件作废。 // } > {getFieldDecorator('domicile', { initialValue: this.state.perInfo.domicileProvince ? [ this.state.perInfo.domicileProvince, this.state.perInfo.domicileCity, this.state.perInfo.domicileArea ] : [], rules: [ { required: this.state.bayConfigInfo.isDomicileRequired === '1' ? true : false, message: '请选择您的现住地址!' } ] })( // )} {getFieldDecorator('domicileAddress', { initialValue: this.state.perInfo.domicileAddress, rules: [ { required: this.state.bayConfigInfo.isDomicileRequired === '1' ? true : false, message: '请输入现住地址街道信息!' } ] })( )} 注:请报名人员仔细核对地址,在填写框不要重复省市信息,以免证书打印的时候出现重复,造成证件作废。 } > { !this.state.checkAreaCodeValue && !this.checkBeijinCode() && <> {/* {this.state.bayConfigInfo.isComContractRequired == '1' && * } */} ) } colon={false}>

合同附件必须有员工本人亲自签名的页面,对因劳动合同真实性 (如非本人签署)问题导致的补贴申请问题由企业自行承担责任和损失,审计出现问题的追回补贴资金并接受相应处罚。

{ this.setState({ comContractList }); }} onClose={() => { this.setState({ contractModal: false }); }} /> { this._renderConTable() } {getFieldDecorator('bayFamilyMemberDtoList', { initialValue: this.state.bayFamilyMemberDtoList, rules: [ { required: this.state.bayConfigInfo.isFamilyRequired === '1' ? true : false, message: '请完善家庭成员!' } ] })( AddForm.call(this, 'family') )} {getFieldDecorator('bayWorkExperienceDtoList', { initialValue: this.state.bayWorkExperienceDtoList, rules: [ { required: this.state.bayConfigInfo.isWorkExpRequired === '1' ? true : false, message: '请添加工作经历' } ] })( AddForm.call(this, 'bayWork') )} } (每张不超过:8M,格式为:jpg,jpeg,png) {getFieldDecorator(`idCardFrontUrl`, { initialValue: this.state.photo.idCardFrontUrl, rules: [ { required: this.state.bayConfigInfo.isIdCardFrontRequired === '1' ? true : false, message: `请上传身份证人像面` } ] })( { this.setState({ photo: { ...this.state.photo, idCardFrontUrl: url } }); }} /> )} {getFieldDecorator(`idCardReverseUrl`, { initialValue: this.state.photo.idCardReverseUrl, rules: [ { required: this.state.bayConfigInfo.isIdCardReverseRequired === '1' ? true : false, message: `请上传身份证国徽面` } ] })( { this.setState({ photo: { ...this.state.photo, idCardReverseUrl: url } }); }} /> )} {getFieldDecorator(`eduCerUrl`, { initialValue: this.state.photo.eduCerUrl, rules: [ { required: this.state.bayConfigInfo.isEduProveRequired === '1' ? true : false, message: `请上传初中以上学历证明原件` } ] })( { this.setState({ photo: { ...this.state.photo, eduCerUrl: url } }); }} /> )} 县级以上医院出具的
体检证明(最多4张) } > {getFieldDecorator(`hospitalExamProveUrl`, { initialValue: this.state.photo.hospitalExamProveUrl, rules: [ { required: this.state.bayConfigInfo.isCheckUpProveRequired === '1' ? true : false, message: `请上传县级以上医院出具的体检证明` } ] })( { console.log(url); }} /> )}
{/* */} {/* */}
); } }