;(function($, window, document, gl, undefined) { // 首页饼状图 gl.namespace('Index.Pie'); var pieType = [ { name: '机房停电' ,cla: 'repair-pie' }, { name: '机房续航能力' ,cla: 'endur-pie' }, { name: '电池状态' ,cla: 'brdn-pie' }, { name: '电池告警率' ,cla: 'warn-pie' }, { name: '单体容量健康率' ,cla: 'health-pie' } ]; // 将pieType绑定到Index.Pie命名空间下 gl.Index.Pie.pieType = pieType; // 查询饼状图状态返回需要显示饼状图 function pieStatus() { // 设置一个同步查询返回一个div.pie-item-list var pieItems; $.ajax({ type: 'post' ,async: false ,url: 'Echarts_usrAction!serchByCondition' ,data: null ,dataType: 'json' ,success: function(res) { var rs = JSON.parse(res.result); //console.log(rs); if(rs.code == 1) { var data = rs.data[0]; var rsStatus = formaterPieStauts(data); pieItems = getPieList(rsStatus); }else { pieItems = getPieList([1, 1, 1, 1]); } } }); //console.log(pieItems); return pieItems; } // 将pieStatus绑定到Index.Pie命名空间下 gl.Index.Pie.pieStatus = pieStatus; // 根据数组返回 function getPieList(arr) { var pieItems = $('
'); for(var i=0; i