| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="UTF-8">
- <title>测试告警处理</title>
- <script>
- function handleAlarm() {
- alert("处理按钮被点击了!");
- document.getElementById('result').innerText = '点击成功 - ' + new Date().toLocaleTimeString();
- return false;
- }
- </script>
- </head>
- <body>
- <h1>测试按钮点击</h1>
- <button onclick="handleAlarm()">测试处理告警</button>
- <div id="result" style="margin-top: 20px; padding: 10px; background-color: #f0f0f0;"></div>
-
- <script>
- // 尝试在页面加载后直接给原告警页面的按钮添加处理函数
- document.addEventListener('DOMContentLoaded', function() {
- console.log("页面加载完成,准备注入函数");
-
- // 定义一个全局函数,可以在任何页面中调用
- window.fixAlarmButtons = function() {
- alert("开始修复告警按钮");
- var buttons = document.querySelectorAll('.handle-btn');
- console.log("找到处理按钮:", buttons.length, "个");
-
- buttons.forEach(function(btn) {
- btn.onclick = function() {
- alert("处理按钮被点击!");
- console.log("处理按钮点击", this.getAttribute('data-id'));
-
- // 获取当前行数据和填充模态框的代码...
- // (此处为简化代码)
-
- // 显示模态框
- document.getElementById('alarmHandleModal').style.display = 'flex';
- return false;
- };
-
- console.log("已为按钮设置新的点击处理函数:", btn);
- });
-
- return "修复完成,共处理了" + buttons.length + "个按钮";
- };
- });
- </script>
-
- <div style="margin-top: 20px;">
- <p>请在设备告警页面的控制台中运行以下代码:</p>
- <pre style="background-color: #f0f0f0; padding: 10px;">
- fixAlarmButtons();
- </pre>
- </div>
- </body>
- </html>
|