| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986 | // 各地区名称var region = [];province.forEach(function(item){    region.push(item.NAME);});// 各地区用户人数var users = [];province.forEach(function(item){    users.push(item.usercount);});// 巡更次数var patrolCount = province.map(item => ({        day: item.patrolx,        '巡查次数': item.patroly,    }));// 各地区近一周订单量var ordersWeek = [];province.forEach(function(item){    ordersWeek.push(item.ordertotalweek);});// 各地区近一月订单量var ordersMonth = [];province.forEach(function(item){    ordersMonth.push(item.ordertotalmonth);});// 防患数据var prevent = [];province.forEach(function(item){    prevent.push(item.yinhuaorder);});// 投诉数据var complain = [];province.forEach(function(item){    complain.push(item.complaincount);});// 已转任务比率var preventionRatio = [];province.forEach(function(item){    preventionRatio.push(parseInt(item.yinhuabl * 100));});// 总任务量var taskTotal = [];province.forEach(function(item){    taskTotal.push(item.todototalcount);});// 已转任务比率var taskFinishRatio = [];province.forEach(function(item){    taskFinishRatio.push(item.todobl * 100);});// 设备维护次数var deviceCount = [];province.forEach(function(item){    deviceCount.push(item.devicerecordcount);});// 保洁var cleaningRatio = [];province.forEach(function(item){    cleaningRatio.push(item.userbl3 * 100);});// 保安var securityRatio = [];province.forEach(function(item){    securityRatio.push(item.userbl4 * 100);});// 维修var repairRatio = [];province.forEach(function(item){    repairRatio.push(item.userbl2 * 100);});// 运送var transportRatio = [];province.forEach(function(item){    transportRatio.push(item.userbl1 * 100);});// 安保数据统计(列表)var preventDayList = province.map(item => ({        region: item.NAME,        date: item.daytext,        count: item.yinhuanday    }));var preventWeekList = province.map(item => ({        region: item.NAME,        date: item.weektext,        count: item.yinhuanweek    }));var preventMonthList = province.map(item => ({        region: item.NAME,        date: item.monthtext,        count: item.yinhuanmonth    }));// 任务数据统计(列表)var taskFinishDayList = province.map(item => ({        region: item.NAME,        date: item.daytext,        count: item.todofinishday    }));var taskFinishWeekList = province.map(item => ({        region: item.NAME,        date: item.weektext,        count: item.todofinishweek    }));var taskFinishMonthList = province.map(item => ({        region: item.NAME,        date: item.monthtext,        count: item.todofinishmonth    }));var regionsList = [];var regionsListIndex = 0;//初始化for (var i=0;i<5;i++){    if(regionsListIndex >= region.length){        regionsListIndex = 0;    }    regionsList.push(region[regionsListIndex]);    regionsListIndex++;}function personnel() {    if (province.length > 0) {        var personnelChart = echarts.init(document.getElementById("personnel"));        personnelOption = null;        personnelOption = {            color: ['#50e2cb'],            legend: {                data:['用户人数'],                textStyle: { color: "#FFFDFE" },                // icon: "circle",            },            tooltip : {                trigger: 'axis',                axisPointer : {            // 坐标轴指示器,坐标轴触发有效                    type : 'shadow'        // 默认为直线,可选为:'line' | 'shadow'                }            },            grid: {                left: '3%',                right: '4%',                bottom: '3%',                containLabel: true            },            xAxis : [                {                    type : 'category',                    data : region,                    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',                    barMaxWidth: 30,                    label: {                        normal: {                            show: true,                            position: 'top',                            color: '#fff'                        }                    },                    data: users                }            ]        };        if (personnelOption && typeof personnelOption === "object") {            personnelChart.setOption(personnelOption, true);        }    }}function orders(type) {    if (province.length > 0) {        var list = type === 1 ? ordersWeek : ordersMonth;        var ordersChart = echarts.init(document.getElementById("orders"));        ordersOption = null;        ordersOption = {            color:['#50e2cb','#137bc4'],            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 : region,                axisLabel: {                    color:'#fff',                }            },            series: [                {                    name: '订单量',                    type: 'bar',                    barMaxWidth: 30,                    label: {                        normal: {                            show: true,                            position: 'right',                            color: '#fff'                        }                    },                    data: list                }            ]        };        if (ordersOption && typeof ordersOption === "object") {            ordersChart.setOption(ordersOption, true);        }    }    $('.orders-selects-total').removeClass('active');    $('#orders'+type).addClass('active');}// 各地安保图表function prevention() {    if (province.length > 0) {        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            },            xAxis: [                {                    type: 'category',                    data : region,                    axisPointer: {                        type: 'shadow'                    },                    axisLabel: {                        color:'#fff',                    }                }            ],            yAxis: [                {                    type: 'value',                    axisLabel: {                        formatter: '{value}',                        color:'#fff',                    }                },                {                    type: 'value',                    axisLabel: {                        formatter: '{value} %',                        color:'#fff',                    }                }            ],            series: [                {                    name:'防患数据',                    type:'bar',                    data: prevent                },                {                    name:'投诉意见数据',                    type:'bar',                    data: complain                },                {                    name:'已转任务比率',                    type:'line',                    yAxisIndex: 1,                    data: preventionRatio                }            ]        };        if (preventionOption && typeof preventionOption === "object") {            preventionChart.setOption(preventionOption, true);        }    }}// 任务完成比率function taskRatio() {    if (province.length > 0) {        var assignmentsChart = echarts.init(document.getElementById("assignments"));        assignmentsOption = null;        assignmentsOption = {            color:['#50e2cb','#137bc4'],            tooltip: {                trigger: 'axis',                axisPointer: {                    type: 'cross',                    crossStyle: {                        color: '#999'                    }                }            },            legend: {                data:['总任务量','完成任务比率'],                textStyle: { color: "#FFFDFE" },                top: 10            },            xAxis: [                {                    type: 'category',                    data : region,                    axisPointer: {                        type: 'shadow'                    },                    axisLabel: {                        color:'#fff',                    }                }            ],            yAxis: [                {                    type: 'value',                    axisLabel: {                        formatter: '{value}',                        color:'#fff',                    }                },                {                    type: 'value',                    axisLabel: {                        formatter: '{value} %',                        color:'#fff',                    }                }            ],            series: [                {                    name:'总任务量',                    type:'bar',                    barMaxWidth: 30,                    data: taskTotal                },                {                    name:'完成任务比率',                    type:'line',                    yAxisIndex: 1,                    data: taskFinishRatio                }            ]        };        if (assignmentsOption && typeof assignmentsOption === "object") {            assignmentsChart.setOption(assignmentsOption, true);        }    }}// 员工学习function learning(i) {    if (province.length > 0) {        // var str = '';        // for (var i in region){        //     str += '<span class="organization-title">'+region[i]+'</span>';        // }        // $('#leaning-title').html(str);        $('.region').removeClass('active');        $('#region'+i).addClass('active');        var cleaning = echarts.init(document.getElementById('cleaning'));        cleaningOption = {            color: ['#2b5e8e', '#40edfe'],            title: {                text: '保洁',                textStyle: {                    color: '#fff',                    fontSize: 14,                },                y: 'bottom',                x: 'center',            },            series: [{                name: '保洁',                type: 'pie',                radius: ['50%', '60%'],                avoidLabelOverlap: false,                label: {                    normal: {                        show: false,                        position: 'center',                        textStyle: {                            fontSize: 18,                            color: '#eac304',                        },                        formatter: '{c}%'                    }                },                labelLine: {                    normal: {                        show: false                    }                },                data: [                    {                        value: parseInt(100 - cleaningRatio[i]),                        color: '#40edfe',                        label: {                            normal: {                                show: false                            }                        }                    },                    {                        value: parseInt(cleaningRatio[i]),                        color: '#2b5e8e',                        label: {                            normal: {                                show: true,                                position: 'center',                                textStyle: {                                    fontSize: 18,                                    color: '#eac304',                                },                                formatter: '{c}%'                            }                        }                    }                ]            }]        };        cleaning.setOption(cleaningOption);        // 保安        var security = echarts.init(document.getElementById('security'));        securityOption = {            color: ['#2b5e8e', '#40edfe'],            title: {                text: '保安',                textStyle: {                    color: '#fff',                    fontSize: 14,                },                y: 'bottom',                x: 'center',            },            series: [{                name: '保安',                type: 'pie',                radius: ['50%', '60%'],                avoidLabelOverlap: false,                label: {                    normal: {                        show: true,                        position: 'center',                        textStyle: {                            fontSize: 18,                            color: '#eac304',                        },                        formatter: '{c}%'                    }                },                labelLine: {                    normal: {                        show: false                    }                },                data: [{                    value: parseInt(100 - securityRatio[i]),                    color: '#40edfe',                    label: {                        normal: {                            show: false                        }                    }                }, {                    value: parseInt(securityRatio[i]),                    color: '#2b5e8e',                    label: {                        normal: {                            show: true,                            position: 'center',                            textStyle: {                                fontSize: 18,                                color: '#eac304',                            },                            formatter: '{c}%'                        }                    }                },                ]            }]        };        security.setOption(securityOption);        // 维修        var repair = echarts.init(document.getElementById('repair'));        repairOption = {            color: ['#2b5e8e', '#40edfe'],            title: {                text: '维修',                textStyle: {                    color: '#fff',                    fontSize: 14,                },                y: 'bottom',                x: 'center',            },            series: [{                name: '维修',                type: 'pie',                radius: ['50%', '60%'],                avoidLabelOverlap: false,                label: {                    normal: {                        show: true,                        position: 'center',                        textStyle: {                            fontSize: 18,                            color: '#eac304',                        },                        formatter: '{c}%'                    }                },                labelLine: {                    normal: {                        show: false                    }                },                data: [{                    value: parseInt(100 - repairRatio[i]),                    color: '#40edfe',                    label: {                        normal: {                            show: false                        }                    }                }, {                    value: parseInt(repairRatio[i]),                    color: '#2b5e8e',                    label: {                        normal: {                            show: true,                            position: 'center',                            textStyle: {                                fontSize: 18,                                color: '#eac304',                            },                            formatter: '{c}%'                        }                    }                }]            }]        };        repair.setOption(repairOption);        // 运送        var transport = echarts.init(document.getElementById('transport'));        transportOption = {            color: ['#2b5e8e', '#40edfe'],            title: {                text: '运送',                textStyle: {                    color: '#fff',                    fontSize: 14,                },                y: 'bottom',                x: 'center',            },            series: [{                name: '运送',                type: 'pie',                radius: ['50%', '60%'],                avoidLabelOverlap: false,                label: {                    normal: {                        show: true,                        position: 'center',                        textStyle: {                            fontSize: 18,                            color: '#eac304',                        },                        formatter: '{c}%'                    }                },                labelLine: {                    normal: {                        show: false                    }                },                data: [{                    value: parseInt(100 - transportRatio[i]),                    color: '#40edfe',                    label: {                        normal: {                            show: false                        }                    }                }, {                    value: parseInt(transportRatio[i]),                    color: '#2b5e8e',                    label: {                        normal: {                            show: true,                            position: 'center',                            textStyle: {                                fontSize: 18,                                color: '#eac304',                            },                            formatter: '{c}%'                        }                    }                },                ]            }]        };        transport.setOption(transportOption);    }}// 各地区设备维护function deviceRecord() {    if (province.length > 0) {        var deviceChart = echarts.init(document.getElementById("device"));        deviceOption = null;        deviceOption = {            color: ['#50e2cb'],            legend: {                data:['维护次数'],                textStyle: { color: "#FFFDFE" },                // icon: "circle",            },            tooltip : {                trigger: 'axis',                axisPointer : {            // 坐标轴指示器,坐标轴触发有效                    type : 'shadow'        // 默认为直线,可选为:'line' | 'shadow'                }            },            grid: {                left: '3%',                right: '4%',                bottom: '3%',                containLabel: true            },            xAxis : [                {                    type : 'category',                    data : region,                    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',                    barMaxWidth: 30,                    label: {                        normal: {                            show: true,                            position: 'top',                            color: '#fff'                        }                    },                    data: deviceCount                }            ]        };        if (deviceOption && typeof deviceOption === "object") {            deviceChart.setOption(deviceOption, true);        }    }}// 各地区任务列表function taskList(type) {    if (province.length > 0) {        if (province.length > 0) {            var list;            if (type == 1) {                list = taskFinishDayList;            } else if (type == 2) {                list = taskFinishWeekList;            } else {                list = taskFinishMonthList;            }            let str = '';            for (var i in list) {                str += '<tr>';                str += '<td>' + list[i]['region'] + '</td>';                str += '<td>' + list[i]['date'] + '</td>';                str += '<td>' + list[i]['count'] + '</td>';                str += '</tr>';            }            $('#task').html(str);        }        $('.task').removeClass('active');        $('#tasks' + type).addClass('active');    }}// 各地区隐患列表function preventionList(type) {    if (province.length > 0) {        var list;        if (type == 1) {            list = preventDayList;        } else if (type == 2) {            list = preventWeekList;        } else {            list = preventMonthList;        }        let str = '';        for (var i in list){            str += '<tr>';            str += '<td>' + list[i]['region'] + '</td>';            str += '<td>'+ list[i]['date'] +'</td>';            str += '<td>'+ list[i]['count'] +'</td>';            str += '</tr>';        }        $('#hiddenDanger').html(str);    }    $('.date').removeClass('active');    $('#date'+type).addClass('active');}function patrol(i) {    if (province.length > 0) {        // var str = '';        // for (var o in region){        //     if(o == 0){        //         str += '<span class="organization-title regions active">'+region[o]+'</span>';        //     }else{        //         str += '<span class="organization-title regions">'+region[o]+'</span>';        //     }        // }        // $('#patrol-title').html(str);        var patrolChart = echarts.init(document.getElementById("patrol"));        patrolOption = null;        patrolOption = {            color: ['#50e2cb', '#137bc4'],            legend: {                data: ['巡查次数'],                textStyle: {color: "#FFFDFE"},                // icon: "circle",            },            tooltip: {},            dataset: {                dimensions: ['day', '巡查次数'],                source: patrolCount[i]            },            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);        }        $('.regions').removeClass('active');        $('#regions'+i).addClass('active');        // regionsList.shift();        // if(regionsListIndex >= region.length){        //     regionsListIndex = 0;        // }        // regionsList.push(region[regionsListIndex]);        // regionsListIndex++;    }}$(function(){    var text=$("#task:first");    var clear;    text.hover(function(){        clearInterval(clear);    },function(){        clear=setInterval(function(){            var field=text.find("tr:first");            var high=field.height();            text.animate({ marginTop:-high+"px"},600,function(){                field.css("marginTop",0).appendTo(text);                text.css("marginTop",0);            })        },2000)//滚动间隔时间    }).trigger("mouseleave");//自动滚动});$(function(){    var text=$("#hiddenDanger:first");    var clear;    text.hover(function(){        clearInterval(clear);    },function(){        clear=setInterval(function(){            var field=text.find("tr:first");            var high=field.height();            text.animate({ marginTop:-high+"px"},600,function(){                field.css("marginTop",0).appendTo(text);                text.css("marginTop",0);            })        },2000)//滚动间隔时间    }).trigger("mouseleave");//自动滚动});personnel();orders(1);prevention();taskRatio();learning(0);deviceRecord();taskList(1);preventionList(1);patrol(0);for (var i=1; i<4; i++) {    (function (i) {        setTimeout(() => taskList(i), 10000*i);        setTimeout(() => preventionList(i), 10000*i);    })(i)}setInterval(function(){    for (var i=1; i<4; i++) {        (function (i) {            setTimeout(() => taskList(i), 10000*i);            setTimeout(() => preventionList(i), 10000*i);        })(i)    }},30000);for (var i=1; i<3; i++) {    (function (i) {        setTimeout(() => orders(i), 5000*i);    })(i)}setInterval(function(){    for (var i=1; i<3; i++) {        (function (i) {            setTimeout(() => orders(i), 5000*i);        })(i)    }},10000);var len = region.length;for (var i = 0; i< len; i++) {    (function (i) {        setTimeout(() => learning(i), 5000*i);        setTimeout(() => patrol(i), 5000*i);    })(i)}setInterval(function(){    for (var i = 0; i < len; i++) {        (function (i) {            setTimeout(() => learning(i), 5000*i);            setTimeout(() => patrol(i), 5000*i);        })(i)    }},5000 * len);// setInterval(function(){//     patrol();// },5000);
 |