var minleader = 0; //紧急联系人 var maxleader = 3; var minprogram = 0; //项目 var maxprogram = 7; var userpage = 1; //人员数据分析 var yinhuanpage = 1 //河南省隐患数据详细统计 var preventionpage = 1; //河南省防患预警数据和投诉数据 var assignmentspage = 1; //河南省各项目任务总量统计 var orderspage = 1; //各项目订单近一周总量数据分析 var patrolpage = 1; //各项目巡查近一周数据统计 var yuangongxuexi = []; //各项目员工学习近一周完成百分比 var yuangongxuexiindex = 0; //初始化 for (var i=0;i<5;i++){ if(yuangongxuexiindex >= olist.length){ yuangongxuexiindex = 0; } yuangongxuexi.push(olist[yuangongxuexiindex]); yuangongxuexiindex++; } // 设备维护 var deviceChart = echarts.init(document.getElementById("device")); deviceOption = null; deviceOption = { color: ['#3398DB'], legend: { data:['维护次数'], textStyle: { color: "#FFFDFE" }, top: 10 // icon: "circle", }, tooltip : { trigger: 'axis', axisPointer : { // 坐标轴指示器,坐标轴触发有效 type : 'shadow' // 默认为直线,可选为:'line' | 'shadow' } }, grid: { left: '3%', right: '4%', bottom: '3%', containLabel: true }, xAxis : [ { type : 'category', data : devicedata.x, axisTick: { alignWithLabel: true }, axisLabel: { color:'#fff', }, axisLine: { lineStyle: { type: 'solid', color: '#fff', } } } ], yAxis : [ { type : 'value', axisLabel: { color:'#fff', }, axisLine: { lineStyle: { type: 'solid', color: '#fff', } } } ], series : [ { name:'维护次数', type:'bar', barWidth: 30, label: { normal: { show: true, position: 'top', color: '#fff' } }, barWidth: 30, data:devicedata.y } ] }; if (deviceOption && typeof deviceOption === "object") { deviceChart.setOption(deviceOption, true); } //各项目人员数据分析 function user() { $.get('/api/Statics/user',{orgid:orgid,page:userpage},function (data) { if(data.status == 0){ if(data.data.x.length > 0){ userpage++; var personnelChart = echarts.init(document.getElementById("personnel")); personnelOption = null; personnelOption = { color: ['#3398DB'], legend: { data:['用户人数'], textStyle: { color: "#FFFDFE" }, top: 10 // icon: "circle", }, tooltip : { trigger: 'axis', axisPointer : { // 坐标轴指示器,坐标轴触发有效 type : 'shadow' // 默认为直线,可选为:'line' | 'shadow' } }, grid: { left: '3%', right: '4%', bottom: '3%', containLabel: true }, xAxis : [ { type : 'category', data : data.data.x, axisTick: { alignWithLabel: true }, axisLabel: { color:'#fff', }, axisLine: { lineStyle: { type: 'solid', color: '#fff', } } } ], yAxis : [ { type : 'value', axisLabel: { color:'#fff', }, axisLine: { lineStyle: { type: 'solid', color: '#fff', } } } ], series : [ { name:'用户人数', type:'bar', barWidth: 30, label: { normal: { show: true, position: 'top', color: '#fff' } }, barWidth: 30, data:data.data.y } ] }; if (personnelOption && typeof personnelOption === "object") { personnelChart.setOption(personnelOption, true); } }else{ userpage = 1; } } }); } //河南省各项目应急联络方式 function leader() { if(olist.length <= 4){ var str = ''; for (var i=0;i'; str += ''+olist[i]['leader']+''; str += ''+olist[i]['leader_phone']+''; str += ''; } $('#leader').html(str); }else{ if(maxleader < olist.length){ var str = ''; for (var i=minleader;i<=maxleader;i++){ str += ''; str += ''+olist[i]['name']+''; str += ''+olist[i]['leader']+''; str += ''+olist[i]['leader_phone']+''; str += ''; } $('#leader').html(str); minleader = minleader + 4; maxleader = maxleader + 4; }else if(maxleader >= olist.length&&minleader < olist.length){ var str = ''; for (var i=minleader;i'; str += ''+olist[i]['leader']+''; str += ''+olist[i]['leader_phone']+''; str += ''; } $('#leader').html(str); minleader = 0; maxleader = 3; }else{ minleader = 0; maxleader = 3; } } } //河南省各项目 function program() { if(olist.length <= 7){ var str = ''; for (var i=0;i'; str += ''; } $('#program').html(str); }else{ if(maxprogram < olist.length){ var str = ''; for (var i=minprogram;i<=maxprogram;i++){ str += '
  • '; str += ''+olist[i]['name']+''; str += '
  • '; } $('#program').html(str); minprogram = minprogram + 7; maxprogram = maxprogram + 7; }else if(maxprogram >= olist.length&&minprogram < olist.length){ var str = ''; for (var i=minprogram;i'; str += ''; } $('#program').html(str); minprogram = 0; maxprogram = 6; }else{ minprogram = 0; maxprogram = 6; } } } //河南省隐患数据详细统计 function yinhuan() { $.get('/api/Statics/yinhuan',{orgid:orgid,page:yinhuanpage},function (ret) { if(ret.status == 0){ let list = ret.data.list; if(list.length > 0){ yinhuanpage++; let str = ''; for (var o in list){ str += ''; str += '' + list[o]['time'] + ''; str += ''+list[o]['name']+''; str += ''+list[o]['ocount']+''; str += ''+list[o]['tcount']+''; str += ''; } $('#yinhuan').html(str); }else{ yinhuanpage = 1; } } }); } //河南省防患预警数据和投诉数据 function prevention() { $.get('/api/Statics/yhts',{orgid:orgid,page:preventionpage},function (data) { if(data.status == 0){ if(data.data.x.length > 0){ preventionpage++; var preventionChart = echarts.init(document.getElementById("prevention")); preventionOption = null; preventionOption = { color:['#50e2cb','#137bc4','#eac304'], tooltip: { trigger: 'axis', axisPointer: { type: 'cross', crossStyle: { color: '#999' } } }, legend: { data:['防患数据','投诉意见数据','已转任务比率'], textStyle: { color: "#FFFDFE" }, top: 10 // icon: "circle", }, // grid: { // left: '3%', // right: '4%', // bottom: '-3%', // containLabel: true // }, xAxis: [ { type: 'category', data : data.data.x, axisPointer: { type: 'shadow' }, axisLabel: { color:'#fff', } } ], yAxis: [ { type: 'value', axisLabel: { formatter: '{value}', color:'#fff', }, axisLine: { show: true, lineStyle: { color: '#ccc' } } }, { type: 'value', axisLabel: { formatter: '{value} %', color:'#fff', }, axisLine: { show: true, lineStyle: { color: '#ccc' } } } ], series: [ { name:'防患数据', type:'bar', barWidth: 30, data:data.data.y2 }, { name:'投诉意见数据', type:'bar', barWidth: 30, data:data.data.y1 }, { name:'已转任务比率', type:'line', yAxisIndex: 1, data:data.data.y3 } ] }; if (preventionOption && typeof preventionOption === "object") { preventionChart.setOption(preventionOption, true); } }else{ preventionpage = 1; } } }); } //河南省各项目任务总量统计 function assignments() { $.get('/api/Statics/todo',{orgid:orgid,page:assignmentspage},function (data) { if(data.status == 0){ if(data.data.x.length > 0){ assignmentspage++; var assignmentsChart = echarts.init(document.getElementById("assignments")); assignmentsOption = null; assignmentsOption = { // title: { // text: '各项目任务总量统计' // }, color:['#50e2cb','#137bc4'], tooltip : { trigger: 'axis', axisPointer: { type: 'cross', label: { backgroundColor: '#6a7985' } } }, legend: { data:['已完成','未完成'], textStyle: { color: "#FFFDFE" }, top: 10 }, grid: { left: '3%', right: '4%', bottom: '3%', containLabel: true }, xAxis : [ { type : 'category', boundaryGap : false, data : data.data.x, axisLabel: { color:'#fff', } } ], yAxis : [ { type : 'value', axisLabel: { color:'#fff', } } ], series : [ { name:'已完成', type:'line', stack: '总量', areaStyle: {}, data:data.data.y1 }, { name:'未完成', type:'line', stack: '总量', areaStyle: {}, data:data.data.y2 } ] }; if (assignmentsOption && typeof assignmentsOption === "object") { assignmentsChart.setOption(assignmentsOption, true); } }else{ assignmentspage = 1; } } }); } //各项目订单近一周总量数据分析 function orders() { $.get('/api/Statics/order',{orgid:orgid,page:orderspage},function (data) { if(data.status == 0){ if(data.data.x.length > 0){ orderspage++; $('#orders-name').html(data.data.name); var ordersChart = echarts.init(document.getElementById("orders")); ordersOption = null; ordersOption = { color: ['#50e2cb'], tooltip: { trigger: 'axis', axisPointer: { type: 'shadow' } }, grid: { left: '3%', right: '4%', bottom: '3%', containLabel: true }, xAxis: { type: 'value', boundaryGap: [0, 0.01], axisLabel: { color:'#fff', } }, yAxis: { type: 'category', data: data.data.y, axisLabel: { color:'#fff', } }, series: [ { name: '订单量', type: 'bar', barMaxWidth: 30, label: { normal: { show: true, position: 'right', color: '#fff' } }, data: data.data.x } ] }; if (ordersOption && typeof ordersOption === "object") { ordersChart.setOption(ordersOption, true); } }else{ orderspage = 1; } } }); } //各项目巡查近一周数据统计 function patrol() { $.get('/api/Statics/patrol',{orgid:orgid,page:patrolpage},function (data) { if(data.status == 0){ if(data.data.ll.length > 0){ patrolpage++; $('#patrol-name').html(data.data.name); var patrolChart = echarts.init(document.getElementById("patrol")); patrolOption = null; patrolOption = { color: ['#50e2cb'], legend: { data:['巡查次数'], textStyle: { color: "#FFFDFE" }, top: 15 // icon: "circle", }, tooltip: {}, dataset: { dimensions: ['day', '巡查次数'], source: data.data.ll, /*source: [ {day: '6-1', '巡查次数': 43}, {day: '6-2', '巡查次数': 83}, {day: '6-3', '巡查次数': 86}, {day: '6-4', '巡查次数': 72}, {day: '6-5', '巡查次数': 99}, {day: '6-6', '巡查次数': 88}, {day: '6-7', '巡查次数': 110} ]*/ }, xAxis: { type: 'category', axisLabel: { color:'#fff', } }, yAxis: { axisLabel: { color:'#fff', } }, series: [ { type: 'bar', barWidth: 30, label: { normal: { show: true, position: 'top', color: '#fff' } }, } ] }; if (patrolOption && typeof patrolOption === "object") { patrolChart.setOption(patrolOption, true); } }else{ patrolpage = 1; } } }); } //员工学习 function learning() { $.get('/api/Statics/article',{orgid:yuangongxuexi[0].orgid},function (data) { if(data.status == 0){ if(data.data.length > 0){ var str = '项目名称'; for (var o in yuangongxuexi){ if(o == 0){ str += ''+yuangongxuexi[o].name+''; }else{ str += ''+yuangongxuexi[o].name+''; } } $('#yuangongxuexi').html(str); var learningChart = echarts.init(document.getElementById("learning")); learningOption = null; learningOption = { color:['#50e2cb','#7dc5fa','#137bc4','#219180'], tooltip : { trigger: 'item', formatter: "{a}
    {b} : {c} ({d}%)" }, series : [ { name: '学习情况', type: 'pie', radius : '55%', center: ['50%', '50%'], data:data.data, /* data:[ {value:335, name:'保洁'}, {value:310, name:'保安'}, {value:234, name:'维修'}, {value:135, name:'运送'}, ],*/ itemStyle: { emphasis: { shadowBlur: 10, shadowOffsetX: 0, shadowColor: 'rgba(0, 0, 0, 0.5)' } }, label: { formatter: '{b}{d}%', color: '#fff' } } ] }; if (learningOption && typeof learningOption === "object") { learningChart.setOption(learningOption, true); } yuangongxuexi.shift(); if(yuangongxuexiindex >= olist.length){ yuangongxuexiindex = 0; } yuangongxuexi.push(olist[yuangongxuexiindex]); yuangongxuexiindex++; } } }); } var time = 10000; user(); leader(); program(); yinhuan(); prevention(); assignments(); orders(); patrol(); learning(); setInterval(function () { user(); leader(); program(); yinhuan(); prevention(); assignments(); orders(); patrol(); learning(); },time);