<!-- <template>
    <div class="DPcomputer21Box"> -->
        <!-- 采区产量统计 -->
        <!-- <div class="dataAnalysisScrView_leftView_title">采区产量统计</div>
        <div class="dataAnalysisScrView_leftView_content" style="position: relative;">
            <div id="echarts1View"></div>
        </div>
    </div>
</template> -->
<!-- 
<script>
import { Tools, HttpReq, CAMap} from '@/assets/js/common.js';
import * as echarts from 'echarts';
import "echarts-gl";
import { getPie3D } from "../../../components/echarts/bingtu3d";


export default {
    data(){
        return {
            DPcomputer21BoxTimer:null,
            //采取产量统计
            echarts1Data:[],
        }
    },
    mounted(){
        this.loadData();
    },
    methods:{
        loadData(){
            //采取产量统计图表
            HttpReq.truckDispatching.getApiHl1().then((res) => {
                if(res.code == 200){
                    let colorARR = ['#00A8FF','#8FDFFE','#F4F03A','#F5335C','#E68220','#00A8FF','#8FDFFE','#F4F03A','#F5335C','#E68220'];
                    let centerArray = [];
                    res.data.content.forEach((item,index)=>{
                        let a1 = {};
                        let a2 = {};
                        a1.name = item.name;
                        a1.value = item.num;
                        a2.opacity = 0.2,
                        a2.color = colorARR[index],
                        a1.itemStyle = a2;
                        centerArray.push(a1);
                    })
                    this.echarts1Data = centerArray;
                }
                this.echarts1_1Fn();
            })

            this.DPcomputer21BoxTimer = setInterval(() => {
                //采取产量统计图表
                HttpReq.truckDispatching.getApiHl1().then((res) => {
                    if(res.code == 200){
                        let colorARR = ['#00A8FF','#8FDFFE','#F4F03A','#F5335C','#E68220','#00A8FF','#8FDFFE','#F4F03A','#F5335C','#E68220'];
                        let centerArray = [];
                        res.data.content.forEach((item,index)=>{
                            let a1 = {};
                            let a2 = {};
                            a1.name = item.name;
                            a1.value = item.num;
                            a2.opacity = 0.2,
                            a2.color = colorARR[index],
                            a1.itemStyle = a2;
                            centerArray.push(a1);
                        })
                        this.echarts1Data = centerArray;
                    }
                    this.echarts1_1Fn();
                })
            },20000)

        },
        //采取产量统计
        echarts1_1Fn(){
            // 基于准备好的dom，初始化echarts实例
            echarts.init(document.getElementById('echarts1View')).dispose();
            let chartPanel = echarts.init(document.getElementById("echarts1View"));
            for (let i = 0; i < this.echarts1Data.length; i++) {
                delete this.echarts1Data[i].itemStyle.opacity;
            }
            // 传入数据生成 option
            let series = getPie3D(this.echarts1Data, 2);  
            let option = {
                tooltip: {
                    formatter: (params) => {
                        if (
                        params.seriesName !== "mouseoutSeries" &&
                        params.seriesName !== "pie2d"
                        ) {
                        return `<div style="padding:0 0px">${params.seriesName}：${(
                            option.series[params.seriesIndex].pieData.proportion * 100
                        ).toFixed(2)}%</div>`;
                        }
                    },
                },
                legend: {
                    data: this.echarts1Data,
                    top:'center',
                    orient: 'vertical',
                    right: '7%',
                    textStyle: {
                        color: "#fff",
                        fontSize: 14,
                    },
                },
                xAxis3D: {
                min: -1,
                max: 1,
                },
                yAxis3D: {
                min: -1,
                max: 1,
                },
                zAxis3D: {
                min: -1,
                max: 1,
                },
                grid3D: {
                show: false, //是否显示三维笛卡尔坐标系。
                boxHeight: 15, //三维笛卡尔坐标系在三维场景中的高度
                top: "1%",
                // bottom: "80%",
                // environment: "#021041", //背景
                viewControl: {
                    //用于鼠标的旋转，缩放等视角控制
                    alpha: 40, //角度
                    distance: 210, //调整视角到主体的距离，类似调整zoom 重要
                    rotateSensitivity: 0, //设置为0无法旋转
                    zoomSensitivity: 0, //设置为0无法缩放
                    panSensitivity: 0, //设置为0无法平移
                    autoRotate: false, //自动旋转
                },
                },
                series: series,
            };
            chartPanel.setOption(option);
        },
    },
    beforeDestroy(){
        if(this.DPcomputer21BoxTimer) {
			clearInterval(this.DPcomputer21BoxTimer);
            this.DPcomputer21BoxTimer = null;
		}
    }
}
</script>

