<template>
    <div class="box">
        <div class="chart-header">
            <TitleComponent title="审批" :font-level="2" />
            <span>更多</span>
        </div>
        <div class="approval-content">
            <div 
                v-for="(item, index) in approvalData" 
                :key="index" 
                class="approval-item"
            >
                <div class="approval-left">
                    <div class="approval-icon">
                        <img :src="item.iconPath" :alt="item.type">
                    </div>
                    <div class="approval-info">
                        <div class="info">
                            <div class="type">{{ item.type }}</div>
                            <div class="day">{{ item.days }}天</div>
                        </div>
                        <div class="info1">
                            <div class="time">
                                <img src="@/assets/demo/time.png" alt="时间">
                                <span>{{ item.timeRange }}</span>
                            </div>
                            <div class="people">
                                <img src="@/assets/demo/people.png" alt="人员">
                                <span>{{ item.people }}</span>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="approval-tag">
                    <el-tag :type="item.statusType">{{ item.status }}</el-tag>
                </div>
            </div>
        </div>
    </div>
</template>
<script setup>
import TitleComponent from '@/components/TitleComponent/index.vue';

// 接收从父组件传入的数据
const props = defineProps({
  approvalData: {
    type: Array,
    default: () => []
  }
});
</script>
<style scoped lang="scss">
.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.chart-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 500;
    color: #333;
}

.chart-header span {
    color: #186DF5;
    font-size: 14px;
    cursor: pointer;
}

.approval-content {
background-color: white;
    .approval-item {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 12px 16px;
        background: #F2F8FC;
        border-radius: 8px;
        margin-bottom: 12px;
        border: 1px solid #F2F3F5;
        transition: all 0.3s ease;
    }

    .approval-item:hover {
        border-color: #E4E6EB;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    }

    .approval-left {
        display: flex;
        align-items: center;
        flex: 1;
    }

    .approval-icon {
        width: 48px;
        height: 48px;
        border-radius: 4px;
        display: flex;
        align-items: center;
        justify-content: center;
        margin-right: 16px;
        position: relative;
        overflow: hidden;
        background: #186DF5;
    }

    .approval-icon img {
        width: 26px;
        height: 26px;
    }

    .approval-info {
        flex: 1;
        display: flex;
        flex-direction: column;
        gap: 8px;
    }

    .info {
        display: flex;
        justify-content: space-between;
        align-items: center;
        width: 90px;
    }

    .info .type {
        font-size: 14px;
        font-weight: 500;
        color: #333;
    }

    .info .day {
        font-size: 14px;
        color: #666;
    }

    .info1 {
        display: flex;
        align-items: center;
        gap: 16px;
    }

    .info1 .time,
    .info1 .people {
        display: flex;
        align-items: center;
        font-size: 12px;
        color: rgba(113, 128, 150, 1);
    }

    .info1 img {
        width: 12px;
        height: 12px;
        margin-right: 4px;
    }

    .approval-tag {
        margin-left: 16px;
    }

    .approval-tag .el-tag {
        padding: 4px 12px;
        font-size: 12px;
        border-radius: 4px;
    }
}
</style>