html的iframe页面给帆软BI发送消息

需求:帆软的网页组件嵌套一个HTML页面,HTML页面要给帆软发消息。

解决方法是:fineReportWindow.duchamp.getWidgetByName("txt1").setValue('666');

<!DOCTYPE html>

<html lang="en">

<head>

<meta charset="UTF-8">

<title>HTML Page for FineReport</title>

</head>

<body>

<button id="sendButton">发送消息</button>

<script>

// 获取按钮元素

var sendButton = document.getElementById('sendButton');

// 向帆软发送消息的函数

function sendMessageToFineReport(message) {

// 假设 parent 是帆软的窗口对象,这里需要根据实际情况修改

var fineReportWindow = parent;

// 使用 postMessage 发送消息

fineReportWindow.postMessage(message, {});

fineReportWindow.XXX=1;

console.log(fineReportWindow);

fineReportWindow.duchamp.getWidgetByName("下拉框1_页面1").setValue('87897232');

//window.postMessage(message, '*');

}

// 监听按钮点击事件

sendButton.addEventListener('click', function() {

sendMessageToFineReport('999');

});

</script>

</body>

</html>

注意不要跨域,html页面可以丢到帆软的安装目录下。这样就同一个域名了

相关推荐
子兮曰1 天前
OpenClaw入门:从零开始搭建你的私有化AI助手
前端·架构·github
吴仰晖1 天前
使用github copliot chat的源码学习之Chromium Compositor
前端
1024小神1 天前
github发布pages的几种状态记录
前端
不像程序员的程序媛1 天前
Nginx日志切分
服务器·前端·nginx
Daniel李华1 天前
echarts使用案例
android·javascript·echarts
北原_春希1 天前
如何在Vue3项目中引入并使用Echarts图表
前端·javascript·echarts
JY-HPS1 天前
echarts天气折线图
javascript·vue.js·echarts
尽意啊1 天前
echarts树图动态添加子节点
前端·javascript·echarts
吃面必吃蒜1 天前
echarts 极坐标柱状图 如何定义柱子颜色
前端·javascript·echarts
O_oStayPositive1 天前
Vue3使用ECharts
前端·javascript·echarts