<style scoped>
*{
  margin: 0;
  padding: 0;
}
.DPcomputer21Box{
    width: 20vw;
    height: 23.5vh;
    background-color: rgba(32,42,67,0.95);
    padding: 5px 7px;
    box-sizing: border-box;
    overflow: hidden;
}
.DPcomputer21Box .dataAnalysisScrView_leftView_title{
    margin-bottom: 5px;
    width: 100%;
    height: 3.5vh;
    background:no-repeat center center url('~@/assets/images/cutGraph/biaoti1.png');
	background-size:100% 100%;
    padding-left: 10px;
    box-sizing: border-box;
    font-size: 18px;
    line-height: 3.5vh;
    color: #FAFAFB;
    letter-spacing: 1px;
    text-shadow: 1px 1px 1px #92CBFF;
}
.DPcomputer21Box .dataAnalysisScrView_leftView_content{
    width: 100%;
    height: 19vh;
}
.DPcomputer21Box #echarts1View{
    position: absolute;
    left: -10vh;
    top: -7vh;
    width: 120%;
    height: 27vh;
}
</style>

 -->

<template>
    <div class="DPcomputer1Box">
        <!-- 采区产量统计 -->
        <div class="dataScrView_leftView_title">采区产量统计</div>
        <div class="dataScrView_leftView_content">
            <div class="dataScrView_leftView_content_view1">
                <div class="dataScrView_leftView_content_view1_son1">{{parseInt(outputMineData.day.eff)}}%</div>
                <div style="color:white;margin-left:15px;font-size: 16px;">
                    <div>日产量</div>
                    <div class="outside-div1">
                        <div v-for="(item,index) in parseInt(parseInt(outputMineData.day.eff) / 10)" :key="index" class="inside-div1"></div>
                    </div>
                    当前日产量：
                    <span style="color:#02F7EF;">{{outputMineData.day.finish}}吨</span>
                </div>
            </div>
            <div class="dataScrView_leftView_content_view1">
                <div class="dataScrView_leftView_content_view1_son1">{{parseInt(outputMineData.month.eff)}}%</div>
                <div style="color:white;margin-left:15px;font-size: 16px;">
                    <div>月产量</div>
                    <div class="outside-div1">
                        <div v-for="(item,index) in parseInt(parseInt(outputMineData.month.eff) / 10)" :key="index" class="inside-div1"></div>
                    </div>
                    当前月产量：
                    <span style="color:#02F7EF;">{{outputMineData.month.finish}}吨</span>
                </div>
            </div>
            <div class="dataScrView_leftView_content_view1">
                <div class="dataScrView_leftView_content_view1_son1">{{parseInt(outputMineData.year.eff)}}%</div>
                <div style="color:white;margin-left:15px;font-size: 16px;">
                    <div>年产量</div>
                    <div class="outside-div1">
                        <div v-for="(item,index) in parseInt(parseInt(outputMineData.year.eff) / 10)" :key="index" class="inside-div1"></div>
                    </div>
                    当前年产量：
                    <span style="color:#02F7EF;">{{outputMineData.year.finish}}吨</span>
                </div>
            </div>
        </div>
    </div>
</template>

<script>
import { Tools, HttpReq, CAMap} from '@/assets/js/common.js';


