From 549c9c3aef68a59c27cd25fb211094721ef790e6 Mon Sep 17 00:00:00 2001 From: wans <747101512@qq.com> Date: Wed, 12 May 2021 17:20:00 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=97=B6=E9=97=B4=E6=A0=A1?= =?UTF-8?q?=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../route/classplan/save-report-exam.html | 19 +++++++++++++++ .../static/route/classplan/save.html | 23 +++++++++++++++++++ .../route/classplan/update-report-exam.html | 21 +++++++++++++++++ 3 files changed, 63 insertions(+) diff --git a/src/main/resources/static/route/classplan/save-report-exam.html b/src/main/resources/static/route/classplan/save-report-exam.html index e302dff..cfd7f89 100644 --- a/src/main/resources/static/route/classplan/save-report-exam.html +++ b/src/main/resources/static/route/classplan/save-report-exam.html @@ -84,6 +84,11 @@ // 提交表单 form.on('submit(submitForm)', function(formData) { + // 校验时间 + if(verifyDate(formData.field['estimateStart'],formData.field['estimateEnd']) == 1){ + layer.msg('预计考试开始时间不能大于结束时间'); + return; + } top.dialog.confirm(top.dataMessage.commit, function(index) { top.dialog.close(index); var loadLayerIndex; @@ -101,6 +106,20 @@ return false; }); + function verifyDate(value1,value2){ + var v1 = new Date(Date.parse(value1.replace(/-/g,"/"))).getTime(); + var v2 = new Date(Date.parse(value2.replace(/-/g,"/"))).getTime(); + if( v1 < v2){ + return -1; + } + if( v1 == v2){ + return 0; + } + if( v1 > v2){ + return 1; + } + } + $('.close').on('click', function() { closeBox(); }); diff --git a/src/main/resources/static/route/classplan/save.html b/src/main/resources/static/route/classplan/save.html index 2d13d53..622b2d9 100644 --- a/src/main/resources/static/route/classplan/save.html +++ b/src/main/resources/static/route/classplan/save.html @@ -403,6 +403,15 @@ layer.msg('请至少选择一节课程'); return; } + // 校验时间 + if(verifyDate(formData.field['planStartTime'],formData.field['planEndTime']) == 1){ + layer.msg('培训开始时间不能大于结束时间'); + return; + } + if(verifyDate(formData.field['signUpStartTime'],formData.field['signUpEndTime']) == 1){ + layer.msg('报名开始时间不能大于结束时间'); + return; + } formData.field['lessonList'] = lessonList; top.dialog.confirm(top.dataMessage.commit, function(index) { top.dialog.close(index); @@ -435,6 +444,20 @@ parent.layer.close(parent.layer.getFrameIndex(window.name)); } + function verifyDate(value1,value2){ + var v1 = new Date(Date.parse(value1.replace(/-/g,"/"))).getTime(); + var v2 = new Date(Date.parse(value2.replace(/-/g,"/"))).getTime(); + if( v1 < v2){ + return -1; + } + if( v1 == v2){ + return 0; + } + if( v1 > v2){ + return 1; + } + } + $('.close').on('click', function() { closeBox(); }); diff --git a/src/main/resources/static/route/classplan/update-report-exam.html b/src/main/resources/static/route/classplan/update-report-exam.html index f99120d..0598570 100644 --- a/src/main/resources/static/route/classplan/update-report-exam.html +++ b/src/main/resources/static/route/classplan/update-report-exam.html @@ -81,11 +81,13 @@ laydate.render({ elem: '#estimateStart', format: 'yyyy-MM-dd', + trigger: 'click', value : estimateStart.substring(0,10) }); laydate.render({ elem: '#estimateEnd', format: 'yyyy-MM-dd', + trigger: 'click', value : estimateEnd.substring(0,10) }); //判断审核状态0审核中 @@ -109,6 +111,11 @@ // 提交表单 form.on('submit(submitForm)', function(formData) { + // 校验时间 + if(verifyDate(formData.field['estimateStart'],formData.field['estimateEnd']) == 1){ + layer.msg('预计考试开始时间不能大于结束时间'); + return; + } top.dialog.confirm(top.dataMessage.commit, function(index) { top.dialog.close(index); var loadLayerIndex; @@ -130,6 +137,20 @@ closeBox(); }); + function verifyDate(value1,value2){ + var v1 = new Date(Date.parse(value1.replace(/-/g,"/"))).getTime(); + var v2 = new Date(Date.parse(value2.replace(/-/g,"/"))).getTime(); + if( v1 < v2){ + return -1; + } + if( v1 == v2){ + return 0; + } + if( v1 > v2){ + return 1; + } + } + function closeBox() { parent.layer.close(parent.layer.getFrameIndex(window.name)); }