/* *
*@params personApplyId
*@params onClose
*@北京的资格证材料审核页面
*/
import React, { Component } from 'react';
import { connect } from 'dva';
import axios from 'axios';
import moment from 'moment';
import { Button, Drawer, Form, Input, Row, Col, Select, notification, Modal } from 'antd';
import PSelect from '../../../../../components/Pro/PSelect';
import { qualify_applyInfo, qualify_applyDealMaterialApprove, qualify_applyMaterialApproveReject, trainQualifyApplyPersonApplyUpdate } from '../../../../../services/bkt/qualify';
import {
// enterpriseComContractGetComContractById,
systemPerCerBaseInfoFind,
publicCommonFileFilePreview,
getBayBaseInfo
} from '../../../../../services/api';
import PFromUpload from '../../../../../components/Pro/PFromUpload';
import $modal from '../../../../../utils/modal';
import InternshipRecord from './InternshipRecord';
import BTable from '../../../../../components/Pro/BTable';
import $nModal from '../../../../../utils/modal/nModal';
import SelectContactByPerId from '../../../../../components/contranct/SelectContactByPerId';
const { TextArea } = Input;
const { Option } = Select;
const formItemLayout = {
labelCol: {
xs: {
span: 24
},
sm: {
span: 7
}
},
wrapperCol: {
xs: {
span: 24
},
sm: {
span: 20
},
md: {
span: 16
}
}
};
const formItemLayout1 = {
labelCol: {
span: 24
},
wrapperCol: {
span: 24
}
};
@connect(state => ({
companyInfo: state.global.companyInfo
}))
@Form.create()
export default class SubDrawer extends Component {
constructor(props) {
super(props);
this.state = {
oldPersonApplyId: '',
comName: this.props.companyInfo.comName,
info: null, //申报详情
// contracInfo: {}, //合同详情
certInfo: {}, //证书详情
imgs: [],
recordShow: false, //实习记录的显示
hospitalExamProveUrlRows: [], //体检证明材料
comContractInfo: "",
isEdit: false, //是否处于材料编辑状态
isComparisonEdit: false, //是否处于比对编辑状态
};
}
componentWillMount() {
// this.__getDistrict();
}
componentDidMount() {}
componentWillReceiveProps(nextProps) {
if (!!nextProps.personApplyId && this.state.oldPersonApplyId != nextProps.personApplyId) {
this.setState({ oldPersonApplyId: nextProps.personApplyId });
this._getDetailInfo(nextProps.personApplyId);
// 重置合同信息
this.setState({
info: null,
comContractInfo: null
});
}
}
// 获取操作人信息
_getUserInfo = (cb) => {
if (this.state.editUser) {
cb();
} else {
getBayBaseInfo().then(res => {
this.setState({
editUser: res.data
}, cb);
})
}
}
_getDetailInfo = (personApplyId) => {
qualify_applyInfo({ data: { personApplyId } }).then(res => {
this.setState({
info: res.data,
isEdit: false, isComparisonEdit: false
});
if (res.data) {
const { comContractId, perCerId, personType } = res.data;
// 获取证书信息
// if (!!perCerId) {
// systemPerCerBaseInfoFind({ perCerId }).then(certRes => {
// if (certRes.data) {
// this.setState({
// certInfo: certRes.data
// });
// }
// });
// }
const imgArr = [
{
label: '一寸免冠白底彩照',
fieldsName: 'avatar',
rules: [{
required: true,
message: `一寸免冠白底彩照`
}],
faceCheckType: res.data.faceCheckType
},
{
label: '身份证人像面',
fieldsName: 'idCardNoFrontUrl',
rules: [{
required: true,
message: `身份证人像面`
}]
},
{
label: '身份证国徽面',
fieldsName: 'idCardNoBackUrl',
rules: [{
required: true,
message: `身份证国徽面`
}]
},
// {
// label: '初中以上学历证明原件',
// fieldsName: 'educationUrl',
// rules: [{
// required: true,
// message: `初中以上学历证明原件`
// }]
// },
];
if (this.props.checkAreaCodeValue) {
imgArr.push(
{
label: '初中以上学历证明原件',
fieldsName: 'educationUrl',
rules: [{
required: true,
message: `初中以上学历证明原件`
}]
},
)
}
const rows = [];
const length = Math.ceil(imgArr.length / 3);
for (let i = 0; i < length; i++) {
rows.push([
imgArr[i * 3],
imgArr[i * 3 + 1],
imgArr[i * 3 + 2] //有可能是undefined
]);
}
const hospitalExamProveUrlRows = [];
if (typeof res.data.medicalUrl == 'string') {
const hospitalExamProveUrls = res.data.medicalUrl.split(',').map((url, index) => {
log(url);
const fieldsName = 'medicalUrl' + index;
this.setState({
info: {
...this.state.info,
[fieldsName]: url
}
});
return {
label: '',
fieldsName,
rules: [{
required: false,
message: `医院出具的体检证明`
}]
}
});
const hospitalExamProveUrlLength = Math.ceil(hospitalExamProveUrls.length / 3);
for (let i = 0; i < hospitalExamProveUrlLength; i++) {
hospitalExamProveUrlRows.push([
hospitalExamProveUrls[i * 3],
hospitalExamProveUrls[i * 3 + 1],
hospitalExamProveUrls[i * 3 + 2] //有可能是undefined
]);
}
}
this.setState({
imgs: rows,
hospitalExamProveUrlRows
});
}
});
}
//不合格原因弹框
unqualifiedModal = () => {
Modal.info({
title: '不合格原因',
width: 700,
content: (
{
this.state.info.checkFailContent ?
this.state.info.checkFailContent.map(item => {
return (
{item.date} |
{item.content}
)
}) : ""
}
备注:
(1)学员基本信息不合格需由培训学校通过编辑学员报名信息进行修改更新;
(2)学习记录不合格需要通知学员登录App重新学习对应的章节课程;
),
onOk() { },
});
}
_onSubmit = () => {
const { isEdit, isComparisonEdit } = this.state;
this.props.form.validateFields((err, values) => {
if (!err) {
this._getUserInfo(() => {
const materialApprovePerName = this.state.editUser.name;
const materialApprovePerIdCardNo = this.state.editUser.idCardNo;
const { personType } = this.state.info;
const { personApplyId } = this.props;
// 材料核对编辑
if (isEdit) {
const { comContractInfo } = this.state;
const comContractId = comContractInfo ? comContractInfo.comContractId : this.state.info.comContractId;
// if (!this.props.checkAreaCodeValue && !comContractId) {
// return $modal(res.msg, '');
// }
const data = { ...values, materialApprovePerName, materialApprovePerIdCardNo, personType, personApplyId, comContractId };
trainQualifyApplyPersonApplyUpdate({ data }).then(res => {
$modal(res.msg, '', null, 'success');
this._getDetailInfo(personApplyId);
});
} else if (isComparisonEdit) {//补贴核对编辑
// grade_ApplyPersonApplyCompareUpdate({data: {
// personApplyId,
// residentType: values.residentType,
// residentPlaceType: values.residentPlaceType,
// gradeCertNo: values.gradeCertNo,
// materialApprovePerName,
// materialApprovePerIdCardNo
// }}).then(res => {
// $modal(res.msg, '', null, 'success');
// this._getDetailInfo(personApplyId);
// // 更新列表
// this.props.setParentState({
// forceUpdate: true
// }, () => {
// this.props.setParentState({
// forceUpdate: false
// });
// });
// });
}
});
}
});
}
render() {
const { getFieldDecorator } = this.props.form;
const { info, certInfo, isEdit, isComparisonEdit } = this.state;
const { checkAreaCodeValue, isNanNiCode,checkBeijinCodeValue } = this.props
return (
{
this.props.setParentState({
personApplyId: ''
});
this.setState({
isEdit: false,
isComparisonEdit: false
});
}}
// visible={true}
>
{info &&
{
// 报名比对状态compareStatus 补贴比对状态bonusCompareStatus 为可修改的时候
(info.bonusCompareStatus == '3' || info.compareStatus == '3') &&
}
{
info.materialApproveStatus == '2' &&
材料核对不通过原因: {info.materialApproveFailReason}
}
{
info.approveStatus == '2' &&
审核不通过原因: {info.approveFailReason}
}
}
{/* form表单 */}
{
info &&
{getFieldDecorator('materialApproveStatus', {
initialValue: info.materialApproveStatus
})()}
{
info.checkStatus == "0" || info.checkStatus == null ? "" :
{
info.checkStatus == "1" ?
合格
:
不合格
}
}
{/*
{getFieldDecorator('backgroundStatus', {
initialValue: info.backgroundStatus || '0'
})()}
{getFieldDecorator('applyStatus', {
initialValue: info.applyStatus || '0'
})()}
{getFieldDecorator('orderStatus', {
initialValue: info.orderStatus
})()}
*/}
{
info.examName &&
<>
考试信息
{getFieldDecorator('examName', {
initialValue: info.examName
})()}
{getFieldDecorator('examDate', {
initialValue: info.examDate
})()}
{getFieldDecorator('examAddress', {
initialValue: info.examAddress
})()}
{getFieldDecorator('testStateName', {
initialValue: info.testStateName
})()}
>
}
报名基础信息
{getFieldDecorator('fullName', {
initialValue: info.fullname
})()}
{getFieldDecorator('mobile', {
initialValue: info.mobile
})()}
{
!checkAreaCodeValue &&
{getFieldDecorator('faceCheckType', {
initialValue: info.faceCheckType
})(
info.faceCheckType == '0' ? 无(请核对图片材料中的一寸白底照片)
: 有(该人员有人口库照片,无需再核对照片)
)}
}
{getFieldDecorator('identitynumber', {
initialValue: info.identitynumber
})()}
{/*
{getFieldDecorator('birthDate', {
initialValue: info.birthDate
})()}
*/}
{getFieldDecorator('sex', {
initialValue: info.sex
})()}
{
checkAreaCodeValue &&
{getFieldDecorator('height', {
initialValue: info.height
})()}
}
{getFieldDecorator('education', {
initialValue: info.education
})()}
{getFieldDecorator('nation', {
initialValue: info.nation
})()}
{
!checkBeijinCodeValue &&<>
{getFieldDecorator('residentType', {
initialValue: info.residentType
})()}
{getFieldDecorator('residentPlaceType', {
initialValue: info.residentPlaceType
})()}
>
}
{
checkAreaCodeValue &&
{getFieldDecorator('householdAddress', {
initialValue: info.householdAddress
})()}
}
{/*
{getFieldDecorator('actualAddress', {
initialValue: info.actualAddress
})()}
*/}
{/*
{getFieldDecorator('workYear', {
initialValue: info.workYear
})()}
年
*/}
{/* 北京地区的如果有合同信息就展示,没有的就隐藏 */}
{
!checkAreaCodeValue && !isNanNiCode && (!checkBeijinCodeValue || (checkBeijinCodeValue && info.contractName) ) && <>
合同信息
{
isEdit &&
}
{
info.contractsCheck &&
{info.contractsCheck}
}
{getFieldDecorator('contractName', {
initialValue: info.contractName
})()}
{/*
{getFieldDecorator('contractType', {
initialValue: info.contractType
})()}
*/}
{/*
{getFieldDecorator('comFileNo', {
initialValue: info.comFileNo
})()}
*/}
{getFieldDecorator('effectStartDate', {
initialValue: info.effectStartDate ? `${info.effectStartDate}~${info.effectEndDate}` : ''
})()}
{
if (info.contractUrl) {
publicCommonFileFilePreview({
url: info.contractUrl,
isLoad: '1'
})
.then(data => {
if (data.data) {
window.open(data.data);
}
});
} else {
notification.warning({
message: '该合同未上传附件!',
description: '请先上传合同文件,方可查看。'
});
}
}}
>
点击查看
点击下载
{/* {getFieldDecorator('contractUrl' , {
initialValue: info.contractUrl
})(
)} */}
>
}
图像材料
{
this.state.imgs.map((row, index) => {
return (
{
row.map((item, idex) => {
if (!item) {
return '';
}
// console.log(info[item.fieldsName])
return (
{item.label}}>
{getFieldDecorator(item.fieldsName, {
initialValue: info[item.fieldsName]
})(
item.fieldsName == 'avatar' && item.faceCheckType == '1' ?
:
)}
)
})
}
);
})
}
{
checkAreaCodeValue && this.state.hospitalExamProveUrlRows.length > 0 &&
<>
县级以上医院出具的体检证明
{
this.state.hospitalExamProveUrlRows.map((row, index) => {
return (
{
row.map((item, idex) => {
if (!item) {
return '';
}
return (
{item.label}}>
{getFieldDecorator(item.fieldsName, {
initialValue: info[item.fieldsName]
})(
)}
)
})
}
);
})
}
>
}
{/*
*
我司( {info.learnName||this.props.companyInfo.comName} )承诺,由我司报名代理人{info.agentName}({info.agentIdCardNo},{info.agentPhone})提交的报名信息真实有效,对因填报信息错误造成不符合培训及补贴申报条件的,由本企业自行承担相应责任和损失。
*/}
{/* */}
企业报名人员
材料核对记录
{getFieldDecorator('materialApprovePerName', {
initialValue: info.materialApprovePerName ? info.materialApprovePerIdCardNo ? info.materialApprovePerName + '(' + info.materialApprovePerIdCardNo + ')' : info.materialApprovePerName : ''
})()}
{getFieldDecorator('materialApproveDate', {
initialValue: info.materialApproveDate
})()}
}
{/* 底部提交按钮 */}
{/* 非编辑模式 */}
{
(!isEdit && !isComparisonEdit) && info &&
<>
>
}
{/* 编辑模式 */}
{
(isEdit || isComparisonEdit) &&
<>
>
}
{
this.setState({
refuseModal: false
});
}}
onOk={() => {
// $modal('班级取消成功!','已发送取消通知到相关人员。', null, 'success');
const materialApproveFailReason = this.state.refuseReason;
if (materialApproveFailReason) {
const subFun = () => {
const materialApprovePerName = this.state.editUser.name;
const materialApprovePerIdCardNo = this.state.editUser.idCardNo;
const { personApplyId } = this.props;
qualify_applyMaterialApproveReject({ data: { personApplyId, materialApproveFailReason, materialApprovePerName, materialApprovePerIdCardNo } }).then(res => {
$modal('提交成功!', '保安公司可查看不通过原因。', null, 'success');
this.setState({
refuseModal: false,
refuseReason: ''
});
this._getDetailInfo(this.props.personApplyId);
this.props.updateTable();
this.props.onClose();
});
}
// 获取人员基础信息
this._getUserInfo(subFun);
} else {
message.error("请输入不通过原因及修改意见")
}
}}
>
{
this.setState({
refuseReason: e.target.value
});
}} placeholder="请输入不通过原因及修改意见。" />
{
info &&
{
this.setState({
recordShow: false
});
}}
/>
}
{
info &&
{
const { setFieldsValue } = this.props.form;
this.setState({
comContractInfo: comContractList[0]
});
setFieldsValue({
contractName: comContractList[0].contractName,
effectStartDate: comContractList[0].effectStartDate + '~' + comContractList[0].effectEndDate
})
// this.setState({
// comContractList
// });
}}
onClose={() => {
this.setState({
contractModal: false
});
}}
/>
}
);
}
}