<!-- SidePanelItem.vue -->
<template>
    <div>
        <SidePanelItem title="环保设施情况">
            <div class="facility-grid">
                <div v-for="facility in facilities" :key="facility.name" class="facility-card">
                    <div class="facility-icon">
                        <component :is="facility.icon" />
                    </div>
                    <div class="facility-info">
                        <div class="facility-name">{{ facility.name }}</div>
                        <div> <span class="facility-count">{{ facility.count }}</span> 个</div>
                    </div>
                </div>
            </div>
        </SidePanelItem>
    </div>
</template>

<script lang="ts" setup>
import { ref, onMounted } from 'vue';
import SidePanelItem from '@/components/SidePanelItem/index.vue';
import {
    // DropletOutlined, 
    // ThermometerOutlined, 
    HomeOutlined,
    FileTextOutlined,
    // FishOutlined, 
    EnvironmentOutlined,
    HeartOutlined
} from '@ant-design/icons-vue';

// 定义组件名（便于调试和递归）
defineOptions({
    name: 'huanbaoMod'
});

// 设施数据
const facilities = ref([
    {
        name: '生态流量泄放设施',
        count: 145,
        // icon: DropletOutlined
    },
    {
        name: '低温水减缓设施',
        count: 24,
        // icon: ThermometerOutlined
    },
    {
        name: '栖息地',
        count: 142,
        icon: HomeOutlined
    },
    {
        name: '过鱼设施',
        count: 60,
        icon: FileTextOutlined
    },
    {
        name: '鱼类增殖站',
        count: 69,
        // icon: FishOutlined
    },
    {
        name: '珍稀植物园',
        count: 41,
        icon: EnvironmentOutlined
    },
    {
        name: '动物救助站',
        count: 4,
        icon: HeartOutlined
    }
]);

// 页面加载时执行的逻辑
onMounted(() => {

});
</script>

<style lang="scss" scoped>
.facility-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica Neue, Arial, Noto Sans, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol, Noto Color Emoji;
}

.facility-card {
    display: flex;
    align-items: center;
    padding: 6px;
    background: #fff;
    border: 1px solid #e8e8e8;
    border-radius: 4px;
    transition: all 0.3s;
    cursor: pointer;
}

.facility-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    margin-right: 8px;
    background: #2f6b98;
    border-radius: 50%;

    .anticon {
        font-size: 24px;
        color: #fff;
    }
}

.facility-info {
    flex: 1;
}

.facility-name {
    font-size: 16px;
    color: #333;
    margin-bottom: 4px;
    // font-weight: 500;
}

.facility-count {
    font-size: 18px;
    color: #2f6b98;
    font-weight: 600;
}
</style>