diff --git a/src/main/resources/static/js/imageUpload/qualityInspection/child/qualityInspectionForm.js b/src/main/resources/static/js/imageUpload/qualityInspection/child/qualityInspectionForm.js index f20d8d1..3f5313f 100644 --- a/src/main/resources/static/js/imageUpload/qualityInspection/child/qualityInspectionForm.js +++ b/src/main/resources/static/js/imageUpload/qualityInspection/child/qualityInspectionForm.js @@ -179,9 +179,9 @@ layui.use(['laydate', 'upload'], function () { // 校验日期逻辑 function validateDates() { - var vioDate = document.getElementById('vioDate').value; - var rectDate = document.getElementById('rectDate').value; - var rectTime = document.getElementById('rectTime').value; + var vioDate = document.getElementById('vioDate').value; //违章时间 + var rectDate = document.getElementById('rectDate').value; //整改期限 + var rectTime = document.getElementById('rectTime').value; //整改时间 if (vioDate && rectDate) { if (new Date(rectDate) < new Date(vioDate)) { @@ -191,12 +191,16 @@ function validateDates() { } } - if (rectDate && rectTime) { - if (new Date(rectTime) < new Date(rectDate)) { + if (rectDate && rectTime && vioDate) { + if (new Date(rectDate) < new Date(rectTime)) { document.getElementById('rectTime').value = ''; // 清空整改时间 - layer.msg('整改时间必须大于等于整改期限', {icon: 5}); + layer.msg('整改时间必须小于等于整改期限', {icon: 5}); return false; } + if(new Date(rectTime) < new Date(vioDate)){ + document.getElementById('rectTime').value = ''; + layer.msg('整改时间必须大于等于检查时间', {icon: 5}); + } } return true; diff --git a/src/main/resources/static/js/imageUpload/safetyViolations/child/safetyViolationsForm.js b/src/main/resources/static/js/imageUpload/safetyViolations/child/safetyViolationsForm.js index 54dd023..4903d44 100644 --- a/src/main/resources/static/js/imageUpload/safetyViolations/child/safetyViolationsForm.js +++ b/src/main/resources/static/js/imageUpload/safetyViolations/child/safetyViolationsForm.js @@ -179,9 +179,9 @@ layui.use(['laydate', 'upload'], function () { // 校验日期逻辑 function validateDates() { - var vioDate = document.getElementById('vioDate').value; - var rectDate = document.getElementById('rectDate').value; - var rectTime = document.getElementById('rectTime').value; + var vioDate = document.getElementById('vioDate').value; //违章时间 + var rectDate = document.getElementById('rectDate').value; //整改期限 + var rectTime = document.getElementById('rectTime').value; //整改时间 if (vioDate && rectDate) { if (new Date(rectDate) < new Date(vioDate)) { @@ -191,12 +191,16 @@ function validateDates() { } } - if (rectDate && rectTime) { - if (new Date(rectTime) < new Date(rectDate)) { + if (rectDate && rectTime && vioDate) { + if (new Date(rectDate) < new Date(rectTime)) { document.getElementById('rectTime').value = ''; // 清空整改时间 - layer.msg('整改时间必须大于等于整改期限', {icon: 5}); + layer.msg('整改时间必须小于等于整改期限', {icon: 5}); return false; } + if(new Date(rectTime) < new Date(vioDate)){ + document.getElementById('rectTime').value = ''; + layer.msg('整改时间必须大于等于检查时间', {icon: 5}); + } } return true;