mirror of https://gitee.com/y_project/RuoYi.git
格式化前端代码
parent
896cbb0842
commit
707b51b247
|
@ -24,9 +24,9 @@ $(function() {
|
||||||
// 菜单切换
|
// 菜单切换
|
||||||
$('.navbar-minimalize').click(function() {
|
$('.navbar-minimalize').click(function() {
|
||||||
if (isMobile) {
|
if (isMobile) {
|
||||||
$("body").toggleClass("canvas-menu");
|
$("body").toggleClass("canvas-menu");
|
||||||
} else {
|
} else {
|
||||||
$("body").toggleClass("mini-navbar");
|
$("body").toggleClass("mini-navbar");
|
||||||
}
|
}
|
||||||
SmoothlyMenu();
|
SmoothlyMenu();
|
||||||
});
|
});
|
||||||
|
@ -62,12 +62,12 @@ $(window).bind("load resize", function() {
|
||||||
$('.navbar-static-side').fadeOut();
|
$('.navbar-static-side').fadeOut();
|
||||||
} else {
|
} else {
|
||||||
if($('body').hasClass('canvas-menu')) {
|
if($('body').hasClass('canvas-menu')) {
|
||||||
$('body').addClass('fixed-sidebar');
|
$('body').addClass('fixed-sidebar');
|
||||||
$('body').removeClass('canvas-menu');
|
$('body').removeClass('canvas-menu');
|
||||||
$("body").removeClass("mini-navbar");
|
$("body").removeClass("mini-navbar");
|
||||||
$("nav .logo").removeClass("hide");
|
$("nav .logo").removeClass("hide");
|
||||||
$(".slimScrollDiv").css({ "overflow": "visible" });
|
$(".slimScrollDiv").css({ "overflow": "visible" });
|
||||||
$('.navbar-static-side').fadeIn();
|
$('.navbar-static-side').fadeIn();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -89,7 +89,7 @@ function syncMenuTab(dataId) {
|
||||||
$("#tab_" + menuId + " a").click();
|
$("#tab_" + menuId + " a").click();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function NavToggle() {
|
function NavToggle() {
|
||||||
|
@ -97,12 +97,11 @@ function NavToggle() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function fixedSidebar() {
|
function fixedSidebar() {
|
||||||
$('#side-menu').hide();
|
$('#side-menu').hide();
|
||||||
$("nav .logo").addClass("hide");
|
$("nav .logo").addClass("hide");
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
$('#side-menu').fadeIn(500);
|
$('#side-menu').fadeIn(500);
|
||||||
},
|
}, 100);
|
||||||
100);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function SmoothlyMenu() {
|
function SmoothlyMenu() {
|
||||||
|
@ -263,8 +262,8 @@ $(function() {
|
||||||
|
|
||||||
var $dataObj = $('a[href$="' + decodeURI(dataUrl) + '"]');
|
var $dataObj = $('a[href$="' + decodeURI(dataUrl) + '"]');
|
||||||
if (!$dataObj.hasClass("noactive")) {
|
if (!$dataObj.hasClass("noactive")) {
|
||||||
$('.tab-pane li').removeClass("active");
|
$('.tab-pane li').removeClass("active");
|
||||||
$('.nav ul').removeClass("in");
|
$('.nav ul').removeClass("in");
|
||||||
$dataObj.parents("ul").addClass("in")
|
$dataObj.parents("ul").addClass("in")
|
||||||
$dataObj.parents("li").addClass("active").siblings().removeClass("active").find('li').removeClass("active");
|
$dataObj.parents("li").addClass("active").siblings().removeClass("active").find('li').removeClass("active");
|
||||||
$dataObj.parents("ul").css('height', 'auto').height();
|
$dataObj.parents("ul").css('height', 'auto').height();
|
||||||
|
@ -395,7 +394,7 @@ $(function() {
|
||||||
$(this).show().siblings('.RuoYi_iframe').hide();
|
$(this).show().siblings('.RuoYi_iframe').hide();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -450,14 +449,14 @@ $(function() {
|
||||||
var currentId = $('.page-tabs-content').find('.active').attr('data-id');
|
var currentId = $('.page-tabs-content').find('.active').attr('data-id');
|
||||||
var target = $('.RuoYi_iframe[data-id="' + currentId + '"]');
|
var target = $('.RuoYi_iframe[data-id="' + currentId + '"]');
|
||||||
var url = target.attr('src');
|
var url = target.attr('src');
|
||||||
target.attr('src', url).ready();
|
target.attr('src', url).ready();
|
||||||
}
|
}
|
||||||
|
|
||||||
// 页签全屏
|
// 页签全屏
|
||||||
function fullScreenTab() {
|
function fullScreenTab() {
|
||||||
var currentId = $('.page-tabs-content').find('.active').attr('data-id');
|
var currentId = $('.page-tabs-content').find('.active').attr('data-id');
|
||||||
var target = $('.RuoYi_iframe[data-id="' + currentId + '"]');
|
var target = $('.RuoYi_iframe[data-id="' + currentId + '"]');
|
||||||
target.fullScreen(true);
|
target.fullScreen(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 关闭当前选项卡
|
// 关闭当前选项卡
|
||||||
|
@ -538,11 +537,11 @@ $(function() {
|
||||||
// 设置锚点
|
// 设置锚点
|
||||||
function setIframeUrl(href) {
|
function setIframeUrl(href) {
|
||||||
if($.common.equals("history", mode)) {
|
if($.common.equals("history", mode)) {
|
||||||
storage.set('publicPath', href);
|
storage.set('publicPath', href);
|
||||||
} else {
|
} else {
|
||||||
var nowUrl = window.location.href;
|
var nowUrl = window.location.href;
|
||||||
var newUrl = nowUrl.substring(0, nowUrl.indexOf("#"));
|
var newUrl = nowUrl.substring(0, nowUrl.indexOf("#"));
|
||||||
window.location.href = newUrl + "#" + href;
|
window.location.href = newUrl + "#" + href;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -569,14 +568,14 @@ $(function() {
|
||||||
name: "关闭当前",
|
name: "关闭当前",
|
||||||
icon: "fa-close",
|
icon: "fa-close",
|
||||||
callback: function(key, opt) {
|
callback: function(key, opt) {
|
||||||
opt.$trigger.find('i').trigger("click");
|
opt.$trigger.find('i').trigger("click");
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"close_other": {
|
"close_other": {
|
||||||
name: "关闭其他",
|
name: "关闭其他",
|
||||||
icon: "fa-window-close-o",
|
icon: "fa-window-close-o",
|
||||||
callback: function(key, opt) {
|
callback: function(key, opt) {
|
||||||
setActiveTab(this);
|
setActiveTab(this);
|
||||||
tabCloseOther();
|
tabCloseOther();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -584,23 +583,23 @@ $(function() {
|
||||||
name: "关闭左侧",
|
name: "关闭左侧",
|
||||||
icon: "fa-reply",
|
icon: "fa-reply",
|
||||||
callback: function(key, opt) {
|
callback: function(key, opt) {
|
||||||
setActiveTab(this);
|
setActiveTab(this);
|
||||||
this.prevAll('.menuTab').not(":last").each(function() {
|
this.prevAll('.menuTab').not(":last").each(function() {
|
||||||
if ($(this).hasClass('active')) {
|
if ($(this).hasClass('active')) {
|
||||||
setActiveTab(this);
|
setActiveTab(this);
|
||||||
}
|
}
|
||||||
$('.RuoYi_iframe[data-id="' + $(this).data('id') + '"]').remove();
|
$('.RuoYi_iframe[data-id="' + $(this).data('id') + '"]').remove();
|
||||||
$(this).remove();
|
$(this).remove();
|
||||||
});
|
});
|
||||||
$('.page-tabs-content').css("margin-left", "0");
|
$('.page-tabs-content').css("margin-left", "0");
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"close_right": {
|
"close_right": {
|
||||||
name: "关闭右侧",
|
name: "关闭右侧",
|
||||||
icon: "fa-share",
|
icon: "fa-share",
|
||||||
callback: function(key, opt) {
|
callback: function(key, opt) {
|
||||||
setActiveTab(this);
|
setActiveTab(this);
|
||||||
this.nextAll('.menuTab').each(function() {
|
this.nextAll('.menuTab').each(function() {
|
||||||
$('.menuTab[data-id="' + $(this).data('id') + '"]').remove();
|
$('.menuTab[data-id="' + $(this).data('id') + '"]').remove();
|
||||||
$(this).remove();
|
$(this).remove();
|
||||||
});
|
});
|
||||||
|
@ -618,18 +617,18 @@ $(function() {
|
||||||
name: "全屏显示",
|
name: "全屏显示",
|
||||||
icon: "fa-arrows-alt",
|
icon: "fa-arrows-alt",
|
||||||
callback: function(key, opt) {
|
callback: function(key, opt) {
|
||||||
setActiveTab(this);
|
setActiveTab(this);
|
||||||
var target = $('.RuoYi_iframe[data-id="' + this.data('id') + '"]');
|
var target = $('.RuoYi_iframe[data-id="' + this.data('id') + '"]');
|
||||||
target.fullScreen(true);
|
target.fullScreen(true);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"refresh": {
|
"refresh": {
|
||||||
name: "刷新页面",
|
name: "刷新页面",
|
||||||
icon: "fa-refresh",
|
icon: "fa-refresh",
|
||||||
callback: function(key, opt) {
|
callback: function(key, opt) {
|
||||||
setActiveTab(this);
|
setActiveTab(this);
|
||||||
var target = $('.RuoYi_iframe[data-id="' + this.data('id') + '"]');
|
var target = $('.RuoYi_iframe[data-id="' + this.data('id') + '"]');
|
||||||
var url = target.attr('src');
|
var url = target.attr('src');
|
||||||
$.modal.loading("数据加载中,请稍后...");
|
$.modal.loading("数据加载中,请稍后...");
|
||||||
target.attr('src', url).load(function () {
|
target.attr('src', url).load(function () {
|
||||||
$.modal.closeLoading();
|
$.modal.closeLoading();
|
||||||
|
@ -640,7 +639,7 @@ $(function() {
|
||||||
name: "新窗口打开",
|
name: "新窗口打开",
|
||||||
icon: "fa-link",
|
icon: "fa-link",
|
||||||
callback: function(key, opt) {
|
callback: function(key, opt) {
|
||||||
var target = $('.RuoYi_iframe[data-id="' + this.data('id') + '"]');
|
var target = $('.RuoYi_iframe[data-id="' + this.data('id') + '"]');
|
||||||
window.open(target.attr('src'));
|
window.open(target.attr('src'));
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
@ -4,187 +4,187 @@
|
||||||
*/
|
*/
|
||||||
$(function() {
|
$(function() {
|
||||||
|
|
||||||
// layer扩展皮肤
|
// layer扩展皮肤
|
||||||
if (window.layer !== undefined) {
|
if (window.layer !== undefined) {
|
||||||
layer.config({
|
layer.config({
|
||||||
extend: 'moon/style.css',
|
extend: 'moon/style.css',
|
||||||
skin: 'layer-ext-moon'
|
skin: 'layer-ext-moon'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// 回到顶部绑定
|
// 回到顶部绑定
|
||||||
if ($.fn.toTop !== undefined) {
|
if ($.fn.toTop !== undefined) {
|
||||||
$('#scroll-up').toTop();
|
$('#scroll-up').toTop();
|
||||||
}
|
}
|
||||||
|
|
||||||
// select2复选框事件绑定
|
// select2复选框事件绑定
|
||||||
if ($.fn.select2 !== undefined) {
|
if ($.fn.select2 !== undefined) {
|
||||||
$.fn.select2.defaults.set( "theme", "bootstrap" );
|
$.fn.select2.defaults.set( "theme", "bootstrap" );
|
||||||
$("select.form-control:not(.noselect2)").each(function () {
|
$("select.form-control:not(.noselect2)").each(function () {
|
||||||
$(this).select2().on("change", function () {
|
$(this).select2().on("change", function () {
|
||||||
$(this).valid();
|
$(this).valid();
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// iCheck单选框及复选框事件绑定
|
// iCheck单选框及复选框事件绑定
|
||||||
if ($.fn.iCheck !== undefined) {
|
if ($.fn.iCheck !== undefined) {
|
||||||
$(".check-box:not(.noicheck),.radio-box:not(.noicheck)").each(function() {
|
$(".check-box:not(.noicheck),.radio-box:not(.noicheck)").each(function() {
|
||||||
$(this).iCheck({
|
$(this).iCheck({
|
||||||
checkboxClass: 'icheckbox-blue',
|
checkboxClass: 'icheckbox-blue',
|
||||||
radioClass: 'iradio-blue',
|
radioClass: 'iradio-blue',
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// 气泡弹出框特效(移到元素时)
|
// 气泡弹出框特效(移到元素时)
|
||||||
$(document).on("mouseenter", '.table [data-toggle="popover"]', function() {
|
$(document).on("mouseenter", '.table [data-toggle="popover"]', function() {
|
||||||
var _this = this;
|
var _this = this;
|
||||||
$(this).popover("show");
|
$(this).popover("show");
|
||||||
$(".popover").on("mouseleave", function() {
|
$(".popover").on("mouseleave", function() {
|
||||||
$(_this).popover('hide');
|
$(_this).popover('hide');
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
|
|
||||||
// 气泡弹出框特效(离开元素时)
|
// 气泡弹出框特效(离开元素时)
|
||||||
$(document).on("mouseleave", '.table [data-toggle="popover"]', function() {
|
$(document).on("mouseleave", '.table [data-toggle="popover"]', function() {
|
||||||
var _this = this;
|
var _this = this;
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
if (!$(".popover:hover").length) $(_this).popover("hide");
|
if (!$(".popover:hover").length) $(_this).popover("hide");
|
||||||
}, 100);
|
}, 100);
|
||||||
});
|
});
|
||||||
|
|
||||||
// 取消回车自动提交表单
|
// 取消回车自动提交表单
|
||||||
$(document).on("keypress", ":input:not(textarea):not([type=submit])", function(event) {
|
$(document).on("keypress", ":input:not(textarea):not([type=submit])", function(event) {
|
||||||
if (event.keyCode == 13) {
|
if (event.keyCode == 13) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// laydate 时间控件绑定
|
// laydate 时间控件绑定
|
||||||
if ($(".select-time").length > 0) {
|
if ($(".select-time").length > 0) {
|
||||||
layui.use('laydate', function() {
|
layui.use('laydate', function() {
|
||||||
var laydate = layui.laydate;
|
var laydate = layui.laydate;
|
||||||
var startDate = laydate.render({
|
var startDate = laydate.render({
|
||||||
elem: '#startTime',
|
elem: '#startTime',
|
||||||
max: $('#endTime').val(),
|
max: $('#endTime').val(),
|
||||||
theme: 'molv',
|
theme: 'molv',
|
||||||
trigger: 'click',
|
trigger: 'click',
|
||||||
done: function(value, date) {
|
done: function(value, date) {
|
||||||
// 结束时间大于开始时间
|
// 结束时间大于开始时间
|
||||||
if (value !== '') {
|
if (value !== '') {
|
||||||
endDate.config.min.year = date.year;
|
endDate.config.min.year = date.year;
|
||||||
endDate.config.min.month = date.month - 1;
|
endDate.config.min.month = date.month - 1;
|
||||||
endDate.config.min.date = date.date;
|
endDate.config.min.date = date.date;
|
||||||
} else {
|
} else {
|
||||||
endDate.config.min.year = '';
|
endDate.config.min.year = '';
|
||||||
endDate.config.min.month = '';
|
endDate.config.min.month = '';
|
||||||
endDate.config.min.date = '';
|
endDate.config.min.date = '';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
var endDate = laydate.render({
|
var endDate = laydate.render({
|
||||||
elem: '#endTime',
|
elem: '#endTime',
|
||||||
min: $('#startTime').val(),
|
min: $('#startTime').val(),
|
||||||
theme: 'molv',
|
theme: 'molv',
|
||||||
trigger: 'click',
|
trigger: 'click',
|
||||||
done: function(value, date) {
|
done: function(value, date) {
|
||||||
// 开始时间小于结束时间
|
// 开始时间小于结束时间
|
||||||
if (value !== '') {
|
if (value !== '') {
|
||||||
startDate.config.max.year = date.year;
|
startDate.config.max.year = date.year;
|
||||||
startDate.config.max.month = date.month - 1;
|
startDate.config.max.month = date.month - 1;
|
||||||
startDate.config.max.date = date.date;
|
startDate.config.max.date = date.date;
|
||||||
} else {
|
} else {
|
||||||
startDate.config.max.year = '2099';
|
startDate.config.max.year = '2099';
|
||||||
startDate.config.max.month = '12';
|
startDate.config.max.month = '12';
|
||||||
startDate.config.max.date = '31';
|
startDate.config.max.date = '31';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// laydate time-input 时间控件绑定
|
// laydate time-input 时间控件绑定
|
||||||
if ($(".time-input").length > 0) {
|
if ($(".time-input").length > 0) {
|
||||||
layui.use('laydate', function () {
|
layui.use('laydate', function () {
|
||||||
var com = layui.laydate;
|
var com = layui.laydate;
|
||||||
$(".time-input").each(function (index, item) {
|
$(".time-input").each(function (index, item) {
|
||||||
var time = $(item);
|
var time = $(item);
|
||||||
// 控制控件外观
|
// 控制控件外观
|
||||||
var type = time.attr("data-type") || 'date';
|
var type = time.attr("data-type") || 'date';
|
||||||
// 控制回显格式
|
// 控制回显格式
|
||||||
var format = time.attr("data-format") || 'yyyy-MM-dd';
|
var format = time.attr("data-format") || 'yyyy-MM-dd';
|
||||||
// 控制日期控件按钮
|
// 控制日期控件按钮
|
||||||
var buttons = time.attr("data-btn") || 'clear|now|confirm', newBtnArr = [];
|
var buttons = time.attr("data-btn") || 'clear|now|confirm', newBtnArr = [];
|
||||||
// 日期控件选择完成后回调处理
|
// 日期控件选择完成后回调处理
|
||||||
var callback = time.attr("data-callback") || {};
|
var callback = time.attr("data-callback") || {};
|
||||||
if (buttons) {
|
if (buttons) {
|
||||||
if (buttons.indexOf("|") > 0) {
|
if (buttons.indexOf("|") > 0) {
|
||||||
var btnArr = buttons.split("|"), btnLen = btnArr.length;
|
var btnArr = buttons.split("|"), btnLen = btnArr.length;
|
||||||
for (var j = 0; j < btnLen; j++) {
|
for (var j = 0; j < btnLen; j++) {
|
||||||
if ("clear" === btnArr[j] || "now" === btnArr[j] || "confirm" === btnArr[j]) {
|
if ("clear" === btnArr[j] || "now" === btnArr[j] || "confirm" === btnArr[j]) {
|
||||||
newBtnArr.push(btnArr[j]);
|
newBtnArr.push(btnArr[j]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if ("clear" === buttons || "now" === buttons || "confirm" === buttons) {
|
if ("clear" === buttons || "now" === buttons || "confirm" === buttons) {
|
||||||
newBtnArr.push(buttons);
|
newBtnArr.push(buttons);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
newBtnArr = ['clear', 'now', 'confirm'];
|
newBtnArr = ['clear', 'now', 'confirm'];
|
||||||
}
|
}
|
||||||
com.render({
|
com.render({
|
||||||
elem: item,
|
elem: item,
|
||||||
theme: 'molv',
|
theme: 'molv',
|
||||||
trigger: 'click',
|
trigger: 'click',
|
||||||
type: type,
|
type: type,
|
||||||
format: format,
|
format: format,
|
||||||
btns: newBtnArr,
|
btns: newBtnArr,
|
||||||
done: function (value, data) {
|
done: function (value, data) {
|
||||||
if (typeof window[callback] != 'undefined'
|
if (typeof window[callback] != 'undefined'
|
||||||
&& window[callback] instanceof Function) {
|
&& window[callback] instanceof Function) {
|
||||||
window[callback](value, data);
|
window[callback](value, data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// tree 关键字搜索绑定
|
// tree 关键字搜索绑定
|
||||||
if ($("#keyword").length > 0) {
|
if ($("#keyword").length > 0) {
|
||||||
$("#keyword").bind("focus", function focusKey(e) {
|
$("#keyword").bind("focus", function focusKey(e) {
|
||||||
if ($("#keyword").hasClass("empty")) {
|
if ($("#keyword").hasClass("empty")) {
|
||||||
$("#keyword").removeClass("empty");
|
$("#keyword").removeClass("empty");
|
||||||
}
|
}
|
||||||
}).bind("blur", function blurKey(e) {
|
}).bind("blur", function blurKey(e) {
|
||||||
if ($("#keyword").val() === "") {
|
if ($("#keyword").val() === "") {
|
||||||
$("#keyword").addClass("empty");
|
$("#keyword").addClass("empty");
|
||||||
}
|
}
|
||||||
$.tree.searchNode(e);
|
$.tree.searchNode(e);
|
||||||
}).bind("input propertychange", $.tree.searchNode);
|
}).bind("input propertychange", $.tree.searchNode);
|
||||||
}
|
}
|
||||||
|
|
||||||
// tree表格树 展开/折叠
|
// tree表格树 展开/折叠
|
||||||
var expandFlag;
|
var expandFlag;
|
||||||
$("#expandAllBtn").click(function() {
|
$("#expandAllBtn").click(function() {
|
||||||
var dataExpand = $.common.isEmpty(table.options.expandAll) ? true : table.options.expandAll;
|
var dataExpand = $.common.isEmpty(table.options.expandAll) ? true : table.options.expandAll;
|
||||||
expandFlag = $.common.isEmpty(expandFlag) ? dataExpand : expandFlag;
|
expandFlag = $.common.isEmpty(expandFlag) ? dataExpand : expandFlag;
|
||||||
if (!expandFlag) {
|
if (!expandFlag) {
|
||||||
$.bttTable.bootstrapTreeTable('expandAll');
|
$.bttTable.bootstrapTreeTable('expandAll');
|
||||||
} else {
|
} else {
|
||||||
$.bttTable.bootstrapTreeTable('collapseAll');
|
$.bttTable.bootstrapTreeTable('collapseAll');
|
||||||
}
|
}
|
||||||
expandFlag = expandFlag ? false: true;
|
expandFlag = expandFlag ? false: true;
|
||||||
})
|
})
|
||||||
|
|
||||||
// 按下ESC按钮关闭弹层
|
// 按下ESC按钮关闭弹层
|
||||||
$('body', document).on('keyup', function(e) {
|
$('body', document).on('keyup', function(e) {
|
||||||
if (e.which === 27) {
|
if (e.which === 27) {
|
||||||
$.modal.closeAll();
|
$.modal.closeAll();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
(function ($) {
|
(function ($) {
|
||||||
|
@ -233,8 +233,8 @@ $(function() {
|
||||||
/** 刷新选项卡 */
|
/** 刷新选项卡 */
|
||||||
var refreshItem = function(){
|
var refreshItem = function(){
|
||||||
var topWindow = $(window.parent.document);
|
var topWindow = $(window.parent.document);
|
||||||
var currentId = $('.page-tabs-content', topWindow).find('.active').attr('data-id');
|
var currentId = $('.page-tabs-content', topWindow).find('.active').attr('data-id');
|
||||||
var target = $('.RuoYi_iframe[data-id="' + currentId + '"]', topWindow);
|
var target = $('.RuoYi_iframe[data-id="' + currentId + '"]', topWindow);
|
||||||
var url = target.attr('src');
|
var url = target.attr('src');
|
||||||
target.attr('src', url).ready();
|
target.attr('src', url).ready();
|
||||||
}
|
}
|
||||||
|
@ -243,29 +243,29 @@ var refreshItem = function(){
|
||||||
var closeItem = function(dataId){
|
var closeItem = function(dataId){
|
||||||
var topWindow = $(window.parent.document);
|
var topWindow = $(window.parent.document);
|
||||||
if($.common.isNotEmpty(dataId)){
|
if($.common.isNotEmpty(dataId)){
|
||||||
window.parent.$.modal.closeLoading();
|
window.parent.$.modal.closeLoading();
|
||||||
// 根据dataId关闭指定选项卡
|
// 根据dataId关闭指定选项卡
|
||||||
$('.menuTab[data-id="' + dataId + '"]', topWindow).remove();
|
$('.menuTab[data-id="' + dataId + '"]', topWindow).remove();
|
||||||
// 移除相应tab对应的内容区
|
// 移除相应tab对应的内容区
|
||||||
$('.mainContent .RuoYi_iframe[data-id="' + dataId + '"]', topWindow).remove();
|
$('.mainContent .RuoYi_iframe[data-id="' + dataId + '"]', topWindow).remove();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var panelUrl = window.frameElement.getAttribute('data-panel');
|
var panelUrl = window.frameElement.getAttribute('data-panel');
|
||||||
$('.page-tabs-content .active i', topWindow).click();
|
$('.page-tabs-content .active i', topWindow).click();
|
||||||
if($.common.isNotEmpty(panelUrl)){
|
if($.common.isNotEmpty(panelUrl)){
|
||||||
$('.menuTab[data-id="' + panelUrl + '"]', topWindow).addClass('active').siblings('.menuTab').removeClass('active');
|
$('.menuTab[data-id="' + panelUrl + '"]', topWindow).addClass('active').siblings('.menuTab').removeClass('active');
|
||||||
$('.mainContent .RuoYi_iframe', topWindow).each(function() {
|
$('.mainContent .RuoYi_iframe', topWindow).each(function() {
|
||||||
if ($(this).data('id') == panelUrl) {
|
if ($(this).data('id') == panelUrl) {
|
||||||
$(this).show().siblings('.RuoYi_iframe').hide();
|
$(this).show().siblings('.RuoYi_iframe').hide();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 创建选项卡 */
|
/** 创建选项卡 */
|
||||||
function createMenuItem(dataUrl, menuName) {
|
function createMenuItem(dataUrl, menuName) {
|
||||||
var panelUrl = window.frameElement.getAttribute('data-id');
|
var panelUrl = window.frameElement.getAttribute('data-id');
|
||||||
dataIndex = $.common.random(1, 100),
|
dataIndex = $.common.random(1, 100),
|
||||||
flag = true;
|
flag = true;
|
||||||
if (dataUrl == undefined || $.trim(dataUrl).length == 0) return false;
|
if (dataUrl == undefined || $.trim(dataUrl).length == 0) return false;
|
||||||
|
@ -300,7 +300,7 @@ function createMenuItem(dataUrl, menuName) {
|
||||||
|
|
||||||
window.parent.$.modal.loading("数据加载中,请稍后...");
|
window.parent.$.modal.loading("数据加载中,请稍后...");
|
||||||
$('.mainContent iframe:visible', topWindow).load(function () {
|
$('.mainContent iframe:visible', topWindow).load(function () {
|
||||||
window.parent.$.modal.closeLoading();
|
window.parent.$.modal.closeLoading();
|
||||||
});
|
});
|
||||||
|
|
||||||
// 添加选项卡
|
// 添加选项卡
|
||||||
|
@ -312,7 +312,7 @@ function createMenuItem(dataUrl, menuName) {
|
||||||
|
|
||||||
// 滚动到指定选项卡
|
// 滚动到指定选项卡
|
||||||
function scrollToTab(element) {
|
function scrollToTab(element) {
|
||||||
var topWindow = $(window.parent.document);
|
var topWindow = $(window.parent.document);
|
||||||
var marginLeftVal = calSumWidth($(element).prevAll()),
|
var marginLeftVal = calSumWidth($(element).prevAll()),
|
||||||
marginRightVal = calSumWidth($(element).nextAll());
|
marginRightVal = calSumWidth($(element).nextAll());
|
||||||
// 可视区域非tab宽度
|
// 可视区域非tab宽度
|
||||||
|
@ -349,28 +349,28 @@ function calSumWidth(elements) {
|
||||||
|
|
||||||
/** 密码规则范围验证 */
|
/** 密码规则范围验证 */
|
||||||
function checkpwd(chrtype, password) {
|
function checkpwd(chrtype, password) {
|
||||||
if (chrtype == 1) {
|
if (chrtype == 1) {
|
||||||
if(!$.common.numValid(password)){
|
if(!$.common.numValid(password)){
|
||||||
$.modal.alertWarning("密码只能为0-9数字");
|
$.modal.alertWarning("密码只能为0-9数字");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} else if (chrtype == 2) {
|
} else if (chrtype == 2) {
|
||||||
if(!$.common.enValid(password)){
|
if(!$.common.enValid(password)){
|
||||||
$.modal.alertWarning("密码只能为a-z和A-Z字母");
|
$.modal.alertWarning("密码只能为a-z和A-Z字母");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} else if (chrtype == 3) {
|
} else if (chrtype == 3) {
|
||||||
if(!$.common.enNumValid(password)){
|
if(!$.common.enNumValid(password)){
|
||||||
$.modal.alertWarning("密码必须包含字母以及数字");
|
$.modal.alertWarning("密码必须包含字母以及数字");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} else if (chrtype == 4) {
|
} else if (chrtype == 4) {
|
||||||
if(!$.common.charValid(password)){
|
if(!$.common.charValid(password)){
|
||||||
$.modal.alertWarning("密码必须包含字母、数字、以及特殊符号<font color='red'>~!@#$%^&*()-=_+</font>");
|
$.modal.alertWarning("密码必须包含字母、数字、以及特殊符号<font color='red'>~!@#$%^&*()-=_+</font>");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 日志打印封装处理
|
// 日志打印封装处理
|
||||||
|
@ -411,21 +411,21 @@ var sub = {
|
||||||
var count = $("#" + table.options.id).bootstrapTable('getData').length;
|
var count = $("#" + table.options.id).bootstrapTable('getData').length;
|
||||||
var params = new Array();
|
var params = new Array();
|
||||||
for (var dataIndex = 0; dataIndex <= count; dataIndex++) {
|
for (var dataIndex = 0; dataIndex <= count; dataIndex++) {
|
||||||
var columns = $('#' + table.options.id + ' tr[data-index="' + dataIndex + '"] td');
|
var columns = $('#' + table.options.id + ' tr[data-index="' + dataIndex + '"] td');
|
||||||
var obj = new Object();
|
var obj = new Object();
|
||||||
for (var i = 0; i < columns.length; i++) {
|
for (var i = 0; i < columns.length; i++) {
|
||||||
var inputValue = $(columns[i]).find('input');
|
var inputValue = $(columns[i]).find('input');
|
||||||
var selectValue = $(columns[i]).find('select');
|
var selectValue = $(columns[i]).find('select');
|
||||||
var key = table.options.columns[i].field;
|
var key = table.options.columns[i].field;
|
||||||
if ($.common.isNotEmpty(inputValue.val())) {
|
if ($.common.isNotEmpty(inputValue.val())) {
|
||||||
obj[key] = inputValue.val();
|
obj[key] = inputValue.val();
|
||||||
} else if ($.common.isNotEmpty(selectValue.val())) {
|
} else if ($.common.isNotEmpty(selectValue.val())) {
|
||||||
obj[key] = selectValue.val();
|
obj[key] = selectValue.val();
|
||||||
} else {
|
} else {
|
||||||
obj[key] = "";
|
obj[key] = "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
params.push({ index: dataIndex, row: obj });
|
params.push({ index: dataIndex, row: obj });
|
||||||
}
|
}
|
||||||
$("#" + table.options.id).bootstrapTable("updateRow", params);
|
$("#" + table.options.id).bootstrapTable("updateRow", params);
|
||||||
},
|
},
|
||||||
|
@ -445,12 +445,12 @@ var sub = {
|
||||||
$.ajaxSetup({
|
$.ajaxSetup({
|
||||||
complete: function(XMLHttpRequest, textStatus) {
|
complete: function(XMLHttpRequest, textStatus) {
|
||||||
if (textStatus == 'timeout') {
|
if (textStatus == 'timeout') {
|
||||||
$.modal.alertWarning("服务器超时,请稍后再试!");
|
$.modal.alertWarning("服务器超时,请稍后再试!");
|
||||||
$.modal.enable();
|
$.modal.enable();
|
||||||
$.modal.closeLoading();
|
$.modal.closeLoading();
|
||||||
} else if (textStatus == "parsererror" || textStatus == "error") {
|
} else if (textStatus == "parsererror" || textStatus == "error") {
|
||||||
$.modal.alertWarning("服务器错误,请联系管理员!");
|
$.modal.alertWarning("服务器错误,请联系管理员!");
|
||||||
$.modal.enable();
|
$.modal.enable();
|
||||||
$.modal.closeLoading();
|
$.modal.closeLoading();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,22 +1,22 @@
|
||||||
|
|
||||||
$(function() {
|
$(function() {
|
||||||
validateKickout();
|
validateKickout();
|
||||||
validateRule();
|
validateRule();
|
||||||
$('.imgcode').click(function() {
|
$('.imgcode').click(function() {
|
||||||
var url = ctx + "captcha/captchaImage?type=" + captchaType + "&s=" + Math.random();
|
var url = ctx + "captcha/captchaImage?type=" + captchaType + "&s=" + Math.random();
|
||||||
$(".imgcode").attr("src", url);
|
$(".imgcode").attr("src", url);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
$.validator.setDefaults({
|
$.validator.setDefaults({
|
||||||
submitHandler: function() {
|
submitHandler: function() {
|
||||||
login();
|
login();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
function login() {
|
function login() {
|
||||||
$.modal.loading($("#btnSubmit").data("loading"));
|
$.modal.loading($("#btnSubmit").data("loading"));
|
||||||
var username = $.common.trim($("input[name='username']").val());
|
var username = $.common.trim($("input[name='username']").val());
|
||||||
var password = $.common.trim($("input[name='password']").val());
|
var password = $.common.trim($("input[name='password']").val());
|
||||||
var validateCode = $("input[name='validateCode']").val();
|
var validateCode = $("input[name='validateCode']").val();
|
||||||
var rememberMe = $("input[name='rememberme']").is(':checked');
|
var rememberMe = $("input[name='rememberme']").is(':checked');
|
||||||
|
@ -65,26 +65,26 @@ function validateRule() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function validateKickout() {
|
function validateKickout() {
|
||||||
if (getParam("kickout") == 1) {
|
if (getParam("kickout") == 1) {
|
||||||
layer.alert("<font color='red'>您已在别处登录,请您修改密码或重新登录</font>", {
|
layer.alert("<font color='red'>您已在别处登录,请您修改密码或重新登录</font>", {
|
||||||
icon: 0,
|
icon: 0,
|
||||||
title: "系统提示"
|
title: "系统提示"
|
||||||
},
|
},
|
||||||
function(index) {
|
function(index) {
|
||||||
//关闭弹窗
|
//关闭弹窗
|
||||||
layer.close(index);
|
layer.close(index);
|
||||||
if (top != self) {
|
if (top != self) {
|
||||||
top.location = self.location;
|
top.location = self.location;
|
||||||
} else {
|
} else {
|
||||||
var url = location.search;
|
var url = location.search;
|
||||||
if (url) {
|
if (url) {
|
||||||
var oldUrl = window.location.href;
|
var oldUrl = window.location.href;
|
||||||
var newUrl = oldUrl.substring(0, oldUrl.indexOf('?'));
|
var newUrl = oldUrl.substring(0, oldUrl.indexOf('?'));
|
||||||
self.location = newUrl;
|
self.location = newUrl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function getParam(paramName) {
|
function getParam(paramName) {
|
||||||
|
|
|
@ -2,9 +2,9 @@
|
||||||
$(function() {
|
$(function() {
|
||||||
validateRule();
|
validateRule();
|
||||||
$('.imgcode').click(function() {
|
$('.imgcode').click(function() {
|
||||||
var url = ctx + "captcha/captchaImage?type=" + captchaType + "&s=" + Math.random();
|
var url = ctx + "captcha/captchaImage?type=" + captchaType + "&s=" + Math.random();
|
||||||
$(".imgcode").attr("src", url);
|
$(".imgcode").attr("src", url);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
$.validator.setDefaults({
|
$.validator.setDefaults({
|
||||||
|
@ -14,8 +14,8 @@ $.validator.setDefaults({
|
||||||
});
|
});
|
||||||
|
|
||||||
function register() {
|
function register() {
|
||||||
$.modal.loading($("#btnSubmit").data("loading"));
|
$.modal.loading($("#btnSubmit").data("loading"));
|
||||||
var username = $.common.trim($("input[name='username']").val());
|
var username = $.common.trim($("input[name='username']").val());
|
||||||
var password = $.common.trim($("input[name='password']").val());
|
var password = $.common.trim($("input[name='password']").val());
|
||||||
var validateCode = $("input[name='validateCode']").val();
|
var validateCode = $("input[name='validateCode']").val();
|
||||||
$.ajax({
|
$.ajax({
|
||||||
|
@ -29,14 +29,14 @@ function register() {
|
||||||
success: function(r) {
|
success: function(r) {
|
||||||
if (r.code == 0) {
|
if (r.code == 0) {
|
||||||
layer.alert("<font color='red'>恭喜你,您的账号 " + username + " 注册成功!</font>", {
|
layer.alert("<font color='red'>恭喜你,您的账号 " + username + " 注册成功!</font>", {
|
||||||
icon: 1,
|
icon: 1,
|
||||||
title: "系统提示"
|
title: "系统提示"
|
||||||
},
|
},
|
||||||
function(index) {
|
function(index) {
|
||||||
//关闭弹窗
|
//关闭弹窗
|
||||||
layer.close(index);
|
layer.close(index);
|
||||||
location.href = ctx + 'login';
|
location.href = ctx + 'login';
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
$.modal.closeLoading();
|
$.modal.closeLoading();
|
||||||
$('.imgcode').click();
|
$('.imgcode').click();
|
||||||
|
@ -48,7 +48,7 @@ function register() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function validateRule() {
|
function validateRule() {
|
||||||
var icon = "<i class='fa fa-times-circle'></i> ";
|
var icon = "<i class='fa fa-times-circle'></i> ";
|
||||||
$("#registerForm").validate({
|
$("#registerForm").validate({
|
||||||
rules: {
|
rules: {
|
||||||
username: {
|
username: {
|
||||||
|
|
Loading…
Reference in New Issue