index.vue 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280
  1. <template>
  2. <div class="fanlocalPage">
  3. <customHeader>局部风机监测</customHeader>
  4. <div class="left-icon">
  5. <img src="../../../../assets/images/vent/fanlocal-page/arrow-button.png" alt="" />
  6. </div>
  7. <div class="right-icon">
  8. <img class="img1" src="../../../../assets/images/vent/fanlocal-page/arrow-button.png" alt="" />
  9. </div>
  10. <div class="fanlocal-container">
  11. <div class="card-box" v-for="(item, index) in cardList" :key="index">
  12. <div class="card-title" @click="getClick(item)">{{ item.label }}</div>
  13. <div class="card-box-item">
  14. <div class="left-box-item">
  15. <div class="item-icon">
  16. <img src="../../../../assets/images/vent/fanlocal-page/is-txzt1.png" alt="" />
  17. </div>
  18. <div class="item-content">
  19. <div class="item-content-value">{{ item.txVal }}</div>
  20. <div class="item-content-text">{{ item.txLable }}</div>
  21. </div>
  22. </div>
  23. <div class="right-box-item">
  24. <div class="item-icon">
  25. <img src="../../../../assets/images/vent/fanlocal-page/is-warn1.png" alt="" />
  26. </div>
  27. <div class="item-content">
  28. <div class="item-content-value">{{ item.warnVal }}</div>
  29. <div class="item-content-text">{{ item.warnLabel }}</div>
  30. </div>
  31. </div>
  32. </div>
  33. <div class="card-box-list">
  34. <div class="list-item" v-for="(ite, ind) in item.listData" :key="ind">
  35. <div class="list-item-label">{{ ite.label }}</div>
  36. <div class="list-item-value">{{ `${ite.value}${ite.dw}` }}</div>
  37. </div>
  38. </div>
  39. </div>
  40. </div>
  41. </div>
  42. </template>
  43. <script setup lang="ts">
  44. import { onBeforeMount, ref, watch, onMounted, nextTick, defineAsyncComponent, reactive, onUnmounted, inject, unref } from 'vue';
  45. import customHeader from '/@/components/vent/customHeader.vue';
  46. import { device } from './fanlocal.api';
  47. import { useRouter } from 'vue-router';
  48. const props = defineProps({});
  49. let router = useRouter();
  50. let cardList = reactive<any[]>([]);
  51. const deviceType = ref('');
  52. // https获取监测数据
  53. let timer: null | NodeJS.Timeout = null;
  54. function getMonitor(flag?) {
  55. timer = setTimeout(
  56. async () => {
  57. await getList();
  58. if (timer) {
  59. timer = null;
  60. }
  61. getMonitor();
  62. },
  63. flag ? 0 : 3000
  64. );
  65. }
  66. //点击标题页面跳转
  67. function getClick(item) {
  68. router.push('/monitorChannel/monitor-fanlocal1?id=' + item.deviceID + '&deviceType=' + item.deviceType);
  69. }
  70. //获取列表数据
  71. async function getList() {
  72. let res = await device({ devicetype: 'fanlocal', pagetype: 'normal' });
  73. let res1 = await device({ devicetype: 'fanlocaldp', pagetype: 'normal' });
  74. let data = [...res.msgTxt[0].datalist, ...(res1.msgTxt[0] ? res1.msgTxt[0].datalist : [])];
  75. cardList.length = 0;
  76. if (data.length != 0) {
  77. data.forEach((el) => {
  78. cardList.push({
  79. deviceID: el.deviceID,
  80. deviceType: el.deviceType,
  81. label: el.strinstallpos,
  82. txVal: el.netStatus == 1 ? '连接' : '未连接',
  83. txLable: '通讯状态',
  84. warnVal: el.warnLevel_str ? el.warnLevel_str : '-',
  85. warnLabel: '是否报警',
  86. listData: [
  87. {
  88. label: '运行风机',
  89. value: el.readData.Fan1StartStatus == '1' ? '1#风机' : el.readData.Fan2StartStatus == '1' ? '2#风机' : '--',
  90. dw: '',
  91. },
  92. {
  93. label: '风量',
  94. value: el.readData.windQuantity2 ? el.readData.windQuantity2 : '-',
  95. dw: 'm³/min',
  96. },
  97. {
  98. label: '风速',
  99. value: el.readData.windSpeed2 ? el.readData.windSpeed2 : '-',
  100. dw: 'm/s',
  101. },
  102. { label: '时间', value: el.readTime, dw: '' },
  103. ],
  104. });
  105. });
  106. }
  107. }
  108. onMounted(() => {
  109. getList();
  110. getMonitor(true);
  111. });
  112. onUnmounted(() => {
  113. if (timer) {
  114. clearTimeout(timer);
  115. timer = undefined;
  116. }
  117. });
  118. </script>
  119. <style lang="less" scoped>
  120. .fanlocalPage {
  121. width: 100%;
  122. height: 100%;
  123. padding: 100px 60px 20px 60px;
  124. box-sizing: border-box;
  125. position: relative;
  126. .left-icon {
  127. display: flex;
  128. align-items: center;
  129. justify-content: center;
  130. width: 60px;
  131. height: calc(100% - 100px);
  132. position: absolute;
  133. left: 0;
  134. top: 100px;
  135. }
  136. .right-icon {
  137. display: flex;
  138. align-items: center;
  139. justify-content: center;
  140. width: 60px;
  141. height: calc(100% - 100px);
  142. position: absolute;
  143. right: 0;
  144. top: 100px;
  145. }
  146. img {
  147. width: 60px;
  148. height: 60px;
  149. }
  150. .img1 {
  151. transform: rotate(180deg);
  152. }
  153. .fanlocal-container {
  154. height: 100%;
  155. display: flex;
  156. flex-wrap: wrap;
  157. overflow-y: auto;
  158. .card-box {
  159. position: relative;
  160. width: 417px;
  161. height: 380px;
  162. margin: 0px 15px 15px 0px;
  163. background: url(/src/assets/images/vent/fanlocal-page/card.png) no-repeat center;
  164. background-size: 100% 100%;
  165. .card-title {
  166. position: absolute;
  167. left: 50%;
  168. top: 6px;
  169. transform: translate(-50%, 0);
  170. font-size: 14px;
  171. font-family: 'douyuFont';
  172. color: #fff;
  173. cursor: pointer;
  174. }
  175. .card-box-item {
  176. width: 100%;
  177. height: 64px;
  178. position: absolute;
  179. left: 0;
  180. top: 55px;
  181. display: flex;
  182. justify-content: space-around;
  183. .left-box-item {
  184. display: flex;
  185. justify-content: space-between;
  186. align-items: center;
  187. width: 45%;
  188. height: 100%;
  189. padding: 5px 10px;
  190. background: url('../../../../assets/images/vent/fanlocal-page/is-txzt.png') no-repeat center;
  191. background-size: 100% 100%;
  192. box-sizing: border-box;
  193. }
  194. .right-box-item {
  195. display: flex;
  196. justify-content: space-between;
  197. align-items: center;
  198. width: 45%;
  199. height: 100%;
  200. padding: 5px 10px;
  201. background: url('../../../../assets/images/vent/fanlocal-page/is-warn.png') no-repeat center;
  202. background-size: 100% 100%;
  203. box-sizing: border-box;
  204. }
  205. .item-icon {
  206. width: 60px;
  207. height: 100%;
  208. margin-right: 15px;
  209. display: flex;
  210. justify-content: center;
  211. align-items: center;
  212. }
  213. .item-content {
  214. width: calc(100% - 60px);
  215. height: 100%;
  216. display: flex;
  217. flex-direction: column;
  218. justify-content: center;
  219. color: #fff;
  220. font-size: 14px;
  221. padding-top: 10px;
  222. box-sizing: border-box;
  223. .item-content-value {
  224. font-family: 'douyuFont';
  225. color: #01fefc;
  226. }
  227. }
  228. }
  229. .card-box-list {
  230. width: 100%;
  231. height: 245px;
  232. padding: 0px 15px;
  233. box-sizing: border-box;
  234. position: absolute;
  235. left: 0;
  236. top: 130px;
  237. display: flex;
  238. flex-direction: column;
  239. justify-content: space-around;
  240. overflow-y: auto;
  241. .list-item {
  242. height: 30px;
  243. padding: 0px 25px;
  244. box-sizing: border-box;
  245. color: #fff;
  246. display: flex;
  247. justify-content: space-between;
  248. align-items: center;
  249. background: url('../../../../assets/images/vent/fanlocal-page/one-bg.png') no-repeat center;
  250. background-size: 100% 100%;
  251. .list-item-value {
  252. color: #01fefc;
  253. }
  254. }
  255. }
  256. }
  257. }
  258. }
  259. </style>