自定义导出按钮问题

image.png

var url = 'report?reportlets=';

var depart_id = '&depart_id=' + depart_id;

//alert(depart_id);

var user_id = '&user_id=' + user_id;

//alert(user_id);

var pars = '&op=expor&format=excel&sheets=[0]&__filename__=科目余额校验';

var path = "${reportName}";

var json = [];

for (var i = 0; i < area.length; i++) {

var sheet = {

reportlet: path,

地市: area[i]

};

json.push(sheet);

}

jsonStr = encodeURIComponent(JSON.stringify(json));

///alert(jsonStr);

//alert(JSON.stringify(json));

url += jsonStr;

url += pars;

url += depart_id;

url += user_id;

alert(url);

alert(user_id + area[1]);

var r = confirm("确认导出!");

if (r == true) {

//x="你按下了\"确定\"按钮!";

window.open(url);

} else {

//x="你按下了\"取消\"按钮!";

}

image.png

FineReport 2541747089 发布于 2022-10-10 16:19 (编辑于 2022-10-10 16:21)
1min目标场景问卷 立即参与
回答问题
悬赏:3 F币 + 添加悬赏
提示:增加悬赏、完善问题、追问等操作,可使您的问题被置顶,并向所有关注者发送通知
共2回答
最佳回答
0
weibwLv7高级互助
发布于2022-10-10 16:19(编辑于 2022-10-10 16:42)

官方文档里都是绝对路径,你写的是相对路径,你改成绝对的试试?

image.png

image.png

  • 2541747089 2541747089(提问者) 代码已完善,展示报错:400
    2022-10-10 16:20 
  • weibw weibw 回复 2541747089(提问者) 点击导出按钮时请求的完整的url发一下
    2022-10-10 16:25 
  • 2541747089 2541747089(提问者) 回复 weibw report?reportlets=%5B%7B%22reportlet%22%3A%22cw%2Fcw_xmgltz_tb_3.cpt%22%2C%22%E5%9C%B0%E5%B8%82%22%3A%22%E9%99%95%E8%A5%BF%22%7D%2C%7B%22reportlet%22%3A%22cw%2Fcw_xmgltz_tb_3.cpt%22%2C%22%E5%9C%B0%E5%B8%82%22%3A%22%E7%9C%81%E6%9C%AC%E9%83%A8%22%7D%2C%7B%22reportlet%22%3A%22cw%2Fcw_xmgltz_tb_3.cpt%22%2C%22%E5%9C%B0%E5%B8%82%22%3A%22%E8%A5%BF%E5%AE%89%22%7D%2C%7B%22reportlet%22%3A%22cw%2Fcw_xmgltz_tb_3.cpt%22%2C%22%E5%9C%B0%E5%B8%82%22%3A%22%E9%93%9C%E5%B7%9D%22%7D%2C%7B%22reportlet%22%3A%22cw%2Fcw_xmgltz_tb_3.cpt%22%2C%22%E5%9C%B0%E5%B8%82%22%3A%22%E5%AE%9D%E9%B8%A1%22%7D%2C%7B%22reportlet%22%3A%22cw%2Fcw_xmgltz_tb_3.cpt%22%2C%22%E5%9C%B0%E5%B8%82%22%3A%22%E5%92%B8%E9%98%B3%22%7D%2C%7B%22reportlet%22%3A%22cw%2Fcw_xmgltz_tb_3.cpt%22%2C%22%E5%9C%B0%E5%B8%82%22%3A%22%E6%B8%AD%E5%8D%97%22%7D%2C%7B%22reportlet%22%3A%22cw%2Fcw_xmgltz_tb_3.cpt%22%2C%22%E5%9C%B0%E5%B8%82%22%3A%22%E5%BB%B6%E5%AE%89%22%7D%2C%7B%22reportlet%22%3A%22cw%2Fcw_xmgltz_tb_3.cpt%22%2C%22%E5%9C%B0%E5%B8%82%22%3A%22%E6%B1%89%E4%B8%AD%22%7D%2C%7B%22reportlet%22%3A%22cw%2Fcw_xmgltz_tb_3.cpt%22%2C%22%E5%9C%B0%E5%B8%82%22%3A%22%E6%A6%86%E6%9E%97%22%7D%2C%7B%22reportlet%22%3A%22cw%2Fcw_xmgltz_tb_3.cpt%22%2C%22%E5%9C%B0%E5%B8%82%22%3A%22%E5%AE%89%E5%BA%B7%22%7D%2C%7B%22reportlet%22%3A%22cw%2Fcw_xmgltz_tb_3.cpt%22%2C%22%E5%9C%B0%E5%B8%82%22%3A%22%E5%95%86%E6%B4%9B%22%7D%5D&op=expor&format=excel&sheets=[0]&__filename__=科目余额校验&depart_id=610000&user_id=17794237814
    2022-10-10 16:35 
  • weibw weibw 回复 2541747089(提问者) 参考修改后的答案,看是不是绝对路径的问题
    2022-10-10 16:43 
  • 2541747089 2541747089(提问者) 回复 weibw 我把这个参数 &sheets=[0] 去掉就不报错了,这是为什么?
    2022-10-10 16:45 
最佳回答
0
snrtuemcLv8专家互助
发布于2022-10-10 16:24
  • 2关注人数
  • 315浏览人数
  • 最后回答于:2022-10-10 16:42
    请选择关闭问题的原因
    确定 取消
    返回顶部