JS跳转二级页面
在控件模板写一个控件按钮自定义点击事件,打开新窗口跳转到二级报表,并且继承参数
FineReport JoDUprJi 发布于 2023-9-18 17:10
1min目标场景问卷 立即参与
回答问题
悬赏:3 F币 + 添加悬赏
提示:增加悬赏、完善问题、追问等操作,可使您的问题被置顶,并向所有关注者发送通知
共3回答
最佳回答
0
ZxxTLv6初级互助
发布于2023-9-18 17:11
// 获取按钮元素var btn = document.getElementById('button');// 给按钮添加点击事件监听器btn.addEventListener('click', function() {  // 获取需要传递的参数(例如参数名为param)   var paramValue = document.getElementById('paramInput').value;     // 拼接跳转的URL,并将参数追加到URL上   var url = 'secondReport.html?param=' + encodeURIComponent(paramValue);     // 打开一个新窗口并跳转到二级报表URL   window.open(url, 'secondReport'); });Copy

在上面的示例中,假设按钮的HTML元素具有id属性为button,并且有一个输入框作为参数输入框,其id属性为paramInput。当按钮被点击时,通过document.getElementById方法获取输入框的值作为参数的值,并使用encodeURIComponent方法对参数进行编码,保证参数的安全性。然后,将参数值追加到二级报表的URL中,在新窗口上打开该URL。

请根据您的具体需求修改上述代码,以适应您的控件按钮和参数的命名以及跳转的URL。

最佳回答
0
用户y5617963Lv5见习互助
发布于2023-9-18 17:12(编辑于 2023-9-18 17:13)

FR.showIframeDialog({

url:"${servletURL}?reportlet=链接&你得参数"

});在红框那加参数

image.png

最佳回答
0
龙侃飞Lv3见习互助
发布于2023-10-9 16:01

点击事件js如下:

//获取控件参数值 window.p_s_month = _g().getWidgetByName('p_s_month').getValue(); window.p_e_month = _g().getWidgetByName('p_e_month').getValue(); var url=location.href.split('=')[0]+模版路径; //cs为所有参数拼接起来的URL后缀 var cs="&p_s_month="+p_s_month+"&p_e_month="+p_e_month Obj_Bak(url);  var $iframe = $("<iframe id='inp' name='inp' width='100%' height='100%' scrolling='no' frameborder='0'>"); //将窗体的src属性设置为模板路径 $iframe.attr("src", url+cs); //窗体的属性 var o = {     title: 标题,    //标题     destroyOnClose:true,   // 是否在关闭对话框的时候将对话框从dom中移除     width: 1300,         //宽度     height: 650,        //高度     //closable:true,    //是否显示关闭按钮,默认true     //confirm:true,     //是否添加确认取消按钮,默认false     //draggable:true   //是否可拖动,默认true }; //弹出窗体 FR.showDialog(o.title, o.width, o.height, $iframe, o);

  • 4关注人数
  • 203浏览人数
  • 最后回答于:2023-10-9 16:01
    请选择关闭问题的原因
    确定 取消
    返回顶部