gz_gqj_web/js/openIframe.js

113 lines
4.0 KiB
JavaScript
Raw Permalink Normal View History

2024-11-08 16:53:56 +08:00
/**
* id页面ID
* title标题
* content, 页面路径
* width宽度
* height高度
* params 参数
*/
2024-11-12 11:25:06 +08:00
function openIframeByParam(id, title, content, width, height, params) {
2024-11-08 16:53:56 +08:00
let layerIndex = layer.open({
id: id,
type: 2,
title: ['<div style="border-left: 3px solid #409EFF;color:#409EFF;font-size:18px;letter-spacing:1px;display: flex;align-items: center;height: 20px;padding: 0 10px;">' + title + '</div>', 'font-size:16px;background-color:#f0f0f0;display: flex;align-items: center;'],
content: content,
shade: 0.3,
anim: 2,
shadeClose: false,
area: [width, height],
move: false,
success: function () {
2024-11-12 11:25:06 +08:00
if (params) {
2024-11-08 16:53:56 +08:00
let iframeWin = window["layui-layer-iframe" + layerIndex];
iframeWin.setParams(params);
}
},
2024-11-12 11:25:06 +08:00
cancel: function () { },
end: function () { }
2024-11-08 16:53:56 +08:00
});
}
/**
* id页面ID
* title标题
* content, 页面路径
* width宽度
* height高度
* params 参数对象
*/
2024-11-12 11:25:06 +08:00
function openIframeByParamObj(id, title, content, width, height, paramsObj) {
2024-11-08 16:53:56 +08:00
let layerIndex = layer.open({
id: id,
type: 2,
2024-11-08 19:43:23 +08:00
title: ['<div style="border-left: 3px solid #409EFF;color:#409EFF;font-size:18px;letter-spacing:1px;display: flex;align-items: center;height: 20px;padding: 0 10px;font-weight: bold;">' + title + '</div>', 'font-size:16px;background-color:#f0f0f0;display: flex;align-items: center;'],
2024-11-08 16:53:56 +08:00
content: content,
shade: 0.3,
anim: 2,
shadeClose: false,
area: [width, height],
move: false,
success: function () {
2024-11-12 11:25:06 +08:00
if (paramsObj) {
2024-11-08 16:53:56 +08:00
let iframeWin = window["layui-layer-iframe" + layerIndex];
iframeWin.setParams(JSON.stringify(paramsObj));
}
},
2024-11-12 11:25:06 +08:00
cancel: function () { },
end: function () { }
2024-11-08 16:53:56 +08:00
});
}
2024-11-11 10:54:13 +08:00
2024-11-12 11:25:06 +08:00
function openIframeByParamObj2(id, title, content, width, height, paramsObj) {
2024-11-11 10:54:13 +08:00
let layerIndex = parent.layer.open({
id: id,
type: 2,
title: ['<div style="border-left: 3px solid #409EFF;color:#409EFF;font-size:18px;letter-spacing:1px;display: flex;align-items: center;height: 20px;padding: 0 10px;font-weight: bold;">' + title + '</div>', 'font-size:16px;background-color:#f0f0f0;display: flex;align-items: center;'],
content: content,
shade: 0.3,
anim: 2,
shadeClose: false,
area: [width, height],
move: false,
success: function () {
2024-11-12 11:25:06 +08:00
if (paramsObj) {
2024-11-11 10:54:13 +08:00
let iframeWin = parent.window["layui-layer-iframe" + layerIndex];
iframeWin.setParams(JSON.stringify(paramsObj));
}
},
2024-11-12 11:25:06 +08:00
cancel: function () { },
end: function () { }
});
}
/* dtree专用弹框 */
function openIframeByDtree(id, title, content, width, height, params, $div) {
let layerIndex = layer.open({
id: id,
type: 2,
title: ['<div style="border-left: 3px solid #409EFF;color:#409EFF;font-size:18px;letter-spacing:1px;display: flex;align-items: center;height: 20px;padding: 0 10px;font-weight: bold;">' + title + '</div>', 'font-size:16px;background-color:#f0f0f0;display: flex;align-items: center;'],
content: content,
shade: 0.3,
anim: 2,
shadeClose: false,
area: [width, height],
move: false,
success: function () {
let iframeWin = window["layui-layer-iframe" + layerIndex];
iframeWin.setParams(JSON.stringify(params));
},
end: function () {
if (jsonData) {
2024-11-12 14:16:29 +08:00
if (params.type === 2) {
2024-11-12 11:25:06 +08:00
// 修改节点
2024-11-12 12:17:43 +08:00
fitTypeTree.partialRefreshEdit($div, jsonData.title);
2024-11-12 14:16:29 +08:00
} else if (params.type === 1) {
2024-11-12 11:25:06 +08:00
// 新增节点
2024-11-12 12:17:43 +08:00
fitTypeTree.partialRefreshAdd($div, jsonData);
2024-11-12 11:25:06 +08:00
}
jsonData = null;
}
}
2024-11-11 10:54:13 +08:00
});
}