| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151 |
- <template>
- <div class="_running">
- <HeadlineTag type="right" value="网关统计"></HeadlineTag>
- <div class="_running_mains">
- <div class="_running_mains_left" id="videoWidth" :style="{ '--heightRun': heightVideo + 'px' }">
- <div class="_running_mains_left_tuan"></div>
- <div class="_running_mains_left_conter">
- <div class="_running_mains_left_conter_num">{{ resultData.GatewayCount || 0 }}</div>
- <div class="_running_mains_left_conter_text">网关总量</div>
- </div>
- </div>
- <div class="_running_mains_right">
- <div class="_running_mains_right_item" v-for="item, index in runningList" :key="index">
- <div class="_running_mains_right_item_tuan">
- <span class="_running_mains_right_item_tuan_flag"
- :style="{ backgroundColor: item.color }"></span>
- <el-text class="w-150px mb-2" truncated style="color: #ccc;">
- {{ item.name }}
- </el-text>
- </div>
- <div class="_running_mains_right_item__txt">
- <span>{{ item.state || 0 }}</span>
- <span :style="{ color: item.color, 'font-size': '12px', 'margin-left': '5px' }">
- {{ item.unit }}
- </span>
- </div>
- </div>
- </div>
- </div>
- </div>
- </template>
- <script setup>
- import { ref } from "vue";
- import HeadlineTag from '@/components/HeadlineTag'
- const props = defineProps({
- resultData: {
- type: Object,
- default: {}
- }
- })
- const runningList = ref([
- { name: '在线', state: 0, color: '#409eff', unit: '台' },
- { name: '离线', state: 0, color: '#15acaa', unit: '台' },
- ])
- watch(() => props.resultData, (newVal) => {
- if (newVal) {
- runningList.value[0].state = newVal.GatewayOnline
- runningList.value[1].state = newVal.GatewayOffline
- }
- }, { deep: true, immediate: true } // 开启深度监听
- )
- const heightVideo = ref(0)
- // 生命周期
- onMounted(() => {
- var element = document.getElementById("videoWidth");
- var width = element.offsetWidth;
- heightVideo.value = width
- });
- </script>
- <style lang="scss" scoped>
- ._running {
- display: flex;
- flex-direction: column;
- &_mains {
- flex: 1;
- margin: 30px;
- display: flex;
- align-items: center;
- &_left {
- width: 50%;
- height: var(--heightRun);
- position: relative;
- &_tuan {
- width: 100%;
- height: 100%;
- background: url("@/assets/images/content_circle.png");
- background-size: 100% 100%;
- background-position: center;
- background-repeat: no-repeat;
- animation: scanning 4s linear infinite;
- }
- &_conter {
- position: absolute;
- left: 0;
- top: 0;
- flex-shrink: 0;
- width: 100%;
- height: 100%;
- display: flex;
- flex-direction: column;
- align-items: center;
- justify-content: center;
- color: #fff;
- &_num {
- font-size: 20px;
- }
- &_text {
- font-size: 15px;
- }
- }
- }
- &_right {
- margin-left: 10px;
- flex: 1;
- color: #fff;
- &_item {
- display: flex;
- align-items: center;
- gap: 40px;
- padding: 5px 0;
- &_tuan {
- display: flex;
- align-items: center;
- &_flag {
- display: block;
- width: 7px;
- height: 7px;
- border-radius: 50%;
- margin-right: 10px;
- }
- }
- &__txt {
- font-size: 24px;
- }
- }
- }
- }
- }
- @keyframes scanning {
- to {
- transform: rotate(1turn);
- }
- }
- </style>
|