blowingIn.vue 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. <template>
  2. <div class="_running">
  3. <HeadlineTag type="right" value="网关统计"></HeadlineTag>
  4. <div class="_running_mains">
  5. <div class="_running_mains_left" id="videoWidth" :style="{ '--heightRun': heightVideo + 'px' }">
  6. <div class="_running_mains_left_tuan"></div>
  7. <div class="_running_mains_left_conter">
  8. <div class="_running_mains_left_conter_num">{{ resultData.GatewayCount || 0 }}</div>
  9. <div class="_running_mains_left_conter_text">网关总量</div>
  10. </div>
  11. </div>
  12. <div class="_running_mains_right">
  13. <div class="_running_mains_right_item" v-for="item, index in runningList" :key="index">
  14. <div class="_running_mains_right_item_tuan">
  15. <span class="_running_mains_right_item_tuan_flag"
  16. :style="{ backgroundColor: item.color }"></span>
  17. <el-text class="w-150px mb-2" truncated style="color: #ccc;">
  18. {{ item.name }}
  19. </el-text>
  20. </div>
  21. <div class="_running_mains_right_item__txt">
  22. <span>{{ item.state || 0 }}</span>
  23. <span :style="{ color: item.color, 'font-size': '12px', 'margin-left': '5px' }">
  24. {{ item.unit }}
  25. </span>
  26. </div>
  27. </div>
  28. </div>
  29. </div>
  30. </div>
  31. </template>
  32. <script setup>
  33. import { ref } from "vue";
  34. import HeadlineTag from '@/components/HeadlineTag'
  35. const props = defineProps({
  36. resultData: {
  37. type: Object,
  38. default: {}
  39. }
  40. })
  41. const runningList = ref([
  42. { name: '在线', state: 0, color: '#409eff', unit: '台' },
  43. { name: '离线', state: 0, color: '#15acaa', unit: '台' },
  44. ])
  45. watch(() => props.resultData, (newVal) => {
  46. if (newVal) {
  47. runningList.value[0].state = newVal.GatewayOnline
  48. runningList.value[1].state = newVal.GatewayOffline
  49. }
  50. }, { deep: true, immediate: true } // 开启深度监听
  51. )
  52. const heightVideo = ref(0)
  53. // 生命周期
  54. onMounted(() => {
  55. var element = document.getElementById("videoWidth");
  56. var width = element.offsetWidth;
  57. heightVideo.value = width
  58. });
  59. </script>
  60. <style lang="scss" scoped>
  61. ._running {
  62. display: flex;
  63. flex-direction: column;
  64. &_mains {
  65. flex: 1;
  66. margin: 30px;
  67. display: flex;
  68. align-items: center;
  69. &_left {
  70. width: 50%;
  71. height: var(--heightRun);
  72. position: relative;
  73. &_tuan {
  74. width: 100%;
  75. height: 100%;
  76. background: url("@/assets/images/content_circle.png");
  77. background-size: 100% 100%;
  78. background-position: center;
  79. background-repeat: no-repeat;
  80. animation: scanning 4s linear infinite;
  81. }
  82. &_conter {
  83. position: absolute;
  84. left: 0;
  85. top: 0;
  86. flex-shrink: 0;
  87. width: 100%;
  88. height: 100%;
  89. display: flex;
  90. flex-direction: column;
  91. align-items: center;
  92. justify-content: center;
  93. color: #fff;
  94. &_num {
  95. font-size: 20px;
  96. }
  97. &_text {
  98. font-size: 15px;
  99. }
  100. }
  101. }
  102. &_right {
  103. margin-left: 10px;
  104. flex: 1;
  105. color: #fff;
  106. &_item {
  107. display: flex;
  108. align-items: center;
  109. gap: 40px;
  110. padding: 5px 0;
  111. &_tuan {
  112. display: flex;
  113. align-items: center;
  114. &_flag {
  115. display: block;
  116. width: 7px;
  117. height: 7px;
  118. border-radius: 50%;
  119. margin-right: 10px;
  120. }
  121. }
  122. &__txt {
  123. font-size: 24px;
  124. }
  125. }
  126. }
  127. }
  128. }
  129. @keyframes scanning {
  130. to {
  131. transform: rotate(1turn);
  132. }
  133. }
  134. </style>