device-warn.vue 5.6 KB

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