<template>
    <div class="module">
        <ModuleCard1 title="信访管理类人员">
            <PolarHalf id="polarHalf" w="500" :data="polarHalfChart.data" :unit="polarHalfChart.unit" title="" :key="keyCount" @click="onClick"/>
        </ModuleCard1>
    </div>
</template>

<script setup>
import { ref, reactive, inject, defineEmits } from 'vue';
import ModuleCard1 from './card/ModuleCard1.vue';
import PolarHalf from '../components/echarts/PolarHalf.vue';

const emits = defineEmits(['click']);

const axios = inject('axios');

const onClick = (params) => {
    emits('click', {
        type: 'xinfang',
        name: params.name
    });
}

const keyCount = ref(0);

const polarHalfChart = reactive({
    unit: '人',
    data: []
});
axios.get('app/query/sqlrelease/qfe27ad0', {}).then(res => {
    let data = res.data;
    data.forEach((item, value) => {
        polarHalfChart.data.push({
            name: item.name,
            value: item.value
        })
    });
    keyCount.value++;
}).catch(err => {
    console.error(err);
});
</script>

<style lang="stylus" scoped>

</style>