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

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 {
margin-left: 30px;
width: 100000px;
height: 38px;
height: 39px;
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");
}
//计算元素集合的总宽度
// 计算元素集合的总宽度
function calSumWidth(elements) {
var width = 0;
$(elements).each(function() {
@ -347,6 +347,14 @@ function calSumWidth(elements) {
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) {
if (chrtype == 1) {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -251,10 +251,10 @@
function doSubmit(index, layero){
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());
$("#treeName").val(body.find('#treeName').val());
layer.close(index);
$.modal.close(index);
}
$(function() {

View File

@ -215,10 +215,10 @@
function doSubmit(index, layero){
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());
$("#treeName").val(body.find('#treeName').val());
layer.close(index);
$.modal.close(index);
}
$(function() {

View File

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

View File

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

View File

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

View File

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