device-warn.vue 5.7 KB

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