//人员大数据统计
function user() {
    $.get('/api/Project/user',{orgid:orgid},function (data) {
        if(data.status == 0){
            if(data.data.length > 0){
                // 保洁
                var cleaning = echarts.init(document.getElementById('cleaning'));
                cleaningOption = {
                    color: ['#2b5e8e', '#40edfe'],
                    title: {
                        text: '保洁人员',
                        textStyle: {
                            color: '#fff',
                            fontSize: 14,
                        },
                        y: 'center',
                        x: 'right',
                    },
                    series: [{
                        name: '保洁人员',
                        type: 'pie',
                        radius: ['70%', '80%'],
                        avoidLabelOverlap: false,
                        label: {
                            normal: {
                                show: false,
                                position: 'center',
                                textStyle: {
                                    fontSize: 14,
                                    color: '#eac304',
                                },
                                formatter: '{c}%'
                            }
                        },
                        labelLine: {
                            normal: {
                                show: false
                            }
                        },
                        data: [
                            {
                                value: 100 - data.data[2]['percent'],
                                color: '#40edfe',
                                label: {
                                    normal: {
                                        show: false
                                    }
                                }
                            },
                            {
                                value: data.data[2]['percent'],
                                color: '#2b5e8e',
                                label: {
                                    normal: {
                                        show: true,
                                        position: 'center',
                                        textStyle: {
                                            fontSize: 14,
                                            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: 'center',
                        x: 'right',
                    },
                    series: [{
                        name: '保安人员',
                        type: 'pie',
                        radius: ['70%', '80%'],
                        avoidLabelOverlap: false,
                        label: {
                            normal: {
                                show: true,
                                position: 'center',
                                textStyle: {
                                    fontSize: 14,
                                    color: '#eac304',
                                },
                                formatter: '{c}%'
                            }
                        },
                        labelLine: {
                            normal: {
                                show: false
                            }
                        },
                        data: [{
                            value: 100 - data.data[3]['percent'],
                            color: '#40edfe',
                            label: {
                                normal: {
                                    show: false
                                }
                            }
                        }, {
                            value: data.data[3]['percent'],
                            color: '#2b5e8e',
                            label: {
                                normal: {
                                    show: true,
                                    position: 'center',
                                    textStyle: {
                                        fontSize: 14,
                                        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: 'center',
                        x: 'right',
                    },
                    series: [{
                        name: '维修人员',
                        type: 'pie',
                        radius: ['70%', '80%'],
                        avoidLabelOverlap: false,
                        label: {
                            normal: {
                                show: true,
                                position: 'center',
                                textStyle: {
                                    fontSize: 14,
                                    color: '#eac304',
                                },
                                formatter: '{c}%'
                            }
                        },
                        labelLine: {
                            normal: {
                                show: false
                            }
                        },
                        data: [{
                            value: 100 - data.data[1]['percent'],
                            color: '#40edfe',
                            label: {
                                normal: {
                                    show: false
                                }
                            }
                        }, {
                            value: data.data[1]['percent'],
                            color: '#2b5e8e',
                            label: {
                                normal: {
                                    show: true,
                                    position: 'center',
                                    textStyle: {
                                        fontSize: 14,
                                        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: 'center',
                        x: 'right',
                    },
                    series: [{
                        name: '运送人员',
                        type: 'pie',
                        radius: ['70%', '80%'],
                        avoidLabelOverlap: false,
                        label: {
                            normal: {
                                show: true,
                                position: 'center',
                                textStyle: {
                                    fontSize: 14,
                                    color: '#eac304',
                                },
                                formatter: '{c}%'
                            }
                        },
                        labelLine: {
                            normal: {
                                show: false
                            }
                        },
                        data: [{
                            value: 100 - data.data[0]['percent'],
                            color: '#40edfe',
                            label: {
                                normal: {
                                    show: false
                                }
                            }
                        }, {
                            value: data.data[0]['percent'],
                            color: '#2b5e8e',
                            label: {
                                normal: {
                                    show: true,
                                    position: 'center',
                                    textStyle: {
                                        fontSize: 14,
                                        color: '#eac304',
                                    },
                                    formatter: '{c}%'
                                }
                            }
                        },
                        ]
                    }]
                };
                transport.setOption(transportOption);
            }
        }
    });
}
// 人员统计玫瑰图
function personnel() {
    $.get('/api/Project/personnel',{orgid:orgid},function (data) {
        if(data.status == 0){
            if(data.data.length > 0){
                var personnel = echarts.init(document.getElementById('personnel'));
                personnelOption = {
                    color:['#fdd100','#ec5400','#40ebff','#ff4874'],
                    tooltip : {
                        trigger: 'item',
                        formatter: "{a} 
{b} : {c} ({d}%)"
                    },
                    legend: {
                        x : 'left',
                        y : 'center',
                        left: 50,
                        textStyle: {
                            color: '#fff',
                            fontSize: 12,
                        },
                        orient: 'vertical',
                        data:['保洁','保安','维修','运送']
                    },
                    calculable : true,
                    series : [
                        {
                            name:'人员大数据统计',
                            type:'pie',
                            radius : [20, 70],
                            center : ['60%', '50%'],
                            roseType : 'radius',
                            data:data.data,
                            // data:[
                            //     {value:30, name:'保洁'},
                            //     {value:25, name:'保安'},
                            //     {value:20, name:'维修'},
                            //     {value:25, name:'运送'}
                            // ],
                            label: {
                                formatter: '{b}{d}%',
                                color: '#fff'
                            }
                        }
                    ]
                };
                personnel.setOption(personnelOption);
            }
        }
    });
}
// 工单统计
function todo(type) {
    $.get('/api/Project/todo',{orgid:orgid, type: type},function (data) {
        if(data.status == 0){
            if(data.data.list.length > 0){
                var ordersChart = echarts.init(document.getElementById("orders"));
                ordersOption = null;
                ordersOption = {
                    color:'#00c6ff',
                    tooltip: {},
                    dataset: {
                        dimensions: ['day', '工单量'],
                        source: data.data.list,
                    },
                    xAxis: {
                        type: 'category',
                        axisLabel: {
                            color:'#fff',
                        }
                    },
                    yAxis: {
                        axisLabel: {
                            color:'#fff',
                        }
                    },
                    series: [
                        {
                            type: 'bar',
                            barMaxWidth:'30',
                            label: {
                                normal: {
                                    show: true,
                                    position: 'top',
                                    color: '#fff'
                                }
                            },
                        }
                    ]
                };
                if (ordersOption && typeof ordersOption === "object") {
                    ordersChart.setOption(ordersOption, true);
                }
                $('.todo').removeClass('active');
                $('#todo'+type).addClass('active');
            }
        }
    });
}
//投诉大数据
function complaintList() {
    $.get('/api/Project/complaint',{orgid:orgid},function (res) {
        if(res.status == 0) {
            let list = res.data.data;
            if (list.length > 0) {
                var str = '';
                for (var i in list){
                    str += '