<template>
    <div class="dev-card">
        <div class="dev-left">
            <slot></slot>
        </div>
        <div class="dev-right">
            <div class="dev-box">
                <div class="dev-content dev-title">
                    <div class="key" v-for="item in dev_title">{{ item }}</div>
                </div>
                <div class="dev-content" v-for="(items, index) in (dev_value as any)">
                    <div v-for="(item,index) in items" :class="{status:index == (items.length - 1)}" 
                    :style="{background:index == (items.length - 1)?status_color[item]:''}"
                    >{{ index == (items.length - 1)?'':item}}</div>
                </div>
            </div>
        </div>
    </div>
</template>

<script setup lang='ts'>
import { defineProps, ref } from 'vue'
const prop = defineProps({
    dev_title: {
        type: Array,
        default: ['机架号', '状态', '布料层数', '裁片数量']
    },
    dev_value: {
        type: Array,
        default: [
            [102014422, '待机', '40层', '0']
        ]
    },
})
const status_color = {
    '0':'#FF6E76',
    '1':'#FDDD60',
    '2':'#7CFFB2',
    '3':'#FDDD60',
}
</script>

<style scoped>
.dev-card {
    width: 100%;
    height: 100%;
    box-sizing: border-box;
    display: flex;
    flex-direction: row;
}

.dev-left,
.dev-right {
    width: 50%;
    height: 100%;
    box-sizing: border-box;
}
.dev-right {
    width: 60%;
}

.dev-right {
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    align-items: center;
}

.dev-title {
    color: #FFF;
}

.dev-box {
    height: 100%;
    width: 100%;
    font-size: 16px;
    display: flex;
    justify-content: end;
    align-items: center;
}

.dev-content {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    align-items: center;
    font-weight: bold;
}

.key {
    width: 75px;
    height: 35px;
    line-height: 35px;
    text-align: center;
    font-size: 18px;
    font-weight: 700;
    color: #02C1D7;
    /* background: url(@/assets/img/title_bg.svg) no-repeat center center / 100% 100%; */
}

.status {
    width:24px;
    height:24px;
    border-radius: 50%;
}
</style>
