left-top.vue 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232
  1. <!--
  2. * @Author: daidai
  3. * @Date: 2022-02-28 16:16:42
  4. * @LastEditors: Please set LastEditors
  5. * @LastEditTime: 2022-07-20 17:57:11
  6. * @FilePath: \web-pc\src\pages\big-screen\view\indexs\left-center.vue
  7. -->
  8. <template>
  9. <ul class="user_Overview flex">
  10. <li class="user_Overview-item" style="color: #00fdfa">
  11. <div class="user_Overview_nums allnum ">
  12. <dv-digital-flop :config="config" style="width:100%;height:100%;" />
  13. </div>
  14. <p>总设备数</p>
  15. </li>
  16. <li class="user_Overview-item" style="color: #07f7a8">
  17. <div class="user_Overview_nums online">
  18. <dv-digital-flop :config="onlineconfig" style="width:100%;height:100%;" />
  19. </div>
  20. <p>在线数</p>
  21. </li>
  22. <li class="user_Overview-item" style="color: #e3b337">
  23. <div class="user_Overview_nums offline">
  24. <dv-digital-flop :config="offlineconfig" style="width:100%;height:100%;" />
  25. </div>
  26. <p>掉线数</p>
  27. </li>
  28. <li class="user_Overview-item" style="color: #f5023d">
  29. <div class="user_Overview_nums laramnum">
  30. <dv-digital-flop :config="laramnumconfig" style="width:100%;height:100%;" />
  31. </div>
  32. <p>告警次数</p>
  33. </li>
  34. </ul>
  35. <!-- <Reacquire v-else @onclick="getData" line-height="200px">
  36. 重新获取
  37. </Reacquire> -->
  38. </template>
  39. <script>
  40. // import { currentGET } from 'api/modules'
  41. let style = {
  42. fontSize: 24
  43. }
  44. export default {
  45. data() {
  46. return {
  47. num:0,
  48. options: {},
  49. userOverview: {
  50. alarmNum: 0,
  51. offlineNum: 0,
  52. onlineNum: 0,
  53. totalNum: 0,
  54. },
  55. pageflag: true,
  56. timer: null,
  57. config: {
  58. number: [100],
  59. content: '{nt}',
  60. style: {
  61. ...style,
  62. // stroke: "#00fdfa",
  63. fill: '#00fdfa',
  64. },
  65. },
  66. onlineconfig: {
  67. number: [0],
  68. content: '{nt}',
  69. style: {
  70. ...style,
  71. // stroke: "#07f7a8",
  72. fill: '#07f7a8',
  73. },
  74. },
  75. offlineconfig: {
  76. number: [0],
  77. content: '{nt}',
  78. style: {
  79. ...style,
  80. // stroke: "#e3b337",
  81. fill: '#e3b337',
  82. },
  83. },
  84. laramnumconfig: {
  85. number: [0],
  86. content: '{nt}',
  87. style: {
  88. ...style,
  89. // stroke: "#f5023d",
  90. fill: '#f5023d',
  91. },
  92. }
  93. };
  94. },
  95. filters: {
  96. numsFilter(msg) {
  97. return msg || 0;
  98. },
  99. },
  100. created() {
  101. this.getData()
  102. },
  103. mounted() {
  104. },
  105. beforeDestroy() {
  106. this.clearData()
  107. },
  108. methods: {
  109. clearData() {
  110. if (this.timer) {
  111. clearInterval(this.timer)
  112. this.timer = null
  113. }
  114. },
  115. getData() {
  116. // this.pageflag = true;
  117. console.log('111')
  118. // this.switper()
  119. // currentGET('big2').then((res) => {
  120. // if (!this.timer) {
  121. // console.log('设备总览', res);
  122. // }
  123. // if (res.success) {
  124. // this.userOverview = res.data;
  125. // this.onlineconfig = {
  126. // ...this.onlineconfig,
  127. // number: [res.data.onlineNum]
  128. // }
  129. this.config = {
  130. ...this.config,
  131. number: [this.num++]
  132. }
  133. // this.offlineconfig = {
  134. // ...this.offlineconfig,
  135. // number: [res.data.offlineNum]
  136. // }
  137. // this.laramnumconfig = {
  138. // ...this.laramnumconfig,
  139. // number: [res.data.alarmNum]
  140. // }
  141. this.switper()
  142. // } else {
  143. // this.pageflag = false;
  144. // this.$Message.warning(res.msg);
  145. // }
  146. // });
  147. },
  148. //轮询
  149. switper() {
  150. if (this.timer) {
  151. return
  152. }
  153. let looper = (a) => {
  154. this.getData()
  155. };
  156. this.timer = setInterval(looper, 1000);
  157. },
  158. },
  159. };
  160. </script>
  161. <style lang='scss' scoped>
  162. .user_Overview {
  163. li {
  164. flex: 1;
  165. p {
  166. text-align: center;
  167. height: 16px;
  168. font-size: 16px;
  169. }
  170. .user_Overview_nums {
  171. width: 100px;
  172. height: 100px;
  173. text-align: center;
  174. line-height: 100px;
  175. font-size: 22px;
  176. margin: 50px auto 30px;
  177. background-size: cover;
  178. background-position: center center;
  179. position: relative;
  180. &::before {
  181. content: '';
  182. position: absolute;
  183. width: 100%;
  184. height: 100%;
  185. top: 0;
  186. left: 0;
  187. }
  188. &.bgdonghua::before {
  189. animation: rotating 14s linear infinite;
  190. }
  191. }
  192. .allnum {
  193. // background-image: url("../../assets/images/left_top_lan.png");
  194. &::before {
  195. background-image: url("../../assets/images/left_top_lan.png");
  196. }
  197. }
  198. .online {
  199. &::before {
  200. background-image: url("../../assets/images/left_top_lv.png");
  201. }
  202. }
  203. .offline {
  204. &::before {
  205. background-image: url("../../assets/images/left_top_huang.png");
  206. }
  207. }
  208. .laramnum {
  209. &::before {
  210. background-image: url("../../assets/images/left_top_hong.png");
  211. }
  212. }
  213. }
  214. }
  215. </style>