123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701 |
- 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<olist.length;i++){
- str += '<tr>';
- str += '<td class="table-project-name">'+olist[i]['name']+'</td>';
- str += '<td>'+olist[i]['leader']+'</td>';
- str += '<td>'+olist[i]['leader_phone']+'</td>';
- str += '</tr>';
- }
- $('#leader').html(str);
- }else{
- if(maxleader < olist.length){
- var str = '';
- for (var i=minleader;i<=maxleader;i++){
- str += '<tr>';
- str += '<td class="table-project-name">'+olist[i]['name']+'</td>';
- str += '<td>'+olist[i]['leader']+'</td>';
- str += '<td>'+olist[i]['leader_phone']+'</td>';
- str += '</tr>';
- }
- $('#leader').html(str);
- minleader = minleader + 4;
- maxleader = maxleader + 4;
- }else if(maxleader >= olist.length&&minleader < olist.length){
- var str = '';
- for (var i=minleader;i<olist.length;i++){
- str += '<tr>';
- str += '<td class="table-project-name">'+olist[i]['name']+'</td>';
- str += '<td>'+olist[i]['leader']+'</td>';
- str += '<td>'+olist[i]['leader_phone']+'</td>';
- str += '</tr>';
- }
- $('#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<olist.length;i++){
- str += '<li>';
- str += '<a href="#">'+olist[i]['name']+'</a>';
- str += '</li>';
- }
- $('#program').html(str);
- }else{
- if(maxprogram < olist.length){
- var str = '';
- for (var i=minprogram;i<=maxprogram;i++){
- str += '<li>';
- str += '<a href="#">'+olist[i]['name']+'</a>';
- str += '</li>';
- }
- $('#program').html(str);
- minprogram = minprogram + 7;
- maxprogram = maxprogram + 7;
- }else if(maxprogram >= olist.length&&minprogram < olist.length){
- var str = '';
- for (var i=minprogram;i<olist.length;i++){
- str += '<li>';
- str += '<a href="#">'+olist[i]['name']+'</a>';
- str += '</li>';
- }
- $('#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 += '<tr>';
- str += '<td>' + list[o]['time'] + '</td>';
- str += '<td class="table-project-name">'+list[o]['name']+'</td>';
- str += '<td>'+list[o]['ocount']+'</td>';
- str += '<td>'+list[o]['tcount']+'</td>';
- str += '</tr>';
- }
- $('#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 = '<span class="projects">项目名称</span>';
- for (var o in yuangongxuexi){
- if(o == 0){
- str += '<span class="projects-title active">'+yuangongxuexi[o].name+'</span>';
- }else{
- str += '<span class="projects-title">'+yuangongxuexi[o].name+'</span>';
- }
- }
- $('#yuangongxuexi').html(str);
- var learningChart = echarts.init(document.getElementById("learning"));
- learningOption = null;
- learningOption = {
- color:['#50e2cb','#7dc5fa','#137bc4','#219180'],
- tooltip : {
- trigger: 'item',
- formatter: "{a} <br/>{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);
|