export default {
    data(){
        return {
            //定时器
            DPcomputer1BoxTimer:null,
            //产量数据以及中间图表数据
            outputMineData:{
                day:{finish:'0',eff:0,plan:'0',},
                month:{finish:'0',eff:0,plan:'0',},
                year:{finish:'0',eff:0,plan:'0',},
            },
        }
    },
    mounted(){
        this.loadData();
    },
    methods:{
        loadData(){
            //获取采区当前日产量
            HttpReq.truckDispatching.apiPlanDayQuery().then((res) => {
                let undueArray = {};
                if(res.length == 0 || JSON.stringify(res[0]) == '{}'){
                    undueArray.eff = 0;
                    undueArray.finish = 0;
                    undueArray.plan = 0;
                }else{
                    if(res[0].eff == ''){
                        undueArray.eff = 0;
                        undueArray.finish = res[0].finish;
                        undueArray.plan = res[0].plan;
                    }else if(res[0].eff >= 1){
                        undueArray.eff = 100;
                        undueArray.finish = res[0].finish;
                        undueArray.plan = res[0].plan;
                    }else{
                        undueArray.eff = parseFloat(res[0].eff) * 100;
                        undueArray.finish = res[0].finish;
                        undueArray.plan = res[0].plan;
                    }
                }
                this.outputMineData.day = undueArray; 
            })
            //获取采区当前月产量
            HttpReq.truckDispatching.apiPlanMonthQuery().then((res) => {
                let undueArray = {};
                if(res.length == 0 || JSON.stringify(res[0]) == '{}'){
                    undueArray.eff = 0;
                    undueArray.finish = 0;
                    undueArray.plan = 0;
                }else{
                    if(res[0].eff == ''){
                        undueArray.eff = 0;
                        undueArray.finish = res[0].finish;
                        undueArray.plan = res[0].plan;
                    }else if(res[0].eff >= 1){
                        undueArray.eff = 100;
                        undueArray.finish = res[0].finish;
                        undueArray.plan = res[0].plan;
                    }else{
                        undueArray.eff = parseFloat(res[0].eff) * 100;
                        undueArray.finish = res[0].finish;
                        undueArray.plan = res[0].plan;
                    }
                }
                this.outputMineData.month = undueArray;
            })
            //获取采区当前年产量
            HttpReq.truckDispatching.apiPlanYearQuery().then((res) => {
                let undueArray = {};
                if(res.length == 0 || JSON.stringify(res[0]) == '{}'){
                    undueArray.eff = 0;
                    undueArray.finish = 0;
                    undueArray.plan = 0;
                }else{
                    if(res[0].eff == ''){
                        undueArray.eff = 0;
                        undueArray.finish = res[0].finish;
                        undueArray.plan = res[0].plan;
                    }else if(res[0].eff >= 1){
                        undueArray.eff = 100;
                        undueArray.finish = res[0].finish;
                        undueArray.plan = res[0].plan;
                    }else{
                        undueArray.eff = parseFloat(res[0].eff) * 100;
                        undueArray.finish = res[0].finish;
                        undueArray.plan = res[0].plan;
                    }
                }
                this.outputMineData.year = undueArray;
            })

            this.DPcomputer1BoxTimer = setInterval(()=>{
                //获取采区当前日产量
                HttpReq.truckDispatching.apiPlanDayQuery().then((res) => {
                    let undueArray = {};
                    if(res.length == 0 || JSON.stringify(res[0]) == '{}'){
                        undueArray.eff = 0;
                        undueArray.finish = 0;
                        undueArray.plan = 0;
                    }else{
                        if(res[0].eff == ''){
                            undueArray.eff = 0;
                            undueArray.finish = res[0].finish;
                            undueArray.plan = res[0].plan;
                        }else if(res[0].eff >= 1){
                            undueArray.eff = 100;
                            undueArray.finish = res[0].finish;
                            undueArray.plan = res[0].plan;
                        }else{
                            undueArray.eff = parseFloat(res[0].eff) * 100;
                            undueArray.finish = res[0].finish;
                            undueArray.plan = res[0].plan;
                        }
                    }
                    this.outputMineData.day = undueArray; 
                })
                //获取采区当前月产量
                HttpReq.truckDispatching.apiPlanMonthQuery().then((res) => {
                    let undueArray = {};
                    if(res.length == 0 || JSON.stringify(res[0]) == '{}'){
                        undueArray.eff = 0;
                        undueArray.finish = 0;
                        undueArray.plan = 0;
                    }else{
                        if(res[0].eff == ''){
                            undueArray.eff = 0;
                            undueArray.finish = res[0].finish;
                            undueArray.plan = res[0].plan;
                        }else if(res[0].eff >= 1){
                            undueArray.eff = 100;
                            undueArray.finish = res[0].finish;
                            undueArray.plan = res[0].plan;
                        }else{
                            undueArray.eff = parseFloat(res[0].eff) * 100;
                            undueArray.finish = res[0].finish;
                            undueArray.plan = res[0].plan;
                        }
                    }
                    this.outputMineData.month = undueArray;
                })
                //获取采区当前年产量
                HttpReq.truckDispatching.apiPlanYearQuery().then((res) => {
                    let undueArray = {};
                    if(res.length == 0 || JSON.stringify(res[0]) == '{}'){
                        undueArray.eff = 0;
                        undueArray.finish = 0;
                        undueArray.plan = 0;
                    }else{
                        if(res[0].eff == ''){
                            undueArray.eff = 0;
                            undueArray.finish = res[0].finish;
                            undueArray.plan = res[0].plan;
                        }else if(res[0].eff >= 1){
                            undueArray.eff = 100;
                            undueArray.finish = res[0].finish;
                            undueArray.plan = res[0].plan;
                        }else{
                            undueArray.eff = parseFloat(res[0].eff) * 100;
                            undueArray.finish = res[0].finish;
                            undueArray.plan = res[0].plan;
                        }
                    }
                    this.outputMineData.year = undueArray;
                })

            },60000)

        }
    },
    beforeDestroy(){
        if(this.DPcomputer1BoxTimer) {
			clearInterval(this.DPcomputer1BoxTimer);
            this.DPcomputer1BoxTimer = null;
		}
    }
}
</script>

