1
0

ventilateWarn.vue 22 KB

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