ventilateWarn.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531
  1. <template>
  2. <customHeader :options="options" @change="getSelectRow" :optionValue="optionValue"> 通风监测预警 </customHeader>
  3. <div class="ventilateWarn">
  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="dustPage">
  16. <div class="top-area">
  17. <div class="top-box" v-for="(item, index) in topAreaList" :key="index">
  18. <div class="top-title">{{ item.title }}</div>
  19. <div class="top-content">
  20. <div class="content-item" v-for="(items, ind) in item.content" :key="ind">
  21. <span class="item-label">{{ items.label }}</span>
  22. <span :class="{
  23. 'item-value1': items.value == 0,
  24. 'item-value2': items.value == 101,
  25. 'item-value3': items.value == 102,
  26. 'item-value4': items.value == 103,
  27. 'item-value5': items.value == 104,
  28. 'item-value6': items.value == 201,
  29. 'item-value': items.value != 0 && items.value != 101 && items.value != 102 && items.value != 103 && items.value != 104 && items.value != 201,
  30. }">{{ items.value == 0 ? '正常' : items.value == 101 ? '较低风险' : items.value == 102 ? '低风险' :
  31. items.value ==
  32. 103 ?
  33. '中风险' : items.value == 104 ? '高风险' : items.value == 201 ? '报警' : items.value }}</span>
  34. </div>
  35. </div>
  36. </div>
  37. </div>
  38. <div class="center-area">
  39. <div class="center-t">
  40. <div class="t-box" v-for="(item, index) in centerAreaListT1" :key="index">
  41. <div class="box-label">{{ item.label }}</div>
  42. </div>
  43. </div>
  44. <div class="center-b">
  45. <div class="b-box" v-for="(item, index) in centerAreaListB1" :key="index">
  46. <div class="box-label">{{ item.content }}</div>
  47. </div>
  48. </div>
  49. </div>
  50. <div class="bot-area">
  51. <div class="title-t">
  52. <div class="text-t">通风信息状态监测</div>
  53. </div>
  54. <div class="echart-boxd">
  55. <echartLine :echartDataGq="echartDataFc1" :maxY="maxY" :echartDw="echartDw" />
  56. </div>
  57. </div>
  58. </div>
  59. </div>
  60. </template>
  61. <script lang="ts" setup>
  62. import { ref, reactive, onMounted, onUnmounted } from 'vue';
  63. import { sysTypeWarnList, sysWarn } from '../common.api'
  64. import { centerAreaListT1, centerAreaListB1 } from '../common.data';
  65. import { useSystemSelect } from '/@/hooks/vent/useSystemSelect';
  66. import { useRouter } from 'vue-router';
  67. import echartLine from '../common/echartLine.vue';
  68. import CustomHeader from '/@/components/vent/customHeader.vue';
  69. const { options, optionValue, getSelectRow, getSysDataSource } = useSystemSelect('sys_surface_caimei'); // 参数为场景类型(设备类型管理中可以查询到)
  70. //左侧数据列表
  71. let menuList = reactive<any[]>([])
  72. //当前左侧激活菜单的索引
  73. let activeIndex1 = ref(0);
  74. let maxY = ref(0)
  75. let echartDw = ref('(m³/min)')
  76. //报警区域数据
  77. let topAreaList = reactive<any[]>([]);
  78. //通风图表数据
  79. const echartDataFc1 = reactive({
  80. maxData: {
  81. lengedData: '进风量',
  82. data: []
  83. },
  84. minData: {
  85. lengedData: '回风量',
  86. data: []
  87. },
  88. aveValue: {
  89. lengedData: '需风量',
  90. data: []
  91. },
  92. xData: [],
  93. });
  94. let router = useRouter()
  95. // https获取监测数据
  96. let timer: null | NodeJS.Timeout = null;
  97. function getMonitor(deviceID, flag?) {
  98. timer = setTimeout(
  99. async () => {
  100. await getSysWarnList(deviceID, 'vent');
  101. if (timer) {
  102. timer = null;
  103. }
  104. getMonitor(deviceID);
  105. },
  106. flag ? 0 : 1000
  107. );
  108. }
  109. //返回首页
  110. function getBack() {
  111. router.push('/monitorChannel/monitor-alarm-home')
  112. }
  113. //菜单选项切换
  114. function cardClick(ind, item) {
  115. activeIndex1.value = ind;
  116. clearTimeout(timer);
  117. getMonitor(item.deviceID, true);
  118. }
  119. //获取左侧数据列表
  120. async function getMenuList() {
  121. let res = await sysTypeWarnList({ type: 'vent' })
  122. console.log(res, '通风预警监测左侧列表数据-------------')
  123. if (res.length != 0) {
  124. menuList.length = 0
  125. res.forEach((el) => {
  126. menuList.push({
  127. name: el.deviceName,
  128. warn: '低风险',
  129. deviceID: el.deviceID,
  130. strtype: el.deviceType,
  131. });
  132. });
  133. getMonitor(menuList[0].deviceID, true);
  134. }
  135. }
  136. function formatRoundNum(num) {
  137. let interger = Math.ceil(num)
  138. let leng = String(interger).length
  139. return Math.ceil(interger / Math.pow(10, leng - 1)) * Math.pow(10, leng - 1)
  140. }
  141. //获取预警详情弹窗右侧数据
  142. function getSysWarnList(id, type) {
  143. sysWarn({ sysid: id, type: type }).then((res) => {
  144. echartDataFc1.maxData.data.length = 0;
  145. echartDataFc1.minData.data.length = 0;
  146. echartDataFc1.aveValue.data.length = 0;
  147. echartDataFc1.xData.length = 0;
  148. topAreaList.length = 0;
  149. if (JSON.stringify(res) != '{}') {
  150. if (res.warnDevices.length != 0) {
  151. res.warnDevices.forEach((el) => {
  152. topAreaList.push({
  153. title: el.typeName,
  154. content: [
  155. { ids: 0, label: '设备类型', value: '工作面风量' },
  156. {
  157. ids: 1,
  158. label: '报警等级',
  159. value: el.datalist[0].warnLevel || 0,
  160. },
  161. { ids: 2, label: '报警描述', value: el.datalist[0].warnDes || '--' },
  162. ],
  163. });
  164. });
  165. } else {
  166. topAreaList.push({
  167. title: '工作面',
  168. content: [
  169. { ids: 0, label: '设备类型', value: '工作面风量' },
  170. {
  171. ids: 1,
  172. label: '报警等级',
  173. value: res.warnLevel || '正常',
  174. },
  175. { ids: 2, label: '报警描述', value: '--' },
  176. ],
  177. });
  178. }
  179. centerAreaListB1[0].content = res.jin || '--';
  180. centerAreaListB1[1].content = res.hui || '--';
  181. centerAreaListB1[2].content = res.xufengliang || '--';
  182. if (res.history.length != 0) {
  183. res.history.forEach((v) => {
  184. echartDataFc1.maxData.data.push(parseFloat(v.jin));
  185. echartDataFc1.minData.data.push(parseFloat(v.hui));
  186. if (centerAreaListB1[2].content && centerAreaListB1[2].content != '--') {
  187. echartDataFc1.aveValue.data.push(centerAreaListB1[2].content);
  188. } else {
  189. echartDataFc1.aveValue.data.push(0);
  190. }
  191. echartDataFc1.xData.push(v.time);
  192. });
  193. }
  194. let max1 = echartDataFc1.maxData.data.reduce((acr, cur) => {
  195. return acr > cur ? acr : cur
  196. })
  197. let max2 = echartDataFc1.minData.data.reduce((acr1, cur1) => {
  198. return acr1 > cur1 ? acr1 : cur1
  199. })
  200. maxY.value = max1 >= max2 ? formatRoundNum(max1 * 2) : formatRoundNum(max2 * 2)
  201. }
  202. });
  203. }
  204. onMounted(() => {
  205. getMenuList()
  206. })
  207. onUnmounted(() => {
  208. if (timer) {
  209. clearTimeout(timer);
  210. timer = undefined;
  211. }
  212. });
  213. </script>
  214. <style lang="less" scoped>
  215. .ventilateWarn {
  216. width: 100%;
  217. height: 100%;
  218. padding: 80px 10px 15px 10px;
  219. box-sizing: border-box;
  220. display: flex;
  221. justify-content: space-between;
  222. .alarm-menu {
  223. height: 100%;
  224. width: 15%;
  225. .card-btn {
  226. width: 100%;
  227. height: 100%;
  228. overflow-y: auto;
  229. .btn {
  230. position: relative;
  231. width: 81%;
  232. height: 14%;
  233. margin-bottom: 10%;
  234. font-family: 'douyuFont';
  235. background: url('../../../../../assets/images/fire/no-choice.png') no-repeat;
  236. background-size: 100% 100%;
  237. cursor: pointer;
  238. .text {
  239. width: 80%;
  240. position: absolute;
  241. left: 50%;
  242. top: 28px;
  243. font-size: 16px;
  244. color: #01fefc;
  245. text-align: center;
  246. transform: translate(-50%, 0);
  247. }
  248. .warn {
  249. width: 100%;
  250. position: absolute;
  251. left: 50%;
  252. bottom: 14px;
  253. font-size: 14px;
  254. color: #fff;
  255. text-align: center;
  256. transform: translate(-50%, 0);
  257. }
  258. }
  259. .btn1 {
  260. position: relative;
  261. width: 100%;
  262. height: 14%;
  263. margin-bottom: 10%;
  264. font-family: 'douyuFont';
  265. background: url('../../../../../assets/images/fire/choice.png') no-repeat;
  266. background-size: 100% 100%;
  267. cursor: pointer;
  268. .text {
  269. width: 80%;
  270. position: absolute;
  271. left: 50%;
  272. top: 28px;
  273. font-size: 16px;
  274. color: #01fefc;
  275. text-align: center;
  276. transform: translate(-62%, 0);
  277. }
  278. .warn {
  279. width: 100%;
  280. position: absolute;
  281. left: 50%;
  282. bottom: 14px;
  283. font-size: 14px;
  284. color: #fff;
  285. text-align: center;
  286. transform: translate(-60%, 0);
  287. }
  288. }
  289. }
  290. }
  291. .dustPage {
  292. width: calc(85% - 10px);
  293. height: 100%;
  294. margin-left: 10px;
  295. padding: 15px;
  296. background: url('../../../../../assets/images/fire/border.png') no-repeat;
  297. background-size: 100% 100%;
  298. box-sizing: border-box;
  299. .top-area {
  300. height: 24%;
  301. display: flex;
  302. justify-content: space-between;
  303. margin-bottom: 10px;
  304. .top-box {
  305. position: relative;
  306. width: 32%;
  307. height: 88%;
  308. background: url('../../../../../assets/images/fire/fc-t.png') no-repeat;
  309. background-size: 100% 100%;
  310. .top-title {
  311. position: absolute;
  312. left: 50%;
  313. top: 8px;
  314. font-size: 14px;
  315. color: #fff;
  316. transform: translate(-50%, 0);
  317. }
  318. .top-content {
  319. position: absolute;
  320. top: 20%;
  321. left: 0;
  322. width: 100%;
  323. height: 80%;
  324. display: flex;
  325. justify-content: flex-start;
  326. align-items: flex-start;
  327. flex-wrap: wrap;
  328. cursor: pointer;
  329. .content-item {
  330. position: relative;
  331. width: 50%;
  332. height: 50%;
  333. font-size: 14px;
  334. background: url('../../../../../assets/images/fire/content-item.png') no-repeat center;
  335. background-size: 82% 54%;
  336. .item-label {
  337. position: absolute;
  338. left: 16%;
  339. top: 50%;
  340. color: #fff;
  341. transform: translate(0, -44%);
  342. }
  343. .item-value {
  344. position: absolute;
  345. right: 16%;
  346. top: 50%;
  347. transform: translate(0, -38%);
  348. font-family: 'douyuFont';
  349. color: #3df6ff;
  350. }
  351. .item-value1 {
  352. position: absolute;
  353. right: 21%;
  354. top: 50%;
  355. transform: translate(0, -32%);
  356. font-size: 12px;
  357. font-family: 'douyuFont';
  358. color: rgb(145, 230, 9);
  359. }
  360. .item-value2 {
  361. position: absolute;
  362. right: 21%;
  363. top: 50%;
  364. transform: translate(0, -32%);
  365. font-size: 12px;
  366. font-family: 'douyuFont';
  367. color: rgb(0, 242, 255);
  368. }
  369. .item-value3 {
  370. position: absolute;
  371. right: 21%;
  372. top: 50%;
  373. transform: translate(0, -32%);
  374. font-size: 12px;
  375. font-family: 'douyuFont';
  376. color: #ffff35;
  377. }
  378. .item-value4 {
  379. position: absolute;
  380. right: 21%;
  381. top: 50%;
  382. transform: translate(0, -32%);
  383. font-size: 12px;
  384. font-family: 'douyuFont';
  385. color: #ffbe69;
  386. }
  387. .item-value5 {
  388. position: absolute;
  389. right: 21%;
  390. top: 50%;
  391. transform: translate(0, -32%);
  392. font-size: 12px;
  393. font-family: 'douyuFont';
  394. color: #ff6f00;
  395. }
  396. .item-value6 {
  397. position: absolute;
  398. right: 21%;
  399. top: 50%;
  400. transform: translate(0, -32%);
  401. font-size: 12px;
  402. font-family: 'douyuFont';
  403. color: #ff0000;
  404. }
  405. }
  406. }
  407. }
  408. }
  409. .center-area {
  410. height: 34%;
  411. margin-bottom: 20px;
  412. background: url('../../../../../assets/images/fire/bj1.png') no-repeat;
  413. background-size: 100% 100%;
  414. .center-t {
  415. height: 50%;
  416. display: flex;
  417. justify-content: space-around;
  418. align-items: center;
  419. background: url('../../../../../assets/images/fire/dz.png') no-repeat;
  420. background-size: 100% 100%;
  421. .t-box {
  422. width: 14%;
  423. height: 75%;
  424. background: url('../../../../../assets/images/fire/dz1.png') no-repeat;
  425. background-size: 100% 100%;
  426. .box-label {
  427. font-size: 16px;
  428. color: #06edcd;
  429. text-align: center;
  430. }
  431. }
  432. }
  433. .center-b {
  434. height: 50%;
  435. display: flex;
  436. justify-content: space-around;
  437. align-items: center;
  438. .b-box {
  439. width: 14%;
  440. height: 75%;
  441. display: flex;
  442. flex-direction: column;
  443. justify-content: center;
  444. align-items: center;
  445. .box-label {
  446. width: 78%;
  447. height: 44%;
  448. display: flex;
  449. justify-content: center;
  450. align-items: center;
  451. color: #3df6ff;
  452. font-family: 'douyuFont';
  453. background: url('../../../../../assets/images/fire/dz2.png') no-repeat;
  454. background-size: 100% 100%;
  455. }
  456. }
  457. }
  458. }
  459. .bot-area {
  460. height: calc(100% - 58% - 30px);
  461. padding: 10px 15px;
  462. background: url('../../../../../assets/images/fire/bj1.png') no-repeat;
  463. background-size: 100% 100%;
  464. box-sizing: border-box;
  465. .title-t {
  466. height: 30px;
  467. display: flex;
  468. justify-content: space-between;
  469. align-items: center;
  470. .text-t {
  471. font-family: 'douyuFont';
  472. font-size: 14px;
  473. color: #fff;
  474. }
  475. }
  476. .echart-boxd {
  477. width: 100%;
  478. height: calc(100% - 30px);
  479. }
  480. }
  481. }
  482. }
  483. </style>