<template>
    <div class="items">
        <div class="item" v-for="(item, index) in data" :key="index" ref="item">
            <div class="title">{{ item.type_name }}</div>
            <div
                class="progress"
                :style="{ width: Math.round(Number(item.job_num) / (Number(maxNum) / progressWidth)) + 'px' }"
            />
            <div>{{ item.job_num }}</div>
        </div>
    </div>
</template>

<script>
export default {
    props: {
        data: {
            type: Array,
            require: true,
        },
        maxNum: {
            type: Number,
            require: true,
        }
    },
    data() {
        return {
            progressWidth: 250,
        }
    },
}
</script>

<style lang="scss" scoped>
.items {
    height: 180px;
    overflow: auto;
}
.item {
    margin-bottom: 25px;
    display: flex;
    align-items: center;
    font-size: 13px;
}

.anim {
    transition: all 0.8s;
}

.progress {
    margin: 0 10px;
    height: 12px;
    background: #4086ff;
    border-radius: 5px;
}
.title {
    width: 23%;
    color: #4e5969;
    text-align: right;
}
</style>
