<template>
    <div class="module">
        <ModuleCard2 title="政治面貌统计">
            <Pie3d id="pie3d" w="400" h="200" :data="pie3dData" :key="keyCount" @click="onClick"/>
        </ModuleCard2>
    </div>
</template>

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

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

const axios = inject('axios');
const keyCount = ref(0);
const pie3dData = reactive([]);

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

axios.get(`app/query/sqlrelease/qe41cc66`, {}).then(res => {
    let data = res.data;
    data.forEach(item => {
        pie3dData.push(item)
    })
    keyCount.value++;
}).catch(err => {
    console.error(err);
})

</script>

<style lang="stylus" scoped>
// .module
//     .pie-3d
//         background-image url(/assets/imgs/card/bg9.png)
</style>