gasWarn.vue 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628
  1. <template>
  2. <customHeader :options="options" @change="getSelectRow" :optionValue="optionValue"> 瓦斯监测预警 </customHeader>
  3. <div class="gasWarn">
  4. <a-button preIcon="ant-design:rollback-outlined" type="text" size="small"
  5. style="position: absolute;left:15px;top:15px;color: #fff;" @click="getBack">返回</a-button>
  6. <div class="alarm-menu">
  7. <div class="card-btn">
  8. <div :class="activeIndex1 == ind ? 'btn1' : 'btn'" v-for="(item, ind) in menuList" :key="ind"
  9. @click="cardClick(ind, item)">
  10. <div class="text">{{ item.name }}</div>
  11. <div class="warn">{{ item.warn }}</div>
  12. </div>
  13. </div>
  14. </div>
  15. <div class="gas-content">
  16. <div class="top-area" v-if="topAreaListWs.length != 0">
  17. <div class="title-t">
  18. <div class="text-t">瓦斯抽采泵信息</div>
  19. </div>
  20. <div class="content-t">
  21. <div class="top-box" v-for="(item, index) in topAreaListWs" :key="index">
  22. <div class="box-label">{{ item.label }}</div>
  23. <div class="box-values">
  24. <div class="value-b" v-for="(items, ind) in item.list" :key="ind">
  25. <span>{{ `${items.name} : ` }}</span>
  26. <span :class="{
  27. 'box-value': items.val == 0 && items.name == '报警状态',
  28. 'box-value1': items.val == 101 && items.name == '报警状态',
  29. 'box-value2': items.val == 102 && items.name == '报警状态',
  30. 'box-value3': items.val == 103 && items.name == '报警状态',
  31. 'box-value4': items.val == 104 && items.name == '报警状态',
  32. 'box-value5': (items.val == 201 || item.val == 1001) && items.name == '报警状态',
  33. }">{{
  34. items.val == 0 && items.name == '报警状态'
  35. ? '正常'
  36. : items.val == 101 && items.name == '报警状态'
  37. ? '较低风险'
  38. : items.val == 102 && items.name == '报警状态'
  39. ? '低风险'
  40. : items.val == 103 && items.name == '报警状态'
  41. ? '中风险'
  42. : items.val == 104 && items.name == '报警状态'
  43. ? '高风险'
  44. : items.val == 201 && items.name == '报警状态'
  45. ? '报警' : items.val == 1001 && items.name == '报警状态' ? '网络断开'
  46. : items.val
  47. }}</span>
  48. </div>
  49. </div>
  50. </div>
  51. </div>
  52. </div>
  53. <div :class="topAreaListWs.length != 0 ? 'bot-area' : 'bot-area1'">
  54. <div class="title-b">
  55. <div class="text-b">安全监控测点信息</div>
  56. </div>
  57. <div class="content-b">
  58. <div class="card-b" v-for="(item, index) in cardListWs" :key="index">
  59. <div class="item-l">
  60. <div class="label-l">{{ item.label }}</div>
  61. <div class="value-l">{{ `${item.value}%` }}</div>
  62. </div>
  63. <div class="item-r">
  64. <div class="content-r" v-for="(items, ind) in item.listR" :key="ind">
  65. <span>{{ `${items.label} : ` }}</span>
  66. <span :class="{
  67. 'status-f': items.value == 1,
  68. 'status-l': items.value == 0,
  69. }">{{ items.value == 1 ? '异常' : items.value == 0 ? '正常' : items.value }}</span>
  70. </div>
  71. </div>
  72. </div>
  73. </div>
  74. </div>
  75. </div>
  76. </div>
  77. </template>
  78. <script setup lang="ts">
  79. import { ref, reactive, onMounted, onUnmounted } from 'vue'
  80. import { sysTypeWarnList, sysWarn } from '../common.api'
  81. import { useSystemSelect } from '/@/hooks/vent/useSystemSelect';
  82. import { useRouter } from 'vue-router';
  83. import CustomHeader from '/@/components/vent/customHeader.vue';
  84. const { options, optionValue, getSelectRow, getSysDataSource } = useSystemSelect('sys_surface_caimei'); // 参数为场景类型(设备类型管理中可以查询到)
  85. //当前左侧激活菜单的索引
  86. let activeIndex1 = ref(0);
  87. //左侧数据列表
  88. let menuList = reactive<any[]>([])
  89. //瓦斯顶部区域数据
  90. let topAreaListWs = reactive<any[]>([]);
  91. //瓦斯监控列表数据
  92. let cardListWs = reactive<any[]>([]);
  93. let router = useRouter()
  94. // https获取监测数据
  95. let timer: null | NodeJS.Timeout = null;
  96. function getMonitor(deviceID, flag?) {
  97. timer = setTimeout(
  98. async () => {
  99. await getSysWarnList(deviceID, 'gas');
  100. if (timer) {
  101. timer = null;
  102. }
  103. getMonitor(deviceID);
  104. },
  105. flag ? 0 : 1000
  106. );
  107. }
  108. //返回首页
  109. function getBack() {
  110. router.push('/monitorChannel/monitor-alarm-home')
  111. }
  112. //获取预警详情弹窗右侧数据
  113. function getSysWarnList(id, type) {
  114. sysWarn({ sysid: id, type: type }).then((res) => {
  115. // listData.common = res;
  116. topAreaListWs.length = 0;
  117. cardListWs.length = 0;
  118. if (JSON.stringify(res) != '{}') {
  119. res.pump.forEach((v) => {
  120. topAreaListWs.push({
  121. label: v.strinstallpos || '--',
  122. list: [
  123. // { name: '抽采泵流量', val: v.readData.FlowSensor_InputFlux || 0 },
  124. { name: '报警状态', val: v.warnLevel || 0 },
  125. { name: '输入管道内一氧化碳(ppm)', val: v.readData.coVal && v.readData.coVal != '0' ? v.readData.coVal : '-' },
  126. { name: '管路出口处瓦斯(%CH4)', val: v.readData.gas1 && v.readData.gas1 != '0' ? v.readData.gas1 : '-' }, //v.readData.gas1
  127. { name: '泵站内瓦斯(%CH4)', val: v.readData.gas2 && v.readData.gas2 != '0' ? v.readData.gas2 : '-' }, //v.readData.gas2
  128. { name: '输入管道内瓦斯(%CH4)', val: v.readData.gas3 && v.readData.gas3 != '0' ? v.readData.gas3 : '-' }, //v.readData.gas3
  129. { name: '管道输出瓦斯(%CH4)', val: v.readData.gas4 && v.readData.gas4 != '0' ? v.readData.gas4 : '-' }, //v.readData.gas4
  130. { name: '输入管道内工混流量(m³/min)', val: v.readData.mixedTraffic && v.readData.mixedTraffic != '0' ? v.readData.mixedTraffic : '-' }, //v.readData.mixedTraffic
  131. {
  132. name: '输入管道内标况流量(m³/min)',
  133. val: v.readData.standardTraffic && v.readData.standardTraffic != '0' ? v.readData.standardTraffic : '-',
  134. }, //v.readData.standardTraffic
  135. { name: '瓦斯抽放量(m³)', val: v.readData.totalGasDrainage && v.readData.totalGasDrainage != '0' ? v.readData.totalGasDrainage : '-' },
  136. ],
  137. });
  138. });
  139. res.gas.forEach((el) => {
  140. el.strinstallpos = el.strinstallpos.indexOf('&') == -1 ? el.strinstallpos : el.strinstallpos.substring(0, el.strinstallpos.indexOf('&'));
  141. cardListWs.push({
  142. label: '甲烷',
  143. // value: el.readData.gasC || '--',
  144. value: 0,
  145. listR: [
  146. { id: 0, label: '测点类型', value: '瓦斯' },
  147. { id: 1, label: '测点位置', value: el.strinstallpos || '--' },
  148. { id: 2, label: '数据时间', value: el.readData.datetime || '--' },
  149. { id: 3, label: '测点状态', value: el.warnFlag },
  150. ],
  151. });
  152. });
  153. }
  154. });
  155. }
  156. //获取左侧菜单列表
  157. async function getMenuList() {
  158. let res = await sysTypeWarnList({ type: 'gas' })
  159. if (res.length != 0) {
  160. menuList.length = 0
  161. res.forEach((el) => {
  162. menuList.push({
  163. name: el.systemname,
  164. warn: '低风险',
  165. deviceID: el.id,
  166. strtype: el.strtype,
  167. });
  168. });
  169. getMonitor(menuList[0].deviceID, true);
  170. }
  171. }
  172. //菜单选项切换
  173. function cardClick(ind, item) {
  174. activeIndex1.value = ind;
  175. clearTimeout(timer);
  176. getMonitor(item.deviceID, true);
  177. }
  178. onMounted(() => {
  179. getMenuList()
  180. })
  181. onUnmounted(() => {
  182. if (timer) {
  183. clearTimeout(timer);
  184. timer = undefined;
  185. }
  186. });
  187. </script>
  188. <style lang="less" scoped>
  189. .gasWarn {
  190. width: 100%;
  191. height: calc(100% - 52px);
  192. padding: 80px 10px 15px 10px;
  193. box-sizing: border-box;
  194. display: flex;
  195. justify-content: space-between;
  196. .alarm-menu {
  197. height: 100%;
  198. width: 15%;
  199. .card-btn {
  200. width: 100%;
  201. height: 100%;
  202. overflow-y: auto;
  203. .btn {
  204. position: relative;
  205. width: 81%;
  206. height: 14%;
  207. margin-bottom: 10%;
  208. font-family: 'douyuFont';
  209. background: url('../../../../../assets/images/fire/no-choice.png') no-repeat;
  210. background-size: 100% 100%;
  211. cursor: pointer;
  212. .text {
  213. width: 80%;
  214. position: absolute;
  215. left: 50%;
  216. top: 28px;
  217. font-size: 16px;
  218. color: #01fefc;
  219. text-align: center;
  220. transform: translate(-50%, 0);
  221. }
  222. .warn {
  223. width: 100%;
  224. position: absolute;
  225. left: 50%;
  226. bottom: 14px;
  227. font-size: 14px;
  228. color: #fff;
  229. text-align: center;
  230. transform: translate(-50%, 0);
  231. }
  232. }
  233. .btn1 {
  234. position: relative;
  235. width: 100%;
  236. height: 14%;
  237. margin-bottom: 10%;
  238. font-family: 'douyuFont';
  239. background: url('../../../../../assets/images/fire/choice.png') no-repeat;
  240. background-size: 100% 100%;
  241. cursor: pointer;
  242. .text {
  243. width: 80%;
  244. position: absolute;
  245. left: 50%;
  246. top: 28px;
  247. font-size: 16px;
  248. color: #01fefc;
  249. text-align: center;
  250. transform: translate(-62%, 0);
  251. }
  252. .warn {
  253. width: 100%;
  254. position: absolute;
  255. left: 50%;
  256. bottom: 14px;
  257. font-size: 14px;
  258. color: #fff;
  259. text-align: center;
  260. transform: translate(-60%, 0);
  261. }
  262. }
  263. }
  264. }
  265. .gas-content {
  266. width: calc(85% - 10px);
  267. height: 100%;
  268. margin-left: 10px;
  269. padding: 15px;
  270. background: url('../../../../../assets/images/fire/border.png') no-repeat;
  271. background-size: 100% 100%;
  272. box-sizing: border-box;
  273. .top-area {
  274. height: 356px;
  275. margin-bottom: 10px;
  276. padding: 10px;
  277. background: url('../../../../../assets/images/fire/bj1.png') no-repeat center;
  278. background-size: 100% 100%;
  279. box-sizing: border-box;
  280. .title-t {
  281. height: 30px;
  282. margin-bottom: 10px;
  283. display: flex;
  284. justify-content: space-between;
  285. align-items: center;
  286. .text-t {
  287. font-family: 'douyuFont';
  288. font-size: 14px;
  289. color: #fff;
  290. }
  291. }
  292. .content-t {
  293. width: 100%;
  294. height: 276px;
  295. display: flex;
  296. justify-content: space-between;
  297. align-items: center;
  298. padding: 0px 10px;
  299. box-sizing: border-box;
  300. .top-box {
  301. position: relative;
  302. width: 724px;
  303. height: 100%;
  304. background: url('../../../../../assets/images/fire/top-area.png') no-repeat center;
  305. background-size: 100% 100%;
  306. .box-label {
  307. position: absolute;
  308. left: 50%;
  309. top: 198px;
  310. transform: translate(-50%, 0);
  311. width: 80%;
  312. font-family: 'douyuFont';
  313. font-size: 16px;
  314. display: flex;
  315. justify-content: center;
  316. align-items: center;
  317. word-wrap: break-word;
  318. color: #fff;
  319. }
  320. .box-values {
  321. position: absolute;
  322. left: 50%;
  323. top: 26px;
  324. transform: translate(-50%, 0);
  325. width: 84%;
  326. display: flex;
  327. justify-content: space-between;
  328. align-items: center;
  329. flex-wrap: wrap;
  330. .value-b {
  331. width: calc(50% - 10px);
  332. height: 25px;
  333. display: flex;
  334. justify-content: space-between;
  335. align-items: center;
  336. color: #fff;
  337. font-size: 14px;
  338. span {
  339. font-size: 14px;
  340. &:last-child {
  341. font-family: 'douyuFont';
  342. color: rgb(0, 242, 255);
  343. }
  344. }
  345. .box-value {
  346. color: rgb(145, 230, 9) !important;
  347. }
  348. .box-value1 {
  349. color: rgb(0, 242, 255) !important;
  350. }
  351. .box-value2 {
  352. color: #ffff35 !important;
  353. }
  354. .box-value3 {
  355. color: #ffbe69 !important;
  356. }
  357. .box-value4 {
  358. color: #ff6f00 !important;
  359. }
  360. .box-value5 {
  361. color: #ff0000 !important;
  362. }
  363. }
  364. }
  365. }
  366. }
  367. }
  368. .bot-area {
  369. height: calc(100% - 356px);
  370. padding: 10px;
  371. background: url('../../../../../assets/images/fire/bj1.png') no-repeat center;
  372. background-size: 100% 100%;
  373. box-sizing: border-box;
  374. .title-b {
  375. height: 30px;
  376. margin-bottom: 10px;
  377. display: flex;
  378. justify-content: space-between;
  379. align-items: center;
  380. .text-b {
  381. font-family: 'douyuFont';
  382. font-size: 14px;
  383. color: #fff;
  384. }
  385. }
  386. .content-b {
  387. height: calc(100% - 40px);
  388. display: flex;
  389. justify-content: flex-start;
  390. align-items: flex-start;
  391. flex-wrap: wrap;
  392. overflow-y: auto;
  393. .card-b {
  394. position: relative;
  395. width: 30%;
  396. height: 128px;
  397. margin: 0px 15px 15px 15px;
  398. background: url('../../../../../assets/images/fire/bot-area.png') no-repeat center;
  399. background-size: 100% 100%;
  400. .item-l {
  401. position: absolute;
  402. left: 32px;
  403. top: 50%;
  404. transform: translate(0, -50%);
  405. width: 89px;
  406. height: 98px;
  407. background: url('../../../../../assets/images/fire/bot-area1.png') no-repeat center;
  408. .label-l {
  409. position: absolute;
  410. left: 50%;
  411. top: 7px;
  412. color: #fff;
  413. font-size: 14px;
  414. transform: translate(-50%, 0);
  415. }
  416. .value-l {
  417. position: absolute;
  418. left: 50%;
  419. top: 50px;
  420. transform: translate(-50%, 0);
  421. font-family: 'douyuFont';
  422. font-size: 16px;
  423. color: #3df6ff;
  424. }
  425. }
  426. .item-r {
  427. position: absolute;
  428. left: 132px;
  429. top: 50%;
  430. transform: translate(0, -50%);
  431. height: 128px;
  432. padding: 5px 0px;
  433. display: flex;
  434. flex-direction: column;
  435. justify-content: space-around;
  436. box-sizing: border-box;
  437. .content-r {
  438. display: flex;
  439. span {
  440. font-size: 14px;
  441. color: #fff;
  442. &:first-child {
  443. display: inline-block;
  444. width: 68px;
  445. }
  446. &:last-child {
  447. display: inline-block;
  448. width: calc(100% - 68px);
  449. }
  450. }
  451. .status-f {
  452. color: #ff0000;
  453. }
  454. .status-l {
  455. color: #3df6ff;
  456. }
  457. }
  458. }
  459. }
  460. }
  461. }
  462. .bot-area1 {
  463. height: 100%;
  464. padding: 10px 15px 0px 15px;
  465. background: url('../../../../../assets/images/fire/bj1.png') no-repeat center;
  466. background-size: 100% 100%;
  467. box-sizing: border-box;
  468. .title-b {
  469. height: 30px;
  470. margin-bottom: 10px;
  471. display: flex;
  472. justify-content: space-between;
  473. align-items: center;
  474. .text-b {
  475. font-family: 'douyuFont';
  476. font-size: 14px;
  477. color: #fff;
  478. }
  479. }
  480. .content-b {
  481. width: 100%;
  482. height: calc(100% - 40px);
  483. display: flex;
  484. justify-content: flex-start;
  485. align-items: flex-start;
  486. flex-wrap: wrap;
  487. overflow-y: auto;
  488. .card-b {
  489. position: relative;
  490. width: 30%;
  491. height: 128px;
  492. margin: 0px 15px 15px 15px;
  493. background: url('../../../../../assets/images/fire/bot-area.png') no-repeat center;
  494. background-size: 100% 100%;
  495. .item-l {
  496. position: absolute;
  497. left: 32px;
  498. top: 50%;
  499. transform: translate(0, -50%);
  500. width: 89px;
  501. height: 98px;
  502. background: url('../../../../../assets/images/fire/bot-area1.png') no-repeat center;
  503. .label-l {
  504. position: absolute;
  505. left: 50%;
  506. top: 7px;
  507. font-size: 14px;
  508. color: #fff;
  509. transform: translate(-50%, 0);
  510. }
  511. .value-l {
  512. position: absolute;
  513. left: 50%;
  514. top: 50px;
  515. transform: translate(-50%, 0);
  516. font-family: 'douyuFont';
  517. font-size: 16px;
  518. color: #3df6ff;
  519. }
  520. }
  521. .item-r {
  522. position: absolute;
  523. left: 132px;
  524. top: 50%;
  525. transform: translate(0, -50%);
  526. height: 128px;
  527. padding: 5px 0px;
  528. display: flex;
  529. flex-direction: column;
  530. justify-content: space-around;
  531. box-sizing: border-box;
  532. .content-r {
  533. display: flex;
  534. span {
  535. font-size: 14px;
  536. color: #fff;
  537. &:first-child {
  538. display: inline-block;
  539. width: 68px;
  540. }
  541. &:last-child {
  542. display: inline-block;
  543. width: calc(100% - 68px);
  544. }
  545. }
  546. .status-f {
  547. color: #ff0000;
  548. }
  549. .status-l {
  550. color: #3df6ff;
  551. }
  552. }
  553. }
  554. }
  555. }
  556. }
  557. }
  558. }
  559. </style>