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