ventilateWarn.vue 17 KB

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