diff --git a/web/client/src/sections/business/containers/performanceReport/importAchieveModal.jsx b/web/client/src/sections/business/containers/performanceReport/importAchieveModal.jsx index 51036af..a3f754b 100644 --- a/web/client/src/sections/business/containers/performanceReport/importAchieveModal.jsx +++ b/web/client/src/sections/business/containers/performanceReport/importAchieveModal.jsx @@ -163,6 +163,7 @@ const ImportAchieveModal = props => { return } let postData = []; + let zzsPattern = /^[+]{0,1}(\d+)$/;//正整数 for (let i = 0; i < res.length; i++) { let d = res[i]; let obj = {}; @@ -183,6 +184,11 @@ const ImportAchieveModal = props => { error(`第${i + 2}行【价格是否特批】错误,请填写是或否`) return } + //复购次数 正整数 + if (obj.repurchaseCount && !zzsPattern.test(obj.repurchaseCount)) { + error(`第${i + 2}行【复购次数】填写错误,需要为非负整数`) + return + } if (obj.reproducible && ['是', '否'].indexOf(obj.reproducible) == -1) { error(`第${i + 2}行【是否可复制的业务路径】错误,请填写是或否`) diff --git a/web/client/src/sections/business/containers/performanceReport/importBackModal.jsx b/web/client/src/sections/business/containers/performanceReport/importBackModal.jsx index 0299946..661c268 100644 --- a/web/client/src/sections/business/containers/performanceReport/importBackModal.jsx +++ b/web/client/src/sections/business/containers/performanceReport/importBackModal.jsx @@ -171,7 +171,9 @@ const ImportBackModal = props => { return } let postData = []; - const numPattern = /^\d+(\.\d+)?$/;//非负浮点数 判断金额 + //const numPattern = /^\d+(\.\d+)?$/;//非负浮点数 判断金额 + let zzsPattern = /^[+]{0,1}(\d+)$/;//正整数 + let yearPattern = /^(19|20)\d{2}$/;//1900-2099年 for (let i = 0; i < res.length; i++) { let d = res[i]; let obj = {}; @@ -187,6 +189,16 @@ const ImportBackModal = props => { error(`第${i + 2}行【年度】、【序号】、【编号】存在空值,请填写`) return } + //年份 + if (obj.year && !yearPattern.test(obj.year)) { + error(`第${i + 2}行【年份】填写错误`) + return + } + //序号 正整数 + if (obj.serialNo && !zzsPattern.test(obj.serialNo)) { + error(`第${i + 2}行【序号】填写错误,需要为非负整数`) + return + } let exist = allNumbers.find(m => m.number == obj.number);//数据库中 已有该编号 if (exist) { error(`第${i + 2}行的【编号】在系统中已存在`) @@ -196,21 +208,9 @@ const ImportBackModal = props => { error(`第${i + 2}行【编号】重复,请更改后重新上传`) return } - //金额 数字 - if (obj.amount && !numPattern.test(obj.amount)) { - error(`第${i + 2}行【合同金额】填写错误,需要为数字`) - return - } - if (obj.changeAmount && !numPattern.test(obj.changeAmount)) { - error(`第${i + 2}行【变更后合同金额】填写错误,需要为数字`) - return - } - if (obj.receivableAmount && !numPattern.test(obj.receivableAmount)) { - error(`第${i + 2}行【回款金额】填写错误,需要为数字`) - return - } - if (obj.remainConAmount && !numPattern.test(obj.remainConAmount)) { - error(`第${i + 2}行【剩余合同金额】填写错误,需要为数字`) + //回款年份 + if (obj.receivableYear && !yearPattern.test(obj.receivableYear)) { + error(`第${i + 2}行【回款年份】填写错误`) return } //时间