<template>
    <div class="container2">
        <div class="title">
            <img :src="u918" alt="">
            <span>噪音监测</span>
        </div>
        <div class="content">
            <div class="public-box">
                <svg t="1737006052368" class="icon" viewBox="0 0 1024 1024" version="1.1"
                    xmlns="http://www.w3.org/2000/svg" p-id="1941" width="48" height="48">
                    <path
                        d="M704 672a32 32 0 0 1-32-32v-256a32 32 0 0 1 64 0v256a32 32 0 0 1-32 32z m96-64a32 32 0 0 1-32-32v-128a32 32 0 0 1 64 0v128a32 32 0 0 1-32 32z m-480 96a32 32 0 0 1-32-32V352a32 32 0 1 1 64 0v320a32 32 0 0 1-32 32z m96 128a32 32 0 0 1-32-32V224a32 32 0 1 1 64 0v576a32 32 0 0 1-32 32z m96-128a32 32 0 0 1-32-32V352a32 32 0 1 1 64 0v320a32 32 0 0 1-32 32z m96-96a32 32 0 0 1-32-32v-128a32 32 0 0 1 64 0v128a32 32 0 0 1-32 32zM224 608a32 32 0 0 1-32-32v-128a32 32 0 1 1 64 0v128a32 32 0 0 1-32 32z"
                        fill="#2affff" p-id="1942"></path>
                </svg>
                <div class="text-label">
                    <div class="label-left">{{ prop.public_list.name }}</div>
                    <div class="label-right"><i class="value" :style="{ color: checkCb(prop.public_list) }">{{
                            prop.public_list.data }}</i> dB</div>
                </div>
            </div>
            <Progress v-for="item in prop.office_list" :mdoelValue1="item" />
        </div>
    </div>
</template>

<script setup>
import { ref, computed, watch } from 'vue';
import u918 from './../image/u918.png';
import Progress from './Progress.vue';
const prop = defineProps({
    public_list: {
        type: Array,
        default: () => {
            return {
                "devId": "48a2ec70-a60c-11ef-91f3-abd609c7e488",
                "name": "公共区域1",
                "label": "noise-7",
                "place": null,
                "data": 0,
                "status": 0
            }
        }
    },
    office_list: {
        type: Array,
        default: () => {
            return [
                {
                    "devId": "48a2ec70-a60c-11ef-91f3-abd609c7e488",
                    "name": "办公区2",
                    "label": "noise-7",
                    "place": null,
                    "data": 0,
                    "status": 0
                }]
        }
    },
});

//检测是否超标
function checkCb(item) {
    if (item.data > 85) {
        return '#FF0000'
    } else {
        return '#2affff'
    }
}

</script>

<style lang="scss" scoped>
.container2 {
    width: 385px;
    height: 310px;

    .title {
        width: 385px;
        height: 35px;
        display: flex;
        justify-content: flex-start;
        align-items: center;

        span {
            font-size: 20px;
            color: #2affff;
            font-weight: 700;
            margin-left: 10px;
        }
    }

    .content {
        width: 100%;
        height: 275px;

        .public-box {
            width: 100%;
            height: 30px;
            display: flex;
            justify-content: center;
            align-items: center;

            .text-label {
                width: 50%;
                height: 100%;
                display: flex;
                justify-content: space-around;
                align-items: center;
                font-size: 16px;
                color: #fff;
                box-sizing: border-box;

                .label-right {
                    color: #2affff;

                    .value {
                        //color: #fff;
                    }
                }
            }
        }
    }
}
</style>
