earlyWarning.vue 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  1. <template>
  2. <div class="person_box">
  3. <!-- <div class="left_warning center_in">
  4. <div class="warning_card center_in">
  5. <svg class="warning_icon_star" aria-hidden="true">
  6. <defs>
  7. <linearGradient id="myGradient" x1="0%" y1="100%" x2="0%" y2="0%">
  8. <stop offset="0%" stop-color="rgb(20, 188, 244)" />
  9. <stop offset="100%" stop-color="#ffffff" />
  10. </linearGradient>
  11. </defs>
  12. <use xlink:href="#icon-user" fill="url('#myGradient')" />
  13. </svg>
  14. </div>
  15. </div> -->
  16. <div class="right_warning">
  17. <div class="box_equipment">
  18. <span class="equi_title">客流监控设备</span>
  19. <span class="equi_num">{{ networkDevices }}</span>
  20. </div>
  21. <div class="box_early_warn">
  22. <div class="space_between_in card_eary">
  23. <div class="type_title_early">正常</div>
  24. <div class="type_num_early">{{ resultData.Normal }}个</div>
  25. </div>
  26. <el-progress :percentage="getPercentage(resultData.Normal)" :text-inside="true"
  27. color="rgb(100, 178, 161)" />
  28. </div>
  29. <div class="box_early_warn">
  30. <div class="space_between_in card_eary">
  31. <div class="type_title_early">故障</div>
  32. <div class="type_num_early">{{ resultData.Fault }}个</div>
  33. </div>
  34. <el-progress :percentage="getPercentage(resultData.Fault)" :text-inside="true"
  35. color="rgb(230, 162, 60)" />
  36. </div>
  37. <div class="box_early_warn">
  38. <div class="space_between_in card_eary">
  39. <div class="type_title_early">离线</div>
  40. <div class="type_num_early">{{ resultData.Offline }}个</div>
  41. </div>
  42. <el-progress :percentage="getPercentage(resultData.Offline)" :text-inside="true"
  43. color="rgb(245, 108, 108)" />
  44. </div>
  45. </div>
  46. </div>
  47. </template>
  48. <script setup>
  49. const props = defineProps({
  50. resultData: {
  51. type: Object,
  52. default: {}
  53. }
  54. })
  55. const networkDevices = ref(0)
  56. watch(() => props.resultData, (newVal) => {
  57. if (newVal) {
  58. networkDevices.value = newVal.Normal + newVal.Fault + newVal.Offline
  59. }
  60. }, { deep: true, immediate: true } // 开启深度监听
  61. )
  62. function getPercentage(params) {
  63. let num = params / networkDevices.value * 100
  64. return Math.floor(num)
  65. }
  66. // 生命周期
  67. onMounted(() => {
  68. });
  69. </script>
  70. <style scoped lang="scss">
  71. .person_box {
  72. width: 100%;
  73. height: 100%;
  74. display: flex;
  75. align-items: center;
  76. padding-left: 20px;
  77. }
  78. .left_warning {
  79. width: 100px;
  80. }
  81. .right_warning {
  82. display: flex;
  83. flex-direction: column;
  84. justify-content: space-evenly;
  85. flex: 1;
  86. height: 100%;
  87. // padding-left: 20px;
  88. padding-right: 20px;
  89. }
  90. .box_equipment {
  91. display: flex;
  92. align-items: center;
  93. justify-content: center;
  94. border-radius: 20px;
  95. width: 100%;
  96. height: 40px;
  97. border: 1px solid rgb(48 69 129);
  98. }
  99. .box_early_warn {
  100. margin-top: 10px;
  101. margin-bottom: 20px;
  102. }
  103. .equi_title {
  104. font-size: 18px;
  105. font-weight: bold;
  106. line-height: 30px;
  107. font-weight: bold;
  108. background-image: -webkit-linear-gradient(bottom, rgb(143, 190, 224), rgb(245 245 245));
  109. -webkit-background-clip: text;
  110. -webkit-text-fill-color: transparent;
  111. }
  112. .equi_num {
  113. font-size: 18px;
  114. color: #fff;
  115. margin-left: 20px;
  116. line-height: 30px;
  117. }
  118. .card_eary {
  119. margin-bottom: 8px;
  120. }
  121. .type_title_early {
  122. font-size: 16px;
  123. font-weight: bold;
  124. background-image: -webkit-linear-gradient(bottom, rgb(143, 190, 224), rgb(245 245 245));
  125. -webkit-background-clip: text;
  126. -webkit-text-fill-color: transparent;
  127. }
  128. .type_num_early {
  129. font-size: 16px;
  130. }
  131. .warning_card {
  132. width: 90px;
  133. height: 90px;
  134. border-radius: 50%;
  135. background-color: rgb(9, 29, 56);
  136. box-shadow: inset 0px 0px 20px 3px rgb(14 67 117);
  137. border: 1px solid rgb(135, 152, 189);
  138. }
  139. .warning_icon_star {
  140. width: 40px;
  141. height: 40px;
  142. }
  143. </style>
  144. <style lang="scss" scoped>
  145. :deep(.el-progress__text) {
  146. color: #ffffff !important;
  147. }
  148. :deep(.el-progress-bar__outer) {
  149. overflow: unset !important;
  150. }
  151. :deep(.el-progress-bar__innerText) {
  152. position: absolute;
  153. left: 0;
  154. bottom: -16px;
  155. }
  156. </style>