ventilateWarn.vue 18 KB

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