| var testList=[  | 
|     {"name":"平台1","status":"0"},  | 
|     {"name":"平台2","status":"0"},  | 
|     {"name":"平台3","status":"0"},  | 
|     {"name":"平台4","status":"1"},  | 
|     {"name":"平台5","status":"0"}  | 
|     ];  | 
|   | 
| var platfoemList = [];  | 
|   | 
|   | 
| if (TEST_TAG) {  | 
|     platfoemList = testList;  | 
|     renderPlatform();  | 
| }else{  | 
|     queryData();  | 
|     //定时器,每5秒查询一次;查询设备信息并渲染  | 
|     setInterval(queryData,5000);  | 
| }  | 
|   | 
| //查询设备信息  | 
| function queryData() {  | 
|     $.get("./cgi-bin/state/query-sys", function (data, status) {  | 
|         if ("success" == status) {  | 
|             platfoemList = data;  | 
|             renderPlatform();  | 
|         } else {  | 
|             window.parent.parent.notify("系统获取基础设备列表出错!");  | 
|         }  | 
|     }, "json");  | 
| }  | 
|   | 
| //渲染设备列表  | 
| function renderPlatform() {  | 
|     var html = "";  | 
|     $.each(platfoemList, function (index, item) {  | 
|         html += "<tr><td>" + item.name + "</td>";  | 
|         if(item.status==0){  | 
|             html += "<td><button style='height: 29px;line-height: 29px;' class='layui-btn layui-btn-normal'>在线</button></td>";  | 
|         }else{  | 
|             html += "<td><button style='height: 29px;line-height: 29px;' class='layui-btn layui-btn-danger'>离线</button></td>";  | 
|         }  | 
|         html += "</td></tr>";  | 
|     });  | 
|   | 
|     $("#deviceList").html(html);  | 
| }  | 
|   |