|
|
@ -107,14 +107,6 @@ const ImportContractDetailsModal = props => { |
|
|
|
}) |
|
|
|
} |
|
|
|
|
|
|
|
const judgeNullTime = (v) => { |
|
|
|
//注意的点:xlsx将excel中的时间内容解析后,会小一天
|
|
|
|
//如2020/8/1,xlsx会解析成 Fri Jul 31 2020 23:59:17 GMT+0800 小了43秒
|
|
|
|
let a = new Date(v); |
|
|
|
a.setTime(a.getTime() + 43 * 1000); |
|
|
|
return v ? a : null; |
|
|
|
} |
|
|
|
|
|
|
|
const judgeTimeValid = (time) => { |
|
|
|
let valid = true; |
|
|
|
if (!time) { |
|
|
@ -176,12 +168,7 @@ const ImportContractDetailsModal = props => { |
|
|
|
let d = res[i]; |
|
|
|
let obj = {}; |
|
|
|
Object.keys(contractDetailsColumnKeys).map(key => { |
|
|
|
//四个日期验证“申请日期”、“收到合同日期”、“验收日期”、“收入确认时间”
|
|
|
|
if (ColumnDateKey.indexOf(key) != -1) {//两个时间
|
|
|
|
obj[key] = judgeNullTime(d[contractDetailsColumnKeys[key]]); |
|
|
|
} else { |
|
|
|
obj[key] = d[contractDetailsColumnKeys[key]] || null; |
|
|
|
} |
|
|
|
obj[key] = d[contractDetailsColumnKeys[key]] || null; |
|
|
|
}) |
|
|
|
//年度 序号 编号必填
|
|
|
|
if (!obj.year || !obj.serialNo || !obj.number) { |
|
|
@ -207,7 +194,7 @@ const ImportContractDetailsModal = props => { |
|
|
|
error(`第${i + 2}行【编号】重复,请更改后重新上传`) |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
|
//日期验证“申请日期”、“收到合同日期”、“验收日期”、“收入确认时间”
|
|
|
|
for (let k = 0; k < ColumnDateKey.length; k++) { |
|
|
|
let cValid = judgeTimeValid(obj[ColumnDateKey[k]]); |
|
|
|
if (!cValid) { |
|
|
|