Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SQL上线时可执行时间范围前端优化 (hhyo#1259) #1279

Merged
merged 1 commit into from
Dec 11, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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