历史版本2 :JS实现双击对话框标题栏最大化 返回文档
编辑时间: 内容长度:图片数:目录数: 修改原因:

目录:

1. 问题描述编辑

现有功能中超级链接-网络报表-对话框的大小是固定的,对话框没有最大化的功能,需要打开对话框时点击对话框的标题栏可以实现最大化。

2. 解决方案编辑

2.1 思路

使用js获取对话框初始大小,对话框标题栏添加双击事件,用clicktype参数标记对话框是否最大化,当clicktype=0时,获取父页面的大小,重置对话框的大小,当clicktype=1时,恢复对话框的大小为初始大小。

2.2 示例

1)新建模板对话框最大化.cpt,添加数据集ds1:SELECT * FROM 销量 WHERE 地区='${地区}',将销售员和销量字段拖入单元格中:

image.png

2)点击菜单模板->模板Web属性->分页预览设置,为该模板单独设置,添加加载结束事件:

image.png

js代码如下:

var frwidth = "";
var frheight = "";
var frleft = "";
var frtop = "";
var clicktype = 0; //标记对话框最大化状态
var parenthtml = parent;

setTimeout(function() {
//获取对话框初始大小
frwidth = parenthtml.$('.fr-core-window').css('width');
frheight = parenthtml.$('.fr-core-window').css('height');
frleft = parenthtml.$('.fr-core-window').css('left');
frtop = parenthtml.$('.fr-core-window').css('top');

//对话框标题栏双击事件
parenthtml.$('.fr-core-panel-header-inner').dblclick(function() {
//clicktype=0:初始状态,clicktype=1:最大化
if (clicktype == 0) {
clicktype = 1;
parenthtml.$('.fr-core-window').css('left', '0px');
parenthtml.$('.fr-core-window').css('top', '0px');
parenthtml.$('.fr-core-window,.fr-core-window-header,.fr-core-panel-header-inner,.fr-core-window-body').css('width', $(parent).width());
parenthtml.$('.fr-core-window').css('height', $(parenthtml).height());
parenthtml.$('.fr-core-window-body').css('height', (parseInt($(parenthtml).height()) - 30) + 'px');
} else {
clicktype = 0;
parenthtml.$('.fr-core-window').css('left', frleft);
parenthtml.$('.fr-core-window').css('top', frtop);
parenthtml.$('.fr-core-window,.fr-core-window-header,.fr-core-panel-header-inner,.fr-core-window-body').css('width', frwidth);
parenthtml.$('.fr-core-window').css('height', frheight);
parenthtml.$('.fr-core-window-body').css('height', (parseInt(frheight) - 30) + 'px');
}

});
}, 100)

3)打开GettingStarted.cpt模板,点击A4单元格,添加超级链接-网络报表,选择对话框最大化.cpt,设置链接打开于对话框,添加参数:地区,值为公式$$$

image.png

4)保存模板,点击分页预览。

3. 预览效果编辑

3.1 PC端

对话框最大化.gif

3.2 移动端

注:不支持移动端。

4. 模板下载编辑