| | |
| | | .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"> |
| | |
| | | |
| | | <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="å¯ç¨|åç¨"> |
| | |
| | | <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;// å®ä¹å
¨å±åé |
| | |
| | | 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+"ï¼"); |
| | | } |
| | |
| | | //å¯¼åº |
| | | 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> |