
<template>
    <div class="box">
        <div class="top-box">
            <div class="topbox-item">
                <div class="topBOxitem">
                    <div class="topBOxitem-top"> <span>12222222222</span> </div>
                    <div class="topBOxitem-bottom">召回次数</div>
                </div>
            </div>
            <div class="topbox-item">
                <div class="topBOxitem">
                    <div class="topBOxitem-top"> <span>12</span></div>
                    <div class="topBOxitem-bottom">产品召回批数</div>
                </div>
            </div>
            <div class="topbox-item">
                <div class="topBOxitem">
                    <div class="topBOxitem-top"> <span>100%</span> </div>
                    <div class="topBOxitem-bottom">产品召回次数</div>
                </div>
            </div>
        </div>
        <div class="bottom-content">
            <div class="right-echart" ref="right-echart"></div>
        </div>
    </div>
</template>

<script>
import * as echarts from "echarts";

export default {
    name: 'informationBox',
    components: {},
    data() {
        return {
            topList: [
                {
                    order: "12",
                    jcaddress: "国家检测次数"
                },
                {
                    order: "31",
                    jcaddress: "省级检测次数"
                },
                {
                    order: "14",
                    jcaddress: "抽检合格率"
                },
            ],



            option2: {},
            // echarts
            myChart2: {},
        }
    },
    created() { },
    mounted() {
        this.$nextTick(() => {


            let chartDom2 = this.$refs["right-echart"];
            this.myChart2 = echarts.init(chartDom2);
            this.initEcharts2();

        });
    },
    methods: {

        initEcharts2() {
            this.option2 = {
                backgroundColor: "rgba(0,0,0,0)", // 设置为透明背景
                tooltip: {},
                grid: {
                    top: '8%',
                    left: '0%',
                    right: '5%',
                    bottom: '0%',
                    containLabel: true,
                },
                xAxis: [{
                    type: 'category',
                    boundaryGap: true,

                    axisLine: {
                        show: false, // 隐藏 x 轴线
                        lineStyle: {
                            color: '#233e64'
                        },
                    },
                    axisLabel: {
                        textStyle: {
                            color: "#B7D4F5",
                            fontSize: 12,
                            margin: 0,
                        },
                    },
                    axisTick: {
                        show: false,
                    },
                    data: ['一级召回', '二级召回', '三级召回'],
                }],
                yAxis: [{
                    show: true,
                    type: 'value',
                    name: '123',
                    splitLine: {
                        show: true, // 显示背后的横线
                        lineStyle: {
                            color: '#233e64',
                            type: 'dashed' // 可以设置为实线或虚线
                        }
                    },
                    axisLine: {
                        show: false, // 隐藏 y 轴线
                    },
                    axisLabel: {
                        margin: 20,
                        textStyle: {
                            color: '#6a9cd5',
                        },
                    },
                    axisTick: {
                        show: false,
                    },
                }],
                series: [{
                    type: 'bar',
                    barWidth: '30',
                    itemStyle: {
                        normal: {
                            color: {
                                type: 'linear',
                                x: 0,
                                y: 0,
                                x2: 0,
                                y2: 1,
                                colorStops: [{
                                    offset: 0,
                                    color: 'rgba(33,181,225,1)' // 起始颜色
                                }, {
                                    offset: 1,
                                    color: 'rgba(0,0,0,0.1)' // 结束颜色
                                }]
                            },
                            // label: {
                            //     show: true,
                            //     position: 'top'
                            // }
                        }
                    },
                    data: [12, 15, 17]
                }]
            };
            this.myChart2.setOption(this.option2);
        },
    },
    computed: {}
}
</script>
<style scoped lang='scss'>
.box {}

.top-box {
    margin: 10px 0;
    height: 85px;
    width: 100%;
    display: flex;
    justify-content: space-between;

    .topbox-item {
        width: 240px;
        display: flex;
        justify-content: space-between;
        align-items: center;


        &:nth-of-type(1) {
            background: url('../../../assets/images/daping/zhaohuicishu.png');
            background-size: 100% 100%;
            background-repeat: no-repeat;
            background-position: center;



            .topBOxitem-top {
                :nth-of-type(1) {
                    background: linear-gradient(0deg, #BF6E35 0%, #FFFFFF 100%);
                }
            }

        }

        &:nth-of-type(2) {
            background: url('../../../assets/images/daping/zhaohuicishu.png');
            background-size: 100% 100%;

            background-repeat: no-repeat;

            .topBOxitem-top {
                :nth-of-type(1) {
                    background: linear-gradient(0deg, #FFFFFF 0%, #0373E0 100%);
                }
            }

        }

        &:nth-of-type(3) {
            background: url('../../../assets/images/daping/zhaohuicishu.png');
            background-size: 100% 100%;

            background-repeat: no-repeat;

            .topBOxitem-top {
                :nth-of-type(1) {
                    background: linear-gradient(0deg, #FFFFFF 0%, #37BEA6 100%);
                }
            }
        }

        .topBOxitem {
            overflow: hidden;

            width: 100%;
            height: 100%;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;

            .topBOxitem-top {
                :nth-of-type(1) {
                    display: block;
                    max-width: 130px;
                    white-space: nowrap;
                    /* 不换行 */
                    overflow: hidden;
                    /* 溢出内容隐藏 */
                    text-overflow: ellipsis;
                    font-size: 34px;
                    font-family: YouSheBiaoTiHei;
                    font-weight: 400;
                    color: #FFFFFF;
                    -webkit-background-clip: text;
                    -webkit-text-fill-color: transparent;
                    margin: 0;
                }
            }

            .topBOxitem-bottom {
                font-size: 12px;
                font-family: Alibaba PuHuiTi;
                font-weight: 400;
                color: #FFFFFF;
            }

        }

    }

}

.bottom-content {
    height: 210px;
    display: flex;

    .right-echart {
        flex: 1.3;
    }


}
</style>
