fastadmin/public/assets/js/backend/general/database.js

34 lines
1.3 KiB
JavaScript

define(['jquery', 'bootstrap', 'backend'], function ($, undefined, Backend) {
var Controller = {
index: function () {
//禁止在操作select元素时关闭dropdown的关闭事件
$("#database").on('click', '.dropdown-menu input, .dropdown-menu label, .dropdown-menu select', function (e) {
e.stopPropagation();
});
//提交时检查是否有删除或清空操作
$("#database").on("submit", "#sqlexecute", function () {
var v = $("#sqlquery").val().toLowerCase();
if ((v.indexOf("delete ") >= 0 || v.indexOf("truncate ") >= 0) && !confirm(__('Are you sure you want to delete or turncate?'))) {
return false;
}
});
//事件按钮操作
$("#database").on("click", "ul#subaction li input", function () {
$("#topaction").val($(this).attr("rel"));
return true;
});
//窗口变更的时候重设结果栏高度
$(window).on("resize", function () {
$("#database .well").height($(window).height() - $("#database #sqlexecute").height() - $("#ribbon").outerHeight() - $(".panel-heading").outerHeight() - 130);
});
$(window).resize();
}
};
return Controller;
});