Skip to content

Commit

Permalink
Merge pull request #1279 from weideguo/master
Browse files Browse the repository at this point in the history
SQL上线时可执行时间范围前端优化 (#1259)
  • Loading branch information
hhyo committed Dec 11, 2021
2 parents 604943c + ae8636c commit 4a5857b
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions sql/templates/sqlsubmit.html
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ <h4 class="modal-title text-danger">提交信息确认</h4>
var formSubmit = $("#form-submitsql");
var sqlContent = editor.getValue();
$("#sql_content").val(sqlContent);
if (validateForm(formSubmit)) {
if (validateForm(formSubmit) && checkRunDate()) {
//判断是否需要弹出提示
var CheckWarningCount = sessionStorage.getItem('CheckWarningCount');
var CheckErrorCount = sessionStorage.getItem('CheckErrorCount');
Expand Down Expand Up @@ -413,14 +413,30 @@ <h4 class="modal-title text-danger">提交信息确认</h4>
</script>
<!--check-->
<script>
function checkRunDate(gap=60) {
// 结束时间与开始时间的间隔不应该太短
var start=$("#run_date_start").val();
var end=$("#run_date_end").val();
if (start && end) {
var realGap = ((new Date(end)).getTime() - (new Date(start)).getTime())/(1000*60)
if ( realGap >= gap){
return true
} else {
alert("可执行时间范围不应该短于"+gap+"分钟");
return false
}
}
return true
};

$("#btn-autoreview").click(function () {
$('input[type=button]').addClass('disabled');
$('input[type=button]').prop('disabled', true);
//先做表单验证成功了提交ajax给后端
let formSubmit = $("#form-submitsql");
var sqlContent = editor.getValue();
$("#sql_content").val(sqlContent);
if (validateForm(formSubmit)) {
if (validateForm(formSubmit) && checkRunDate()) {
autoreview();
} else {
$("#btn-format").removeClass('disabled');
Expand Down

0 comments on commit 4a5857b

Please sign in to comment.