<style scoped>
*{
  margin: 0;
  padding: 0;
}
.DPcomputer1Box{
    width: 20vw;
    height: 23.5vh;
    background-color: rgba(32,42,67,0.95);
    padding: 5px 7px;
    box-sizing: border-box;
    overflow: hidden;
}
.DPcomputer1Box .dataScrView_leftView_title{
    margin-bottom: 5px;
    width: 100%;
    height: 3.5vh;
    background:no-repeat center center url('~@/assets/images/cutGraph/biaoti1.png');
	background-size:100% 100%;
    padding-left: 10px;
    box-sizing: border-box;
    font-size: 18px;
    line-height: 3.5vh;
    color: #FAFAFB;
    letter-spacing: 1px;
    text-shadow: 1px 1px 1px #92CBFF;
}
.DPcomputer1Box .dataScrView_leftView_content{
    width: 100%;
    height: 19vh;
}
.DPcomputer1Box .dataScrView_leftView_content_view1{
    margin-bottom: 7px;
    display: flex;
    align-items: center;
    font-size: 20px;
}
.DPcomputer1Box .dataScrView_leftView_content_view1_son1{
    width: 5.5vh;
    height: 5.5vh;
    background:no-repeat center center url('~@/assets/images/cutGraph/bilikuang.png');
	background-size:100% 100%;
    line-height: 5.5vh;
    text-align: center;
    color: white;
    font-size: 16px;
}
.DPcomputer1Box .outside-div1{
    width: 15vw;
    height: 20px;
    border: 1px solid #91A9FF;
    display: flex;
    align-items: center;
}
.DPcomputer1Box .inside-div1{
    margin-left: 0.13vw;
    width: 9%;
    height: 12px;
    background-color: #02EEF7;
}
</style>