巴林闲侠 2 years ago
parent
commit
ee16dc737d
  1. 49
      web/client/src/sections/humanAffairs/containers/import-members-modal.js

49
web/client/src/sections/humanAffairs/containers/import-members-modal.js

@ -207,7 +207,7 @@ const ImportMembersModal = props => {
const pattern = /^1[3|4|5|6|7|8|9]\d{9}$/;
const sfz = /^[1-9]\d{5}(18|19|([23]\d))\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$/;//身份证
//const ymd = /^((19|20)[0-9]{2})[\/\-]((0[1-9])|(1[0-2]))[\/\-]((0[1-9])|((1|2)[0-9])|(3[0-1]))$/;//年月日
const num0 = /^\d+$/;//正整数+0
const num0 = /^\d+(\.\d+)?$/;//非负浮点数
for (let i = 0; i < res.length; i++) {
let d = res[i];
@ -235,97 +235,102 @@ const ImportMembersModal = props => {
let occupationalHistory = judgeNull(d['历史工作经历与职务']);
if (!number) {//人员编号不为空,唯一,字母和数字
error(`${i + 1}行人员编号为空,请填写`)
error(`${i + 2}行人员编号为空,请填写`)
return
}
let xqExist = xqMembers.find(m => m.peopleCode == number);
if (!xqExist) {
error(`${i + 2}行,项企中不存在该人员编号`)
return
}
if (postData.some(p => p.number == number)) {//人员编号 唯一
error(`${i + 1}行人员编号重复,请更改后重新上传`)
error(`${i + 2}行人员编号重复,请更改后重新上传`)
return
}
if (!zmsz.test(number)) {
error(`${i + 1}行人员编号错误,请填写字母和数字的组合`)
error(`${i + 2}行人员编号错误,请填写字母和数字的组合`)
return
}
if (!name) {//姓名必填
error(`${i + 1}行姓名为空,请填写`)
error(`${i + 2}行姓名为空,请填写`)
return
}
if (idNumber && !sfz.test(idNumber)) {
error(`${i + 1}行证件号错误`)
error(`${i + 2}行证件号错误`)
return
}
if (gender && ['男', '女'].indexOf(gender) == -1) {
error(`${i + 1}行性别错误`)
error(`${i + 2}行性别错误`)
return
}
let bsdValid = judgeTimeValid(birthday);
if (!bsdValid) {
error(`${i + 1}行出生年月日错误,请填写yyyy/mm/dd格式`)
error(`${i + 2}行出生年月日错误,请填写yyyy/mm/dd格式`)
return
}
let jgValid = judgePlace(nativePlace);
if (!jgValid) {
error(`${i + 1}行籍贯错误`)
error(`${i + 2}行籍贯错误`)
return
}
if (marital && ['已婚', '未婚', '已婚已育'].indexOf(marital) == -1) {
error(`${i + 1}行婚育状态错误`)
error(`${i + 2}行婚育状态错误`)
return
}
if (politicsStatus && ['群众', '党员'].indexOf(politicsStatus) == -1) {
error(`${i + 1}行政治面貌错误`)
error(`${i + 2}行政治面貌错误`)
return
}
if (phoneNumber && !pattern.test(phoneNumber)) {
error(`${i + 1}行联系方式错误`)
error(`${i + 2}行联系方式错误`)
return
}
let wpValid = judgePlace(workPlace);
if (!wpValid) {
error(`${i + 1}行工作地点错误`)
error(`${i + 2}行工作地点错误`)
return
}
if (educationBackground && ['小学', '初中', '高中', '大专', '本科', '研究生', '博士'].indexOf(educationBackground) == -1) {
error(`${i + 1}行学历错误`)
error(`${i + 2}行学历错误`)
return
}
let byValid = judgeTimeValid(graduationDate);
if (!byValid) {
error(`${i + 1}行毕业时间错误,请填写yyyy/mm/dd格式`)
error(`${i + 2}行毕业时间错误,请填写yyyy/mm/dd格式`)
return
}
let rzhValid = judgeTimeValid(hiredate);
if (!rzhValid) {
error(`${i + 1}行入职时间错误,请填写yyyy/mm/dd格式`)
error(`${i + 2}行入职时间错误,请填写yyyy/mm/dd格式`)
return
}
let shyValid = judgeTimeValid(turnProbationPeriod);
if (!shyValid) {
error(`${i + 1}行转试用期时间错误,请填写yyyy/mm/dd格式`)
error(`${i + 2}行转试用期时间错误,请填写yyyy/mm/dd格式`)
return
}
let zhzhValid = judgeTimeValid(regularDate);
if (!zhzhValid) {
error(`${i + 1}行转正时间错误,请填写yyyy/mm/dd格式`)
error(`${i + 2}行转正时间错误,请填写yyyy/mm/dd格式`)
return
}
let lzhValid = judgeTimeValid(dimissionDate);
if (!lzhValid) {
error(`${i + 1}行离职日期错误,请填写yyyy/mm/dd格式`)
error(`${i + 2}行离职日期错误,请填写yyyy/mm/dd格式`)
return
}
if (experienceYear && !num0.test(experienceYear)) {
error(`${i + 1}行工作经验(年)错误,请填写非负`)
error(`${i + 2}行工作经验(年)错误,请填写非负数`)
return
}
postData.push({//人员编号 待办todotodo
pepUserId: 555, name, idNumber, gender, birthday, nativePlace, marital,
pepUserId: xqExist.id, name, idNumber, gender, birthday, nativePlace, marital,
politicsStatus, phoneNumber, workPlace, graduatedFrom, educationBackground, specialty, graduationDate,
hiredate, turnProbationPeriod, regularDate, dimissionDate, experienceYear, occupationalHistory,
del: false
del: false, number
})
}
//if (postData.length) {

Loading…
Cancel
Save