device-warn.vue 5.7 KB

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