Browse Source

(*)回款和业绩明细导入 部分字段校验

master
wuqun 2 years ago
parent
commit
47bf0628d0
  1. 6
      web/client/src/sections/business/containers/performanceReport/importAchieveModal.jsx
  2. 32
      web/client/src/sections/business/containers/performanceReport/importBackModal.jsx

6
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}行【是否可复制的业务路径】错误,请填写是或否`)

32
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
}
//

Loading…
Cancel
Save