diff --git a/web/client/src/sections/humanAffairs/containers/import-members-modal.js b/web/client/src/sections/humanAffairs/containers/import-members-modal.js index 923591e..677e213 100644 --- a/web/client/src/sections/humanAffairs/containers/import-members-modal.js +++ b/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) {