device-warn.vue 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209
  1. <template>
  2. <div class="deviceWarn">
  3. <div class="title-top" @click="getDetail">预警管控系统</div>
  4. <div class="toggle-search">
  5. <div class="status-yx">
  6. <div class="now-name">
  7. <i style="margin: 0px 5px 0px 5px">
  8. <SvgIcon class="icon" size="14" name="internet-bad" />
  9. </i>
  10. <span style="color: #fff">{{ nowStatus ? '报警信息' : '网络断开' }}</span>
  11. </div>
  12. <div class="now-status">{{ nowStatus ? nowStatus : 0 }}</div>
  13. </div>
  14. </div>
  15. <div class="warn-contents">
  16. <div class="warn-box" v-for="(item, index) in warnList" :key="index">
  17. <div class="warn-icon">
  18. <img :src="item.icon" alt="" />
  19. </div>
  20. <div class="warn-text">
  21. <div class="text-n">
  22. {{ item.name }}
  23. </div>
  24. </div>
  25. <div class="warn-val">
  26. <div class="val-n"> {{ item.val }}</div>
  27. </div>
  28. </div>
  29. </div>
  30. </div>
  31. </template>
  32. <script lang="ts" setup>
  33. import { ref, reactive, defineProps, watch } from 'vue';
  34. import { SvgIcon } from '/@/components/Icon';
  35. import { getAssetURL } from '/@/utils/ui';
  36. let props = defineProps({
  37. warnData: Array,
  38. });
  39. const emit = defineEmits(['goDetail']);
  40. let nowStatus = ref<any>(0);
  41. let warnList = reactive<any[]>([
  42. { name: '报警', icon: getAssetURL('home-container/warning/warn-icon.png'), val: 0 },
  43. { name: '重大风险预警', icon: getAssetURL('home-container/warning/warn-icon.png'), val: 0 },
  44. { name: '较大风险预警', icon: getAssetURL('home-container/warning/warn-icon1.png'), val: 0 },
  45. { name: '一般风险预警', icon: getAssetURL('home-container/warning/warn-icon2.png'), val: 0 },
  46. { name: '低风险预警', icon: getAssetURL('home-container/warning/warn-icon3.png'), val: 0 },
  47. ]);
  48. //跳转详情
  49. function getDetail() {
  50. emit('goDetail', 'warning');
  51. }
  52. watch(
  53. () => props.warnData,
  54. (val) => {
  55. val.forEach((el) => {
  56. nowStatus.value = el.netstatus.val;
  57. warnList[0].val = el.red.val;
  58. warnList[1].val = el.alarm.val;
  59. warnList[2].val = el.orange.val;
  60. warnList[3].val = el.yellow.val;
  61. warnList[4].val = el.blue.val;
  62. });
  63. },
  64. {
  65. deep: true,
  66. }
  67. );
  68. </script>
  69. <style lang="less" scoped>
  70. @font-face {
  71. font-family: 'douyuFont';
  72. src: url('../../../../../assets/font/douyuFont.otf');
  73. }
  74. .deviceWarn {
  75. width: 100%;
  76. height: 100%;
  77. position: relative;
  78. .title-top {
  79. position: absolute;
  80. top: 9px;
  81. left: 46px;
  82. color: #fff;
  83. font-size: 16px;
  84. font-family: 'douyuFont';
  85. cursor: pointer;
  86. &:hover {
  87. color: #66ffff;
  88. }
  89. }
  90. .toggle-search {
  91. position: absolute;
  92. left: 9px;
  93. top: 37px;
  94. display: flex;
  95. .status-yx {
  96. height: 30px;
  97. width: 180px;
  98. background-color: rgba(8, 148, 255, 0.3);
  99. border: 1px solid #1d80da;
  100. display: flex;
  101. justify-content: space-between;
  102. align-items: center;
  103. .now-status {
  104. margin-right: 5px;
  105. padding-top: 3px;
  106. font-family: 'douyuFont';
  107. color: #3df6ff;
  108. }
  109. }
  110. }
  111. .warn-contents {
  112. position: absolute;
  113. top: 66px;
  114. left: 0;
  115. height: calc(100% - 66px);
  116. width: 100%;
  117. padding: 20px 15px;
  118. box-sizing: border-box;
  119. display: flex;
  120. flex-direction: column;
  121. justify-content: space-between;
  122. align-items: center;
  123. .warn-box {
  124. position: relative;
  125. width: 396px;
  126. height: 16px;
  127. display: flex;
  128. background: url('../../../../../assets/images/home-container/warn1.png') no-repeat;
  129. .warn-icon {
  130. position: absolute;
  131. left: 10%;
  132. top: -20px;
  133. width: 44px;
  134. height: 35px;
  135. img {
  136. width: 100%;
  137. height: 100%;
  138. }
  139. }
  140. .warn-text {
  141. width: 168px;
  142. height: 2px;
  143. position: absolute;
  144. left: 22%;
  145. top: -2px;
  146. background: url('../../../../../assets/images/home-container/warn7.png') no-repeat;
  147. background-size: 100% 100%;
  148. .text-n {
  149. position: absolute;
  150. left: 50%;
  151. top: -10px;
  152. transform: translate(-50%, 0);
  153. color: #fff;
  154. }
  155. }
  156. .warn-val {
  157. position: absolute;
  158. left: 66%;
  159. top: -21px;
  160. width: 94px;
  161. height: 45px;
  162. background: url('../../../../../assets/images/home-container/warn8.png') no-repeat;
  163. .val-n {
  164. position: absolute;
  165. left: 50%;
  166. top: 50%;
  167. font-size: 14px;
  168. font-family: 'douyuFont';
  169. transform: translate(-50%, -52%);
  170. }
  171. }
  172. &:nth-child(1) .val-n {
  173. color: red;
  174. }
  175. &:nth-child(2) .val-n {
  176. color: #f93825;
  177. }
  178. &:nth-child(3) .val-n {
  179. color: #ff9b17;
  180. }
  181. &:nth-child(4) .val-n {
  182. color: #ffff00;
  183. }
  184. &:nth-child(5) .val-n {
  185. color: #31dbfd;
  186. }
  187. }
  188. }
  189. }
  190. :deep .zxm-select-selector {
  191. width: 100%;
  192. height: 30px !important;
  193. padding: 0 11px 0px 25px !important;
  194. background-color: rgba(8, 148, 255, 0.3) !important;
  195. border: 1px solid #1d80da !important;
  196. }
  197. :deep .zxm-select-selection-item {
  198. color: #fff !important;
  199. line-height: 28px !important;
  200. }
  201. :deep .zxm-select-arrow {
  202. color: #fff !important;
  203. }
  204. </style>