优化弹出层显示在顶层窗口

pull/327/head
RuoYi 2021-08-30 16:26:26 +08:00
parent f68f4824cd
commit 489ab40a8c
15 changed files with 88 additions and 66 deletions

View File

@ -3289,7 +3289,7 @@ body.body-small .footer.fixed {
nav.page-tabs { nav.page-tabs {
margin-left: 30px; margin-left: 30px;
width: 100000px; width: 100000px;
height: 38px; height: 39px;
overflow: hidden; overflow: hidden;
} }

File diff suppressed because one or more lines are too long

View File

@ -338,7 +338,7 @@ function scrollToTab(element) {
$('.page-tabs-content', topWindow).animate({ marginLeft: 0 - scrollVal + 'px' }, "fast"); $('.page-tabs-content', topWindow).animate({ marginLeft: 0 - scrollVal + 'px' }, "fast");
} }
//计算元素集合的总宽度 // 计算元素集合的总宽度
function calSumWidth(elements) { function calSumWidth(elements) {
var width = 0; var width = 0;
$(elements).each(function() { $(elements).each(function() {
@ -347,6 +347,14 @@ function calSumWidth(elements) {
return width; return width;
} }
// 返回当前激活的Tab页面关联的iframe的Windows对象
function activeWindow() {
var topWindow = $(window.parent.document);
var currentId = $('.page-tabs-content', topWindow).find('.active').attr('data-id');
var activeWindow = $('.RuoYi_iframe[data-id="' + currentId + '"]', topWindow)[0].contentWindow;
return activeWindow;
}
/** 密码规则范围验证 */ /** 密码规则范围验证 */
function checkpwd(chrtype, password) { function checkpwd(chrtype, password) {
if (chrtype == 1) { if (chrtype == 1) {

View File

@ -250,7 +250,7 @@ var table = {
if($.common.equals("self", target)) { if($.common.equals("self", target)) {
var height = $(this).data('height'); var height = $(this).data('height');
var width = $(this).data('width'); var width = $(this).data('width');
layer.open({ top.layer.open({
title: false, title: false,
type: 1, type: 1,
closeBtn: true, closeBtn: true,
@ -270,7 +270,7 @@ var table = {
input.select(); input.select();
document.execCommand("copy"); document.execCommand("copy");
} else if ($.common.equals("open", target)) { } else if ($.common.equals("open", target)) {
parent.layer.alert(input.val(), { top.layer.alert(input.val(), {
title: "信息内容", title: "信息内容",
shadeClose: true, shadeClose: true,
btn: ['确认'], btn: ['确认'],
@ -405,7 +405,7 @@ var table = {
var currentId = $.common.isEmpty(formId) ? 'importTpl' : formId; var currentId = $.common.isEmpty(formId) ? 'importTpl' : formId;
var _width = $.common.isEmpty(width) ? "400" : width; var _width = $.common.isEmpty(width) ? "400" : width;
var _height = $.common.isEmpty(height) ? "230" : height; var _height = $.common.isEmpty(height) ? "230" : height;
layer.open({ top.layer.open({
type: 1, type: 1,
area: [_width + 'px', _height + 'px'], area: [_width + 'px', _height + 'px'],
fix: false, fix: false,
@ -423,7 +423,7 @@ var table = {
$.modal.msgWarning("请选择后缀为 “xls”或“xlsx”的文件。"); $.modal.msgWarning("请选择后缀为 “xls”或“xlsx”的文件。");
return false; return false;
} }
var index = layer.load(2, {shade: false}); var index = top.layer.load(2, {shade: false});
$.modal.disable(); $.modal.disable();
var formData = new FormData(layero.find('form')[0]); var formData = new FormData(layero.find('form')[0]);
$.ajax({ $.ajax({
@ -435,15 +435,16 @@ var table = {
type: 'POST', type: 'POST',
success: function (result) { success: function (result) {
if (result.code == web_status.SUCCESS) { if (result.code == web_status.SUCCESS) {
$.modal.close(index);
$.modal.closeAll(); $.modal.closeAll();
$.modal.alertSuccess(result.msg); $.modal.alertSuccess(result.msg);
$.table.refresh(); $.table.refresh();
} else if (result.code == web_status.WARNING) { } else if (result.code == web_status.WARNING) {
layer.close(index); $.modal.close(index);
$.modal.enable(); $.modal.enable();
$.modal.alertWarning(result.msg) $.modal.alertWarning(result.msg)
} else { } else {
layer.close(index); $.modal.close(index);
$.modal.enable(); $.modal.enable();
$.modal.alertError(result.msg); $.modal.alertError(result.msg);
} }
@ -733,9 +734,9 @@ var table = {
// 消息提示 // 消息提示
msg: function(content, type) { msg: function(content, type) {
if (type != undefined) { if (type != undefined) {
layer.msg(content, { icon: $.modal.icon(type), time: 1000, shift: 5 }); top.layer.msg(content, { icon: $.modal.icon(type), time: 1000, shift: 5 });
} else { } else {
layer.msg(content); top.layer.msg(content);
} }
}, },
// 错误消息 // 错误消息
@ -752,24 +753,13 @@ var table = {
}, },
// 弹出提示 // 弹出提示
alert: function(content, type) { alert: function(content, type) {
layer.alert(content, { top.layer.alert(content, {
icon: $.modal.icon(type), icon: $.modal.icon(type),
title: "系统提示", title: "系统提示",
btn: ['确认'], btn: ['确认'],
btnclass: ['btn btn-primary'], btnclass: ['btn btn-primary'],
}); });
}, },
// 消息提示并刷新父窗体
msgReload: function(msg, type) {
layer.msg(msg, {
icon: $.modal.icon(type),
time: 500,
shade: [0.1, '#8F8F8F']
},
function() {
$.modal.reload();
});
},
// 错误提示 // 错误提示
alertError: function(content) { alertError: function(content) {
$.modal.alert(content, modal_status.FAIL); $.modal.alert(content, modal_status.FAIL);
@ -782,27 +772,51 @@ var table = {
alertWarning: function(content) { alertWarning: function(content) {
$.modal.alert(content, modal_status.WARNING); $.modal.alert(content, modal_status.WARNING);
}, },
// 消息提示,重新加载页面
msgReload: function(msg, type) {
top.layer.msg(msg, {
icon: $.modal.icon(type),
time: 500,
shade: [0.1, '#8F8F8F']
},
function() {
$.modal.reload();
});
},
// 消息提示成功并刷新父窗体
msgSuccessReload: function(msg) {
$.modal.msgReload(msg, modal_status.SUCCESS);
},
// 获取iframe页的DOM
getChildFrame: function (index) {
if($.common.isEmpty(index)){
var index = parent.layer.getFrameIndex(window.name);
return parent.layer.getChildFrame('body', index);
} else {
return top.layer.getChildFrame('body', index);
}
},
// 关闭窗体 // 关闭窗体
close: function (index) { close: function (index) {
if($.common.isEmpty(index)){ if($.common.isEmpty(index)){
var index = parent.layer.getFrameIndex(window.name); var index = parent.layer.getFrameIndex(window.name);
parent.layer.close(index); parent.layer.close(index);
} else { } else {
layer.close(index); top.layer.close(index);
} }
}, },
// 关闭全部窗体 // 关闭全部窗体
closeAll: function () { closeAll: function () {
layer.closeAll(); top.layer.closeAll();
}, },
// 确认窗体 // 确认窗体
confirm: function (content, callBack) { confirm: function (content, callBack) {
layer.confirm(content, { top.layer.confirm(content, {
icon: 3, icon: 3,
title: "系统提示", title: "系统提示",
btn: ['确认', '取消'] btn: ['确认', '取消']
}, function (index) { }, function (index) {
layer.close(index); $.modal.close(index);
callBack(true); callBack(true);
}); });
}, },
@ -831,7 +845,7 @@ var table = {
iframeWin.contentWindow.submitHandler(index, layero); iframeWin.contentWindow.submitHandler(index, layero);
} }
} }
layer.open({ top.layer.open({
type: 2, type: 2,
area: [width + 'px', height + 'px'], area: [width + 'px', height + 'px'],
fix: false, fix: false,
@ -875,7 +889,7 @@ var table = {
} }
} }
} }
var index = layer.open($.extend({ var index = top.layer.open($.extend({
type: 2, type: 2,
maxmin: $.common.isEmpty(options.maxmin) ? true : options.maxmin, maxmin: $.common.isEmpty(options.maxmin) ? true : options.maxmin,
shade: 0.3, shade: 0.3,
@ -915,7 +929,7 @@ var table = {
if ($.common.isEmpty(height)) { if ($.common.isEmpty(height)) {
height = ($(window).height() - 50); height = ($(window).height() - 50);
} }
var index = layer.open({ var index = top.layer.open({
type: 2, type: 2,
area: [width + 'px', height + 'px'], area: [width + 'px', height + 'px'],
fix: false, fix: false,
@ -935,7 +949,7 @@ var table = {
return true; return true;
} }
}); });
layer.full(index); top.layer.full(index);
}, },
// 选卡页方式打开 // 选卡页方式打开
openTab: function (title, url, isRefresh) { openTab: function (title, url, isRefresh) {
@ -1017,7 +1031,7 @@ var table = {
skin: 'layui-layer-gray', skin: 'layui-layer-gray',
btn: ['关闭'], btn: ['关闭'],
yes: function (index, layero) { yes: function (index, layero) {
layer.close(index); $.modal.close(index);
} }
}; };
$.modal.openOptions(options); $.modal.openOptions(options);
@ -1173,7 +1187,7 @@ var table = {
}; };
$.ajax(config) $.ajax(config)
}, },
// 保存信息 弹出提示框 // 保存信息 弹出结果提示框
saveModal: function(url, data, callback) { saveModal: function(url, data, callback) {
var config = { var config = {
url: url, url: url,
@ -1235,10 +1249,10 @@ var table = {
} }
$.modal.closeLoading(); $.modal.closeLoading();
}, },
// 成功结果提示msg父窗体全局更新 // 保存结果重新加载页面
saveSuccess: function (result) { saveReload: function (result) {
if (result.code == web_status.SUCCESS) { if (result.code == web_status.SUCCESS) {
$.modal.msgReload("保存成功,正在刷新数据请稍后……", modal_status.SUCCESS); $.modal.msgSuccessReload(result.msg);
} else if (result.code == web_status.WARNING) { } else if (result.code == web_status.WARNING) {
$.modal.alertWarning(result.msg) $.modal.alertWarning(result.msg)
} else { } else {
@ -1249,8 +1263,10 @@ var table = {
// 成功回调执行事件(父窗体静默更新) // 成功回调执行事件(父窗体静默更新)
successCallback: function(result) { successCallback: function(result) {
if (result.code == web_status.SUCCESS) { if (result.code == web_status.SUCCESS) {
var parent = window.parent; var parent = activeWindow();
if (parent.table.options.type == table_type.bootstrapTable) { if($.common.isEmpty(parent.table)) {
$.modal.msgSuccessReload(result.msg);
} else if (parent.table.options.type == table_type.bootstrapTable) {
$.modal.close(); $.modal.close();
parent.$.modal.msgSuccess(result.msg); parent.$.modal.msgSuccess(result.msg);
parent.$.table.refresh(); parent.$.table.refresh();
@ -1258,8 +1274,6 @@ var table = {
$.modal.close(); $.modal.close();
parent.$.modal.msgSuccess(result.msg); parent.$.modal.msgSuccess(result.msg);
parent.$.treeTable.refresh(); parent.$.treeTable.refresh();
} else {
$.modal.msgReload("保存成功,正在刷新数据请稍后……", modal_status.SUCCESS);
} }
} else if (result.code == web_status.WARNING) { } else if (result.code == web_status.WARNING) {
$.modal.alertWarning(result.msg) $.modal.alertWarning(result.msg)

View File

@ -65,7 +65,7 @@
return; return;
} }
$('#userids').html(rows.join()) $('#userids').html(rows.join())
layer.close(index); $.modal.close(index);
} }
function selectUsers(){ function selectUsers(){

View File

@ -118,10 +118,10 @@
} }
function doSubmit(index, layero){ function doSubmit(index, layero){
var body = layer.getChildFrame('body', index); var body = $.modal.getChildFrame(index);
$("#treeId").val(body.find('#treeId').val()); $("#treeId").val(body.find('#treeId').val());
$("#treeName").val(body.find('#treeName').val()); $("#treeName").val(body.find('#treeName').val());
layer.close(index); $.modal.close(index);
} }
</script> </script>
</body> </body>

View File

@ -130,10 +130,10 @@
function doSubmit(index, layero){ function doSubmit(index, layero){
var tree = layero.find("iframe")[0].contentWindow.$._tree; var tree = layero.find("iframe")[0].contentWindow.$._tree;
if ($.tree.notAllowLastLevel(tree)) { if ($.tree.notAllowLastLevel(tree)) {
var body = layer.getChildFrame('body', index); var body = $.modal.getChildFrame(index);
$("#treeId").val(body.find('#treeId').val()); $("#treeId").val(body.find('#treeId').val());
$("#treeName").val(body.find('#treeName').val()); $("#treeName").val(body.find('#treeName').val());
layer.close(index); $.modal.close(index);
} }
} }
</script> </script>

View File

@ -192,10 +192,10 @@
} }
function doSubmit(index, layero){ function doSubmit(index, layero){
var body = layer.getChildFrame('body', index); var body = $.modal.getChildFrame(index);
$("#treeId").val(body.find('#treeId').val()); $("#treeId").val(body.find('#treeId').val());
$("#treeName").val(body.find('#treeName').val()); $("#treeName").val(body.find('#treeName').val());
layer.close(index); $.modal.close(index);
} }
</script> </script>
</body> </body>

View File

@ -220,10 +220,10 @@
} }
function doSubmit(index, layero){ function doSubmit(index, layero){
var body = layer.getChildFrame('body', index); var body = $.modal.getChildFrame(index);
$("#treeId").val(body.find('#treeId').val()); $("#treeId").val(body.find('#treeId').val());
$("#treeName").val(body.find('#treeName').val()); $("#treeName").val(body.find('#treeName').val());
layer.close(index); $.modal.close(index);
} }
</script> </script>
</body> </body>

View File

@ -251,10 +251,10 @@
function doSubmit(index, layero){ function doSubmit(index, layero){
var tree = layero.find("iframe")[0].contentWindow.$._tree; var tree = layero.find("iframe")[0].contentWindow.$._tree;
var body = layer.getChildFrame('body', index); var body = $.modal.getChildFrame(index);
$("#treeId").val(body.find('#treeId').val()); $("#treeId").val(body.find('#treeId').val());
$("#treeName").val(body.find('#treeName').val()); $("#treeName").val(body.find('#treeName').val());
layer.close(index); $.modal.close(index);
} }
$(function() { $(function() {

View File

@ -215,10 +215,10 @@
function doSubmit(index, layero){ function doSubmit(index, layero){
var tree = layero.find("iframe")[0].contentWindow.$._tree; var tree = layero.find("iframe")[0].contentWindow.$._tree;
var body = layer.getChildFrame('body', index); var body = $.modal.getChildFrame(index);
$("#treeId").val(body.find('#treeId').val()); $("#treeId").val(body.find('#treeId').val());
$("#treeName").val(body.find('#treeName').val()); $("#treeName").val(body.find('#treeName').val());
layer.close(index); $.modal.close(index);
} }
$(function() { $(function() {

View File

@ -227,7 +227,7 @@ function submitHandler() {
processData: false, processData: false,
contentType: false, contentType: false,
success: function(result) { success: function(result) {
$.operate.saveSuccess(result); $.operate.saveReload(result);
} }
}) })
}); });

View File

@ -542,18 +542,18 @@
} }
function doDictSubmit(index, layero){ function doDictSubmit(index, layero){
var body = layer.getChildFrame('body', index); var body = $.modal.getChildFrame(index);
var columnId = body.find('#columnId').val(); var columnId = body.find('#columnId').val();
var dictType = body.find('#dictType').val(); var dictType = body.find('#dictType').val();
layer.close(index); $.modal.close(index);
$("#columns_dict_" + columnId).val(dictType); $("#columns_dict_" + columnId).val(dictType);
} }
function doMenuSubmit(index, layero){ function doMenuSubmit(index, layero){
var body = layer.getChildFrame('body', index); var body = $.modal.getChildFrame(index);
$("#parentMenuId").val(body.find('#treeId').val()); $("#parentMenuId").val(body.find('#treeId').val());
$("#parentMenuName").val(body.find('#treeName').val()); $("#parentMenuName").val(body.find('#treeName').val());
layer.close(index); $.modal.close(index);
} }
</script> </script>
</body> </body>

View File

@ -287,10 +287,10 @@
} }
function doSubmit(index, layero){ function doSubmit(index, layero){
var body = layer.getChildFrame('body', index); var body = $.modal.getChildFrame(index);
$("#treeId").val(body.find('#treeId').val()); $("#treeId").val(body.find('#treeId').val());
$("#treeName").val(body.find('#treeName').val()); $("#treeName").val(body.find('#treeName').val());
layer.close(index); $.modal.close(index);
} }
#end #end
#if($table.sub) #if($table.sub)

View File

@ -297,10 +297,10 @@
} }
function doSubmit(index, layero){ function doSubmit(index, layero){
var body = layer.getChildFrame('body', index); var body = $.modal.getChildFrame(index);
$("#treeId").val(body.find('#treeId').val()); $("#treeId").val(body.find('#treeId').val());
$("#treeName").val(body.find('#treeName').val()); $("#treeName").val(body.find('#treeName').val());
layer.close(index); $.modal.close(index);
} }
#end #end
#if($table.sub) #if($table.sub)