ventilateWarn.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525
  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 } 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. </script>
  208. <style lang="less" scoped>
  209. .ventilateWarn {
  210. width: 100%;
  211. height: 100%;
  212. padding: 80px 10px 15px 10px;
  213. box-sizing: border-box;
  214. display: flex;
  215. justify-content: space-between;
  216. .alarm-menu {
  217. height: 100%;
  218. width: 15%;
  219. .card-btn {
  220. width: 100%;
  221. height: 100%;
  222. overflow-y: auto;
  223. .btn {
  224. position: relative;
  225. width: 81%;
  226. height: 14%;
  227. margin-bottom: 10%;
  228. font-family: 'douyuFont';
  229. background: url('../../../../../assets/images/fire/no-choice.png') no-repeat;
  230. background-size: 100% 100%;
  231. cursor: pointer;
  232. .text {
  233. width: 80%;
  234. position: absolute;
  235. left: 50%;
  236. top: 28px;
  237. font-size: 16px;
  238. color: #01fefc;
  239. text-align: center;
  240. transform: translate(-50%, 0);
  241. }
  242. .warn {
  243. width: 100%;
  244. position: absolute;
  245. left: 50%;
  246. bottom: 14px;
  247. font-size: 14px;
  248. color: #fff;
  249. text-align: center;
  250. transform: translate(-50%, 0);
  251. }
  252. }
  253. .btn1 {
  254. position: relative;
  255. width: 100%;
  256. height: 14%;
  257. margin-bottom: 10%;
  258. font-family: 'douyuFont';
  259. background: url('../../../../../assets/images/fire/choice.png') no-repeat;
  260. background-size: 100% 100%;
  261. cursor: pointer;
  262. .text {
  263. width: 80%;
  264. position: absolute;
  265. left: 50%;
  266. top: 28px;
  267. font-size: 16px;
  268. color: #01fefc;
  269. text-align: center;
  270. transform: translate(-62%, 0);
  271. }
  272. .warn {
  273. width: 100%;
  274. position: absolute;
  275. left: 50%;
  276. bottom: 14px;
  277. font-size: 14px;
  278. color: #fff;
  279. text-align: center;
  280. transform: translate(-60%, 0);
  281. }
  282. }
  283. }
  284. }
  285. .dustPage {
  286. width: calc(85% - 10px);
  287. height: 100%;
  288. margin-left: 10px;
  289. padding: 15px;
  290. background: url('../../../../../assets/images/fire/border.png') no-repeat;
  291. background-size: 100% 100%;
  292. box-sizing: border-box;
  293. .top-area {
  294. height: 24%;
  295. display: flex;
  296. justify-content: space-between;
  297. margin-bottom: 10px;
  298. .top-box {
  299. position: relative;
  300. width: 32%;
  301. height: 88%;
  302. background: url('../../../../../assets/images/fire/fc-t.png') no-repeat;
  303. background-size: 100% 100%;
  304. .top-title {
  305. position: absolute;
  306. left: 50%;
  307. top: 8px;
  308. font-size: 14px;
  309. color: #fff;
  310. transform: translate(-50%, 0);
  311. }
  312. .top-content {
  313. position: absolute;
  314. top: 20%;
  315. left: 0;
  316. width: 100%;
  317. height: 80%;
  318. display: flex;
  319. justify-content: flex-start;
  320. align-items: flex-start;
  321. flex-wrap: wrap;
  322. cursor: pointer;
  323. .content-item {
  324. position: relative;
  325. width: 50%;
  326. height: 50%;
  327. font-size: 14px;
  328. background: url('../../../../../assets/images/fire/content-item.png') no-repeat center;
  329. background-size: 82% 54%;
  330. .item-label {
  331. position: absolute;
  332. left: 16%;
  333. top: 50%;
  334. color: #fff;
  335. transform: translate(0, -44%);
  336. }
  337. .item-value {
  338. position: absolute;
  339. right: 16%;
  340. top: 50%;
  341. transform: translate(0, -38%);
  342. font-family: 'douyuFont';
  343. color: #3df6ff;
  344. }
  345. .item-value1 {
  346. position: absolute;
  347. right: 21%;
  348. top: 50%;
  349. transform: translate(0, -32%);
  350. font-size: 12px;
  351. font-family: 'douyuFont';
  352. color: rgb(145, 230, 9);
  353. }
  354. .item-value2 {
  355. position: absolute;
  356. right: 21%;
  357. top: 50%;
  358. transform: translate(0, -32%);
  359. font-size: 12px;
  360. font-family: 'douyuFont';
  361. color: rgb(0, 242, 255);
  362. }
  363. .item-value3 {
  364. position: absolute;
  365. right: 21%;
  366. top: 50%;
  367. transform: translate(0, -32%);
  368. font-size: 12px;
  369. font-family: 'douyuFont';
  370. color: #ffff35;
  371. }
  372. .item-value4 {
  373. position: absolute;
  374. right: 21%;
  375. top: 50%;
  376. transform: translate(0, -32%);
  377. font-size: 12px;
  378. font-family: 'douyuFont';
  379. color: #ffbe69;
  380. }
  381. .item-value5 {
  382. position: absolute;
  383. right: 21%;
  384. top: 50%;
  385. transform: translate(0, -32%);
  386. font-size: 12px;
  387. font-family: 'douyuFont';
  388. color: #ff6f00;
  389. }
  390. .item-value6 {
  391. position: absolute;
  392. right: 21%;
  393. top: 50%;
  394. transform: translate(0, -32%);
  395. font-size: 12px;
  396. font-family: 'douyuFont';
  397. color: #ff0000;
  398. }
  399. }
  400. }
  401. }
  402. }
  403. .center-area {
  404. height: 34%;
  405. margin-bottom: 20px;
  406. background: url('../../../../../assets/images/fire/bj1.png') no-repeat;
  407. background-size: 100% 100%;
  408. .center-t {
  409. height: 50%;
  410. display: flex;
  411. justify-content: space-around;
  412. align-items: center;
  413. background: url('../../../../../assets/images/fire/dz.png') no-repeat;
  414. background-size: 100% 100%;
  415. .t-box {
  416. width: 14%;
  417. height: 75%;
  418. background: url('../../../../../assets/images/fire/dz1.png') no-repeat;
  419. background-size: 100% 100%;
  420. .box-label {
  421. font-size: 16px;
  422. color: #06edcd;
  423. text-align: center;
  424. }
  425. }
  426. }
  427. .center-b {
  428. height: 50%;
  429. display: flex;
  430. justify-content: space-around;
  431. align-items: center;
  432. .b-box {
  433. width: 14%;
  434. height: 75%;
  435. display: flex;
  436. flex-direction: column;
  437. justify-content: center;
  438. align-items: center;
  439. .box-label {
  440. width: 78%;
  441. height: 44%;
  442. display: flex;
  443. justify-content: center;
  444. align-items: center;
  445. color: #3df6ff;
  446. font-family: 'douyuFont';
  447. background: url('../../../../../assets/images/fire/dz2.png') no-repeat;
  448. background-size: 100% 100%;
  449. }
  450. }
  451. }
  452. }
  453. .bot-area {
  454. height: calc(100% - 58% - 30px);
  455. padding: 10px 15px;
  456. background: url('../../../../../assets/images/fire/bj1.png') no-repeat;
  457. background-size: 100% 100%;
  458. box-sizing: border-box;
  459. .title-t {
  460. height: 30px;
  461. display: flex;
  462. justify-content: space-between;
  463. align-items: center;
  464. .text-t {
  465. font-family: 'douyuFont';
  466. font-size: 14px;
  467. color: #fff;
  468. }
  469. }
  470. .echart-boxd {
  471. width: 100%;
  472. height: calc(100% - 30px);
  473. }
  474. }
  475. }
  476. }
  477. </style>