IGD3000系列(一体屏)网关的app和文件系统的打包目录
lgq
2025-07-14 85f14e0aef1ae548d8893ad14f626f4a1ceccc20
local/www/sys-snmp-conf.html
@@ -25,12 +25,33 @@
      .btns button{
         width: 120px;
      }
      @media only screen and (max-width:1080px) and (max-height: 1920px){
         .i-container {
            min-width: 750px;
            height: 100%;
            overflow-y: scroll;
         }
         /** 隐藏列表下拉滚动条 **/
         .div-body::-webkit-scrollbar {
            display: none;
         }
         /*IE 10+ ----隐藏滚动条*/
         .div-body {
            -ms-overflow-style: none;
         }
         /*Firefox ----隐藏滚动条*/
         .div-body {
            scrollbar-width: none;
         }
         .pdgxq-m1-left{
            height: 1400px;
         }
      }
   </style>
</head>
<body class="pdgxq-body">
   <div class="i-container">
   <div class="i-container div-body">
      <div class="jmkt-main">
         <div class="layui-fluid">
            <div class="pdgxq-m1 layui-row layui-col-space20">
@@ -42,7 +63,7 @@
                           <div class="layui-col-md4">
                              <div class="layui-inline" style="margin-left: -16%">
                                 <label class="layui-form-label">SNMP功能:</label>
                                 <label class="layui-form-label">SNMP模组:</label>
                                 <div class="layui-input-block">
                                    <input type="checkbox" id="enable" name="enable" lay-skin="switch"
                                          lay-filter="switch" lay-text="启用|停用">
@@ -105,6 +126,11 @@
   <script type="text/javascript" src="js/jquery.min.js"></script>
   <script src="plugins/layui/layui.js"></script>
   <script src="js/constant.js"></script>
   <script src="plugins/external/jszip.min.js"></script>
   <script src="plugins/external/FileSaver.js"></script>
   <script src="plugins/external/excel-gen.js"></script>
   <script type="text/javascript">
      var layer;// 定义全局变量
@@ -146,8 +172,7 @@
         var obj = {"enable":enable};
         $.post("./cgi-bin/snmp/enable", JSON.stringify(obj), function (data, status) {
            if (data.code == "success") {
               //window.parent.parent.notify("数据保存成功");
               window.parent.parent.notify("SNMP模组状态保存成功");
               window.parent.parent.notify("数据保存成功");
            } else {
               window.parent.parent.notify("数据保存出错,请重新操作!"+data.msg+"!");
            }
@@ -157,34 +182,68 @@
      //导出
      function downLoadF() {
         $.ajaxSettings.async = false;
         $.get("./cgi-bin/snmp/download", function (data, status) {
            if ("success" == data.code) {
               downLoadF2();
            }else{
               window.parent.parent.notify("生成oid表出错");
            }
         $.get("./cgi-bin/snmp/query_oid", function (data, status) {
            renderHtml(data);
            // if ("success" == data.code) {
            //    renderHtml(data);
            // }else{
            //    window.parent.parent.notify("生成oid表出错");
            // }
         }, "json");
      }
      
      function downLoadF2() {
         var fileName = "oid_list.csv";
         var url = "./cgi-bin/download/download.cgi?filename=/tmp/oid_list.csv";
      function renderHtml(data) {
         console.log(data);
         // 对于<a>标签,只有 Firefox 和 Chrome(内核) 支持 download 属性
         if ('download' in document.createElement('a')) { // 支持a标签download的浏览器
            var link = document.createElement('a'); // 创建a标签
            link.download = fileName;// a标签添加属性
            link.style.display = 'none';
            // link.href = URL.createObjectURL(blob);
            link.href = url;
            document.body.appendChild(link);
            link.click(); // 执行下载
            URL.revokeObjectURL(link.href); // 释放url
            document.body.removeChild(link); // 释放标签
         } else { // 其他浏览器
            navigator.msSaveBlob(url, fileName);
         var thead = "";
         thead += "<thead><tr>";
         thead += "<th>设备名称</th>";
         thead += "<th>OID</th>";
         thead += "<th>设备ID</th>";
         thead += "<th>通道号</th>";
         thead += "<th>数据名称</th>";
         thead += "<th>备注</th>";
         thead += "</tr></thead>";
         var tbody = "";
         if (data != null && data.length > 0) {
            $.each(data, function (index, item) {
               tbody += "<tr><td>" + item.device + "</td>";
               tbody += "<td>" + item.oid + "</td>";
               tbody += "<td>" + item.index1 + "</td>";
               tbody += "<td>" + item.index2 + "</td>";
               tbody += "<td>" + item.param + "</td>";
               tbody += "<td>" + (item.unit ?? "") + "</td></tr>";
            });
         }else {
            tbody += '<tr><td colspan="8">暂未创建设备</td></tr>';
         }
         var html = thead + tbody;
         tableToExcel(html);
      }
      function tableToExcel(html) {
         var name = "告警记录";
         var uri = 'data:application/vnd.ms-excel;base64,';
         var template = '<html><head><meta charset="UTF-8"></head><body><table border="1">{table}</table></body></html>';
         if(!html){
            layer.msg("没有获取到要导出的内容!");
         }
         var ctx = {worksheet: name || 'Worksheet', table: html};
         window.location.href = uri + base64(format(template, ctx))
      }
      function format(s, c) {
         return s.replace(/{(\w+)}/g,function(m, p) { return c[p]; });
      }
      function base64(s) {
         return window.btoa(unescape(encodeURIComponent(s)))
};
   </script>
</body>
</html>