layui.use(['element'], function () { var element = layui.element; getLogErr(); //侧边栏点击事件监听 element.on('nav(test)', function(elem){ console.log(elem); //得到当前点击的DOM对象 let name = elem[0].innerText; if(name === '系统日志'){ $("#content").prop('src','../../../html/base/log/child/systemLog.html'); }else if(name === '业务日志'){ $("#content").prop('src','../../../html/base/log/child/businessLog.html'); }else if(name === '异常日志'){ $("#content").prop('src','../../../html/base/log/child/errLog.html'); }else if(name === '日志分析'){ $("#content").prop('src','../../../html/base/log/child/logAnalysis.html'); }else if(name === '日志容量配置'){ $("#content").prop('src','../../../html/base/log/child/logCapacityConfiguration.html'); } }); }); //查询日志数据 function getLogErr(){ $.ajax({ headers: { Authorization: token }, type: "post", url: dataUrl + 'system/sys/logs/logWarn', data: {}, async: false, success: function (result) { console.log(result); if(result.code==200){ if(result.data.warnType==1){ openAlter('日志容量告警',result.data.warnError); } if(result.data.logWarn==1){ openAlter('异常告警',result.data.err); } } } }); } function openAlter(title,msg){ layer.open({ type: 1 //此处以iframe举例 ,title:title ,area: ['390px', '260px'] ,shade: 0 ,maxmin: true ,content: '