1
0

index.vue 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316
  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. // res = {
  68. // "createDt": null,
  69. // "monitDt": null,
  70. // "id": null,
  71. // "stationcode": null,
  72. // "devcode": "14010100313501MN0001053A10",
  73. // "devtypename": null,
  74. // "realvalue": Number(Math.random() * 100.68 + 12).toFixed(2),
  75. // "unit": "%CH4",
  76. // "adddate": "2023-09-08 16:54:19",
  77. // "devaddress": "五盘区一号回风巷瓦斯",
  78. // "uppervalue": null,
  79. // "lowervalue": null,
  80. // "uppervalueAlm": null,
  81. // "lowervalueAlm": null,
  82. // "dataType": "环境瓦斯",
  83. // "dataTypeCode": null,
  84. // "sigType": null,
  85. // "state": "正常"
  86. // }
  87. if (res) {
  88. switch (item.code) {
  89. case '1_fs1':
  90. result1[0]['fs'] = res['realvalue'];
  91. break;
  92. case '1_fs2':
  93. result1[1]['fs'] = res['realvalue'];
  94. break;
  95. case '1_gas1':
  96. result1[0]['gas'] = res['realvalue'];
  97. break;
  98. case '1_gas2':
  99. result1[1]['gas'] = res['realvalue'];
  100. break;
  101. case '2_fs1':
  102. result2[0]['fs'] = res['realvalue'];
  103. break;
  104. case '2_fs2':
  105. result2[1]['fs'] = res['realvalue'];
  106. break;
  107. case '2_gas1':
  108. result2[0]['gas'] = res['realvalue'];
  109. break;
  110. case '2_gas2':
  111. result2[1]['gas'] = res['realvalue'];
  112. break;
  113. }
  114. }
  115. }
  116. // 计算
  117. const data = [
  118. {
  119. fl: 0,
  120. gas: <any[]>[],
  121. fpGas: 0,
  122. },
  123. {
  124. fl: 0,
  125. gas: <any[]>[],
  126. fpGas: 0,
  127. }
  128. ]
  129. result1[0]['fl'] = result1[0].fs * result1[0].faceArea * 60
  130. result1[1]['fl'] = result1[1].fs * result1[1].faceArea * 60
  131. result2[0]['fl'] = result2[0].fs * result2[0].faceArea * 60
  132. result2[1]['fl'] = result2[1].fs * result2[1].faceArea * 60
  133. data[0]['fl'] = result1[0]['fl'] + result1[1]['fl']
  134. data[1]['fl'] = result2[0]['fl'] + result2[1]['fl']
  135. data[0]['fpGas'] = (result1[0]['fl'] * result1[0]['gas'] / 100) + (result1[1]['fl'] * result1[1]['gas'] / 100)
  136. data[1]['fpGas'] = (result2[0]['fl'] * result2[0]['gas'] / 100) + (result2[1]['fl'] * result2[1]['gas'] / 100)
  137. data[0]['gas'] = [
  138. {
  139. title: '二盘区一号回风联巷',
  140. value: result1[0]['gas']
  141. },
  142. {
  143. title: '二盘区二号回风联巷',
  144. value: result1[1]['gas']
  145. },
  146. ]
  147. data[1]['gas'] = [
  148. {
  149. title: '五盘区一号回风巷',
  150. value: result2[0]['gas']
  151. },
  152. {
  153. title: '五盘区二号回风巷',
  154. value: result2[1]['gas']
  155. },
  156. ]
  157. dataSource.value = data
  158. } catch (error) {
  159. // clearInterval(t)
  160. }
  161. }, 0)
  162. }
  163. onMounted(async () => {
  164. await getDataSource(timer)
  165. timer = setInterval(async () => {
  166. await getDataSource(timer)
  167. }, 1000)
  168. });
  169. onUnmounted(() => {
  170. clearInterval(timer)
  171. });
  172. </script>
  173. <style lang="less" scoped>
  174. .center-container {
  175. width: 100%;
  176. height: 100%;
  177. display: flex;
  178. justify-content: center;
  179. align-items: center;
  180. flex-direction: column;
  181. .top {
  182. background: url('/@/assets/images/vent/compre-top.png') no-repeat;
  183. margin-top: 60px;
  184. }
  185. .bottom {
  186. background: url('/@/assets/images/vent/compre-bottom.png') no-repeat;
  187. margin-top: 80px;
  188. }
  189. .box {
  190. width: 1500px;
  191. height: 320px;
  192. background-size: contain;
  193. position: relative;
  194. .title {
  195. width: 100%;
  196. position: absolute;
  197. color: #dddddd;
  198. text-align: center;
  199. font-size: 22px;
  200. font-weight: 600;
  201. text-shadow: 2px 2px 4px #00000088;
  202. }
  203. .top-title {
  204. top: 14px;
  205. }
  206. .bottom-title {
  207. bottom: 33px;
  208. }
  209. }
  210. .items-top {
  211. margin-top: 130px;
  212. }
  213. .items-bottom {
  214. margin-top: 45px;
  215. }
  216. .items-box {
  217. width: 100%;
  218. height: 100%;
  219. display: flex;
  220. justify-content: space-around;
  221. padding: 0 40px;
  222. .item {
  223. width: 375px;
  224. height: 132px;
  225. display: flex;
  226. flex-direction: column;
  227. justify-content: center;
  228. align-items: flex-start;
  229. padding-left: 160px;
  230. position: relative;
  231. .item-title {
  232. color: #e8e8e8;
  233. margin-bottom: 10px;
  234. font-weight: 600;
  235. }
  236. .item-value {
  237. font-size: 22px;
  238. font-family: 'douyuFont';
  239. }
  240. .gas-item {
  241. position: absolute;
  242. width: 100%;
  243. height: 100%;
  244. display: flex;
  245. flex-direction: row;
  246. justify-content: space-between;
  247. left: 0px;
  248. padding: 0 60px;
  249. top: 20px;
  250. .gas {
  251. .title1 {
  252. color: #00d9ff;
  253. margin-bottom: 10px;
  254. font-size: 16px;
  255. font-weight: 600;
  256. }
  257. .title2 {
  258. color: #fff;
  259. margin-bottom: 10px;
  260. font-weight: 600;
  261. }
  262. }
  263. }
  264. }
  265. .item1 {
  266. background: url('/@/assets/images/vent/compre-3.png') no-repeat;
  267. color: #30B6FF;
  268. }
  269. .item2 {
  270. width: 507px;
  271. height: 135px;
  272. background: url('/@/assets/images/vent/compre-2-1.png') no-repeat;
  273. color: #A9B6FF;
  274. }
  275. .item3 {
  276. background: url('/@/assets/images/vent/compre-1.png') no-repeat;
  277. color: #27FDED;
  278. }
  279. }
  280. }</style>