gasWarn.vue 25 KB

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