index.vue 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295
  1. <template>
  2. <div class="scene-box">
  3. <customHeader>智能通风风排瓦斯监测</customHeader>
  4. <div class="center-container">
  5. <div class="top box">
  6. <div class="title top-title">枣林风排瓦斯</div>
  7. <div class="items-top items-box">
  8. <div v-for="(item, n) in param" :key=n class="item" :class="`item${n + 1}`">
  9. <template v-if="item.code != 'gas'">
  10. <div class="item-title">{{ item.title }}</div>
  11. <div class="item-value">{{ dataSource[0] ? formatNum(dataSource[0][item.code]) : '-' }}</div>
  12. </template>
  13. <div class="gas-item" v-else-if="dataSource[0] && dataSource[0][item.code]">
  14. <div class="gas" v-for="(gasItem, i) in dataSource[0][item.code]" :key="i">
  15. <div class="title1">{{ gasItem['title'] }}</div>
  16. <div class="title2">瓦斯浓度(%)</div>
  17. <div class="item-value">{{ gasItem['value'] ? formatNum(gasItem['value']) : '-' }}</div>
  18. </div>
  19. </div>
  20. </div>
  21. </div>
  22. </div>
  23. <div class="bottom box">
  24. <div class="title bottom-title">刘家堰风排瓦斯</div>
  25. <div class="items-bottom items-box">
  26. <div v-for="(item, n) in param" :key=n class="item" :class="`item${n + 1}`">
  27. <template v-if="item.code != 'gas'">
  28. <div class="item-title">{{ item.title }}</div>
  29. <div class="item-value">{{ dataSource[1] ? formatNum(dataSource[1][item.code]) : '-' }}</div>
  30. </template>
  31. <div class="gas-item" v-else-if="dataSource[0] && dataSource[0][item.code]">
  32. <div class="gas" v-for="(gasItem, i) in dataSource[1][item.code]" :key="i">
  33. <div class="title1">{{ gasItem['title'] }}</div>
  34. <div class="title2">瓦斯浓度(%)</div>
  35. <div class="item-value">{{ gasItem['value'] ? formatNum(gasItem['value']) : '-' }}</div>
  36. </div>
  37. </div>
  38. </div>
  39. </div>
  40. </div>
  41. </div>
  42. </div>
  43. </template>
  44. <script setup lang="ts">
  45. import { ref, onMounted, onUnmounted } from 'vue';
  46. import customHeader from '/@/components/vent/customHeader.vue';
  47. import { param, httpParam, result1, result2 } from './compre.data'
  48. import { list } from './compre.api'
  49. import { formatNum } from '/@/utils/ventutil'
  50. type DataSource = {
  51. fl: number,
  52. gas: Array<any[]>,
  53. fpGas: number,
  54. }
  55. const dataSource = ref<DataSource[]>([])
  56. let timer = null as unknown as NodeJS.Timer;
  57. async function getDataSource(t: NodeJS.Timer) {
  58. setTimeout(async () => {
  59. // const result1 = resultFn1()
  60. // const result2 = resultFn2()
  61. try {
  62. for (let i = 0; i < httpParam.length; i++) {
  63. const item = httpParam[i]
  64. const result = await list({ devcode: item.devcode })
  65. // console.log('综合监测返回数据------>', result, result1, result2)
  66. let res = result[0]
  67. if (res) {
  68. switch (item.code) {
  69. case '1_fs1':
  70. result1[0]['fs'] = res['realvalue'];
  71. break;
  72. case '1_fs2':
  73. result1[1]['fs'] = res['realvalue'];
  74. break;
  75. case '1_gas1':
  76. result1[0]['gas'] = res['realvalue'];
  77. break;
  78. case '1_gas2':
  79. result1[1]['gas'] = res['realvalue'];
  80. break;
  81. case '2_fs1':
  82. result2[0]['fs'] = res['realvalue'];
  83. break;
  84. case '2_fs2':
  85. result2[1]['fs'] = res['realvalue'];
  86. break;
  87. case '2_gas1':
  88. result2[0]['gas'] = res['realvalue'];
  89. break;
  90. case '2_gas2':
  91. result2[1]['gas'] = res['realvalue'];
  92. break;
  93. }
  94. }
  95. }
  96. // 计算
  97. const data = [
  98. {
  99. fl: 0,
  100. gas: <any[]>[],
  101. fpGas: 0,
  102. },
  103. {
  104. fl: 0,
  105. gas: <any[]>[],
  106. fpGas: 0,
  107. }
  108. ]
  109. result1[0]['fl'] = result1[0].fs * result1[0].faceArea * 60
  110. result1[1]['fl'] = result1[1].fs * result1[1].faceArea * 60
  111. result2[0]['fl'] = result2[0].fs * result2[0].faceArea * 60
  112. result2[1]['fl'] = result2[1].fs * result2[1].faceArea * 60
  113. data[0]['fl'] = result1[0]['fl'] + result1[1]['fl']
  114. data[1]['fl'] = result2[0]['fl'] + result2[1]['fl']
  115. data[0]['fpGas'] = (result1[0]['fl'] * result1[0]['gas'] / 100) + (result1[1]['fl'] * result1[1]['gas'] / 100)
  116. data[1]['fpGas'] = (result2[0]['fl'] * result2[0]['gas'] / 100) + (result2[1]['fl'] * result2[1]['gas'] / 100)
  117. data[0]['gas'] = [
  118. {
  119. title: '二盘区一号回风联巷',
  120. value: result1[0]['gas']
  121. },
  122. {
  123. title: '二盘区二号回风联巷',
  124. value: result1[1]['gas']
  125. },
  126. ]
  127. data[1]['gas'] = [
  128. {
  129. title: '五盘区一号回风巷',
  130. value: result2[0]['gas']
  131. },
  132. {
  133. title: '五盘区二号回风巷',
  134. value: result2[1]['gas']
  135. },
  136. ]
  137. dataSource.value = data
  138. } catch (error) {
  139. // clearInterval(t)
  140. }
  141. }, 0)
  142. }
  143. onMounted(async () => {
  144. await getDataSource(timer)
  145. timer = setInterval(async () => {
  146. await getDataSource(timer)
  147. }, 1000)
  148. });
  149. onUnmounted(() => {
  150. clearInterval(timer)
  151. });
  152. </script>
  153. <style lang="less" scoped>
  154. .center-container {
  155. width: 100%;
  156. height: 100%;
  157. display: flex;
  158. justify-content: center;
  159. align-items: center;
  160. flex-direction: column;
  161. .top {
  162. background: url('/@/assets/images/vent/compre-top.png') no-repeat;
  163. margin-top: 60px;
  164. }
  165. .bottom {
  166. background: url('/@/assets/images/vent/compre-bottom.png') no-repeat;
  167. margin-top: 80px;
  168. }
  169. .box {
  170. width: 1500px;
  171. height: 320px;
  172. background-size: contain;
  173. position: relative;
  174. .title {
  175. width: 100%;
  176. position: absolute;
  177. color: #dddddd;
  178. text-align: center;
  179. font-size: 22px;
  180. font-weight: 600;
  181. text-shadow: 2px 2px 4px #00000088;
  182. }
  183. .top-title {
  184. top: 14px;
  185. }
  186. .bottom-title {
  187. bottom: 33px;
  188. }
  189. }
  190. .items-top {
  191. margin-top: 130px;
  192. }
  193. .items-bottom {
  194. margin-top: 45px;
  195. }
  196. .items-box {
  197. width: 100%;
  198. height: 100%;
  199. display: flex;
  200. justify-content: space-around;
  201. padding: 0 40px;
  202. .item {
  203. width: 375px;
  204. height: 132px;
  205. display: flex;
  206. flex-direction: column;
  207. justify-content: center;
  208. align-items: flex-start;
  209. padding-left: 160px;
  210. position: relative;
  211. .item-title {
  212. color: #e8e8e8;
  213. margin-bottom: 10px;
  214. font-weight: 600;
  215. }
  216. .item-value {
  217. font-size: 22px;
  218. font-family: 'douyuFont';
  219. }
  220. .gas-item {
  221. position: absolute;
  222. width: 100%;
  223. height: 100%;
  224. display: flex;
  225. flex-direction: row;
  226. justify-content: space-between;
  227. left: 0px;
  228. padding: 0 60px;
  229. top: 20px;
  230. .gas {
  231. .title1 {
  232. color: #00d9ff;
  233. margin-bottom: 10px;
  234. font-size: 16px;
  235. font-weight: 600;
  236. }
  237. .title2 {
  238. color: #fff;
  239. margin-bottom: 10px;
  240. font-weight: 600;
  241. }
  242. }
  243. }
  244. }
  245. .item1 {
  246. background: url('/@/assets/images/vent/compre-3.png') no-repeat;
  247. color: #30B6FF;
  248. }
  249. .item2 {
  250. width: 507px;
  251. height: 135px;
  252. background: url('/@/assets/images/vent/compre-2-1.png') no-repeat;
  253. color: #A9B6FF;
  254. }
  255. .item3 {
  256. background: url('/@/assets/images/vent/compre-1.png') no-repeat;
  257. color: #27FDED;
  258. }
  259. }
  260. }</style>