ventilateWarn.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570
  1. <template>
  2. <customHeader :options="options" @change="getSelectRow" :optionValue="optionValue"> 通风监测预警 </customHeader>
  3. <div class="ventilateWarn">
  4. <div v-if="showToggle == 'all'" class="icon-toggle" @click="handlerToggle">
  5. <img v-if="!monitor" src="@/assets/images/vent/monitor-toggle.png" alt="" />
  6. <img v-else src="@/assets/images/vent/report-toggle.png" alt="" />
  7. </div>
  8. <div class="ventilate-top">
  9. <a-button v-if="!hasPermission('ventilateWarn:return')" preIcon="ant-design:rollback-outlined" type="text"
  10. size="small" style="position: absolute; left: 15px; top: 15px; color: var(--vent-font-color)" @click="getBack">
  11. 返回
  12. </a-button>
  13. <div class="alarm-menu">
  14. <div class="type-btn">
  15. <div :class="activeIndex == index ? 'btn1' : 'btn'" v-for="(item, index) in typeMenuListTf" :key="index"
  16. @click="btnClick(index)">
  17. {{ item.name }}
  18. </div>
  19. </div>
  20. <div class="card-btn">
  21. <div style="width: 100%; height: 100%" v-if="menuList.length">
  22. <div :class="activeIndex1 == ind ? 'btn1' : 'btn'" v-for="(item, ind) in menuList" :key="ind"
  23. @click="cardClick(ind, item)">
  24. <div class="text">{{ item.name }}</div>
  25. <div class="warn">{{ item.warn }}</div>
  26. </div>
  27. </div>
  28. <div v-else class="hd-content">
  29. <div class="hd-content-text">巷道阻变型故障预警分析</div>
  30. <div class="hd-content-val">{{ hdData.maxLevel }}</div>
  31. </div>
  32. </div>
  33. </div>
  34. <div class="ventilate-content">
  35. <a-spin :spinning="loading">
  36. <TopArea :activeIndex="activeIndex" :statusData="ventilateTopList" :echartData="echartDataFc1"
  37. :ventTunDataSource="ventTunDataSource" :maxY="maxY" :minY="minY"></TopArea>
  38. </a-spin>
  39. </div>
  40. </div>
  41. <div class="ventilate-bottom">
  42. <div class="bot-area">
  43. <MeasurePoint title="通风监控测点信息" :timeout="1000" :cards="cardListTf" :charts="chartListTf" chartWidth="420px" />
  44. </div>
  45. </div>
  46. </div>
  47. </template>
  48. <script setup lang="ts">
  49. import { ref, reactive, onMounted, onUnmounted, computed } from 'vue';
  50. import { useSystemSelect } from '/@/hooks/vent/useSystemSelect';
  51. import { usePermission } from '/@/hooks/web/usePermission';
  52. import { useGlobSetting } from '/@/hooks/setting';
  53. import { useRouter } from 'vue-router';
  54. import { sysTypeWarnList, sysWarn, getDevice } from '../common.api';
  55. import { ventilateTopList, typeMenuListTf, getMaxY, getMinY } from '../common.data';
  56. import CustomHeader from '/@/components/vent/customHeader.vue';
  57. import MeasurePoint from '../common/measurePoint.vue';
  58. import { realTimeNetCal, modalParam } from '../alarm.api';
  59. import TopArea from '../common/top-area.vue';
  60. //巷道阻力分析数据
  61. let hdData = reactive({
  62. maxLevel: '',
  63. address: '',
  64. });
  65. //通风选项激活索引
  66. let activeIndex = ref(0);
  67. let monitor = ref(true);
  68. let toggleData = reactive<any>({});
  69. const { hasPermission } = usePermission();
  70. const { options, optionValue, getSelectRow, getSysDataSource } = useSystemSelect('sys_surface_caimei'); // 参数为场景类型(设备类型管理中可以查询到)
  71. let router = useRouter();
  72. //左侧数据列表
  73. let menuList = reactive<any[]>([]);
  74. const ventTunDataSource = ref([]);
  75. //当前左侧激活菜单的索引
  76. let activeIndex1 = ref(0);
  77. let maxY = ref<any>(0);
  78. let minY = ref<any>(0)
  79. const loading = ref(false);
  80. //通风图表数据
  81. const echartDataFc1 = reactive<any>({
  82. maxData: {
  83. lengedData: '进风量',
  84. data: [],
  85. },
  86. minData: {
  87. lengedData: '回风量',
  88. data: [],
  89. },
  90. aveValue: {
  91. lengedData: '需风量',
  92. data: [],
  93. },
  94. xData: [],
  95. });
  96. let cardListTf = ref<any[]>([]);
  97. const chartListTf = ref<any[]>([]);
  98. let showToggle = ref('report');
  99. // https获取监测数据
  100. let timer: null | NodeJS.Timeout = null;
  101. function getMonitor(flag?) {
  102. timer = setTimeout(
  103. async () => {
  104. //获取左侧菜单数据
  105. await getMenuList();
  106. await getWindDeviceList();
  107. getMonitor(false);
  108. },
  109. flag ? 0 : 1000
  110. );
  111. }
  112. //获取巷道阻力分析数据
  113. let timer1: null | NodeJS.Timeout = null;
  114. function getMonitor1(flag?) {
  115. timer1 = setTimeout(
  116. async () => {
  117. await getRealTimeNetData();
  118. getMonitor1(false);
  119. },
  120. flag ? 0 : 30000
  121. );
  122. }
  123. //返回首页
  124. function getBack() {
  125. router.push('/monitorChannel/monitor-alarm-home');
  126. }
  127. //点击切换实时\报表数据
  128. let handlerToggle = () => {
  129. monitor.value = !monitor.value;
  130. echartDataFc1.maxData.data.length = 0;
  131. echartDataFc1.minData.data.length = 0;
  132. echartDataFc1.aveValue.data.length = 0;
  133. echartDataFc1.xData.length = 0;
  134. getData()
  135. };
  136. //实时报表数据
  137. function getData(){
  138. ventilateTopList[0].value = monitor.value ? toggleData.faceIntM3 : toggleData.jin;
  139. ventilateTopList[1].value = monitor.value ? toggleData.faceRetM3 : toggleData.hui;
  140. if (monitor.value) {
  141. toggleData.history_report.forEach((v) => {
  142. echartDataFc1.maxData.data.push(parseFloat(v.faceIntM3));
  143. echartDataFc1.minData.data.push(parseFloat(v.faceRetM3));
  144. echartDataFc1.aveValue.data.push(0);
  145. echartDataFc1.xData.push(v.time);
  146. });
  147. } else {
  148. toggleData.history.forEach((v) => {
  149. echartDataFc1.maxData.data.push(parseFloat(v.jin));
  150. echartDataFc1.minData.data.push(parseFloat(v.hui));
  151. if (ventilateTopList[2].value && ventilateTopList[2].value != '--') {
  152. echartDataFc1.aveValue.data.push(ventilateTopList[2].value);
  153. } else {
  154. echartDataFc1.aveValue.data.push(0);
  155. }
  156. echartDataFc1.xData.push(v.time);
  157. });
  158. }
  159. }
  160. //获取左侧数据列表
  161. async function getMenuList() {
  162. let res = await sysTypeWarnList({ type: 'vent' });
  163. if (res.length != 0) {
  164. menuList.length = 0;
  165. res.forEach((el) => {
  166. menuList.push({
  167. name: el.deviceName,
  168. warn: el.warnDes.indexOf('预警') != -1 ? '风量不足' : el.warnDes,
  169. deviceID: el.deviceID,
  170. strtype: el.deviceType,
  171. detail: el.detail
  172. });
  173. });
  174. //获取右侧详情数据
  175. getDetailList(menuList[activeIndex1.value].detail)
  176. }
  177. }
  178. //获取右侧详情数据
  179. function getDetailList(param) {
  180. echartDataFc1.maxData.data.length = 0;
  181. echartDataFc1.minData.data.length = 0;
  182. echartDataFc1.aveValue.data.length = 0;
  183. echartDataFc1.xData.length = 0;
  184. if (JSON.stringify(param) != '{}') {
  185. toggleData = Object.assign({}, param);
  186. ventilateTopList[2].value = param.xufengliang || '--';
  187. ventilateTopList[3].text = param.warnFlag ? param.warnDes : '正常';
  188. if (showToggle.value == 'monitor') {
  189. ventilateTopList[0].value = param.jin;
  190. ventilateTopList[1].value = param.hui;
  191. if (param.history.length != 0) {
  192. param.history.forEach((v) => {
  193. echartDataFc1.maxData.data.push(parseFloat(v.jin));
  194. echartDataFc1.minData.data.push(parseFloat(v.hui));
  195. if (ventilateTopList[2].value && ventilateTopList[2].value != '--') {
  196. echartDataFc1.aveValue.data.push(ventilateTopList[2].value);
  197. } else {
  198. echartDataFc1.aveValue.data.push(0);
  199. }
  200. echartDataFc1.xData.push(v.time);
  201. });
  202. }
  203. } else if (showToggle.value == 'report') {
  204. ventilateTopList[0].value = param.faceIntM3;
  205. ventilateTopList[1].value = param.faceRetM3;
  206. param.history_report.forEach((v) => {
  207. echartDataFc1.maxData.data.push(parseFloat(v.faceIntM3));
  208. echartDataFc1.minData.data.push(parseFloat(v.faceRetM3));
  209. echartDataFc1.aveValue.data.push(0);
  210. echartDataFc1.xData.push(v.time);
  211. });
  212. } else {
  213. getData()
  214. }
  215. let echartD = [echartDataFc1.maxData.data, echartDataFc1.minData.data]
  216. maxY.value = getMaxY(echartD)
  217. minY.value = getMinY(echartD)
  218. }
  219. }
  220. //通风选项切换
  221. function btnClick(ind) {
  222. activeIndex.value = ind;
  223. switch (ind) {
  224. case 0:
  225. if (timer1) clearTimeout(timer1);
  226. activeIndex1.value = 0;
  227. getMenuList();
  228. break;
  229. case 1:
  230. if (timer) clearTimeout(timer);
  231. activeIndex1.value = 0;
  232. menuList.length = 0;
  233. getRealTimeNetData();
  234. getMonitor1();
  235. break;
  236. }
  237. }
  238. //菜单选项切换
  239. function cardClick(ind, item) {
  240. if (!activeIndex.value) {
  241. clearTimeout(timer);
  242. activeIndex1.value = ind;
  243. loading.value = true;
  244. setTimeout(() => {
  245. getMonitor(true);
  246. loading.value = false;
  247. }, 1000);
  248. } else {
  249. return;
  250. }
  251. }
  252. //获取通风监控测点信息
  253. async function getWindDeviceList() {
  254. const cardTfList: any[] = [];
  255. const chartTfList: any[] = [];
  256. let res = await getDevice({ devicetype: 'windrect', pagetype: 'normal' });
  257. if (res && res.msgTxt[0]) {
  258. let list = res.msgTxt[0].datalist || [];
  259. if (list.length > 0) {
  260. list.forEach((el: any) => {
  261. const readData = el.readData;
  262. el = Object.assign(el, readData);
  263. cardTfList.push({
  264. label: '通信状态',
  265. value: el.netStatus == '0' ? '断开' : '连接',
  266. listR: [
  267. { id: 0, label: '安装位置', dw: '', value: el.strinstallpos },
  268. { id: 1, label: '风量', dw: 'm³/min', value: el.m3 || '--' },
  269. { id: 2, label: '风速', dw: 'm/s', value: el.va || '--' },
  270. { id: 4, label: '时间', dw: '', value: el.readTime },
  271. {
  272. id: 3,
  273. label: '是否报警',
  274. dw: '',
  275. value: el.warnFlag == '0' ? '正常' : el.warnFlag == 1 ? '报警' : el.warnFlag == 2 ? '断开' : '未监测',
  276. },
  277. ],
  278. });
  279. // 初始化预测曲线配置,分别为x轴时间、平均、最大、最小、实时
  280. const avgParam = el.avgParam || {
  281. avg_vent_value: 0,
  282. max_vent_value: 0,
  283. min_vent_value: 0,
  284. };
  285. chartTfList.push({
  286. label: el.strinstallpos,
  287. time: new Date(),
  288. data: [avgParam.avg_m3_value, avgParam.max_m3_value, avgParam.min_m3_value, el.readData.m3],
  289. });
  290. });
  291. }
  292. cardListTf.value = cardTfList;
  293. chartListTf.value = chartTfList;
  294. }
  295. }
  296. async function getRealTimeNetData() {
  297. const modalData = await modalParam({});
  298. if (modalData && modalData.param && modalData.param.records.length && modalData.param.records.length > 0) {
  299. const res = await realTimeNetCal({ modelID: modalData.param.records[0]['defaultmodelid'] });
  300. if (res && res['result']) ventTunDataSource.value = res['result']['tuns'];
  301. let data = [];
  302. ventTunDataSource.value.forEach((el) => {
  303. if (el['dHTotal'] && el['oldHTotal']) {
  304. el['leveld'] = ((el['dHTotal'] - el['oldHTotal']) / el['oldHTotal']) * 100;
  305. data.push(el['leveld']);
  306. } else {
  307. data = [];
  308. }
  309. });
  310. hdData.maxLevel = '正常';
  311. }
  312. }
  313. onMounted(async () => {
  314. const { sysOrgCode, sysDataType } = useGlobSetting();
  315. showToggle.value = sysDataType || 'report';
  316. await getMenuList();
  317. await getMonitor();
  318. });
  319. onUnmounted(() => {
  320. if (timer) {
  321. clearTimeout(timer);
  322. timer = undefined;
  323. }
  324. if (timer1) {
  325. clearTimeout(timer1);
  326. timer1 = undefined;
  327. }
  328. });
  329. </script>
  330. <style lang="less" scoped>
  331. @import '/@/design/theme.less';
  332. @{theme-deepblue} {
  333. .ventilateWarn {
  334. --image-border: url('/@/assets/images/themify/deepblue/fire/border.png');
  335. --image-no-choice: url('/@/assets/images/themify/deepblue/fire/no-choice.png');
  336. --image-choice: url('/@/assets/images/themify/deepblue/fire/choice.png');
  337. --image-bj1: url('/@/assets/images/themify/deepblue/fire/bj1.png');
  338. --image-jinfengliang: url('/@/assets/images/themify/deepblue/fire/jinfengliang.png');
  339. --image-huifengliang: url('/@/assets/images/themify/deepblue/fire/huifengliang.png');
  340. --image-xufengliang: url('/@/assets/images/themify/deepblue/fire/xufengliang.png');
  341. }
  342. }
  343. .ventilateWarn {
  344. --image-border: url('/@/assets/images/fire/border.png');
  345. --image-no-choice: url('/@/assets/images/fire/no-choice.png');
  346. --image-choice: url('/@/assets/images/fire/choice.png');
  347. --image-bj1: url('/@/assets/images/fire/bj1.png');
  348. --image-jinfengliang: url('/@/assets/images/fire/jinfengliang.png');
  349. --image-huifengliang: url('/@/assets/images/fire/huifengliang.png');
  350. --image-xufengliang: url('/@/assets/images/fire/xufengliang.png');
  351. --border-image-1: linear-gradient(to bottom, #2d74a0, #2d74a0, #2d74a0);
  352. --border-image-2: linear-gradient(to bottom, transparent, #024688, transparent);
  353. position: reactive;
  354. width: 100%;
  355. height: 100%;
  356. padding: 80px 10px 15px 10px;
  357. box-sizing: border-box;
  358. .ventilate-top {
  359. width: 100%;
  360. display: flex;
  361. justify-content: space-between;
  362. height: 50%;
  363. margin-bottom: 15px;
  364. background: var(--image-border) no-repeat center;
  365. background-size: 100% 100%;
  366. padding-right: 15px;
  367. .alarm-menu {
  368. height: 100%;
  369. width: 332px;
  370. padding: 10px;
  371. box-sizing: border-box;
  372. .type-btn {
  373. width: 100%;
  374. height: 28px;
  375. line-height: 28px;
  376. background-color: var(--vent-warn-tab-bg);
  377. border: 2px solid var(--vent-warn-tab-border);
  378. margin-bottom: 20px;
  379. border-radius: 5px;
  380. box-sizing: border-box;
  381. display: flex;
  382. justify-content: space-between;
  383. .btn {
  384. width: 50%;
  385. height: 24px;
  386. line-height: 24px;
  387. font-size: 14px;
  388. text-align: center;
  389. color: var(--vent-font-color);
  390. cursor: pointer;
  391. }
  392. .btn1 {
  393. width: 50%;
  394. height: 24px;
  395. line-height: 24px;
  396. font-size: 14px;
  397. color: var(--vent-font-color);
  398. text-align: center;
  399. border-radius: 2px;
  400. background: var(--vent-warn-tab-bg-actived);
  401. cursor: pointer;
  402. }
  403. }
  404. .card-btn {
  405. width: 100%;
  406. height: calc(100% - 50px);
  407. overflow-y: auto;
  408. .btn {
  409. position: relative;
  410. width: 81%;
  411. height: 24%;
  412. margin-bottom: 6%;
  413. font-family: 'douyuFont';
  414. background: var(--image-no-choice) no-repeat;
  415. background-size: 100% 100%;
  416. cursor: pointer;
  417. .text {
  418. width: 80%;
  419. position: absolute;
  420. left: 50%;
  421. top: 28px;
  422. font-size: 14px;
  423. color: var(--vent-table-action-link);
  424. text-align: center;
  425. transform: translate(-50%, 0);
  426. }
  427. .warn {
  428. width: 100%;
  429. position: absolute;
  430. left: 50%;
  431. bottom: 8px;
  432. font-size: 12px;
  433. color: var(--vent-font-color);
  434. text-align: center;
  435. transform: translate(-50%, 0);
  436. }
  437. }
  438. .btn1 {
  439. position: relative;
  440. width: 100%;
  441. height: 24%;
  442. margin-bottom: 6%;
  443. font-family: 'douyuFont';
  444. background: var(--image-choice) no-repeat;
  445. background-size: 100% 100%;
  446. cursor: pointer;
  447. .text {
  448. width: 80%;
  449. position: absolute;
  450. left: 50%;
  451. top: 28px;
  452. font-size: 14px;
  453. color: var(--vent-table-action-link);
  454. text-align: center;
  455. transform: translate(-62%, 0);
  456. }
  457. .warn {
  458. width: 100%;
  459. position: absolute;
  460. left: 50%;
  461. bottom: 8px;
  462. font-size: 14px;
  463. color: var(--vent-font-color);
  464. text-align: center;
  465. transform: translate(-60%, 0);
  466. }
  467. }
  468. .hd-content {
  469. position: relative;
  470. width: 100%;
  471. height: 300px;
  472. padding: 0 20px;
  473. background: var(--image-no-choice) no-repeat;
  474. background-size: 100% 100%;
  475. .hd-content-text {
  476. display: flex;
  477. width: 100%;
  478. height: 200px;
  479. align-items: center;
  480. justify-content: center;
  481. font-size: 18px;
  482. color: var(--vent-font-yellow-color);
  483. }
  484. .hd-content-val {
  485. position: absolute;
  486. width: calc(100% - 40px);
  487. display: flex;
  488. justify-content: center;
  489. font-family: 'douyuFont';
  490. bottom: 80px;
  491. font-size: 20px;
  492. color: var(--vent-table-action-link);
  493. }
  494. }
  495. }
  496. }
  497. .ventilate-content {
  498. height: 100%;
  499. width: calc(100% - 332px);
  500. padding: 10px 0px;
  501. box-sizing: border-box;
  502. margin-right: 10px;
  503. }
  504. }
  505. .tun-box {
  506. width: 600px;
  507. height: 300px;
  508. }
  509. .ventilate-bottom {
  510. height: calc(50% - 15px);
  511. background: var(--image-border) no-repeat center;
  512. background-size: 100% 100%;
  513. padding: 10px;
  514. box-sizing: border-box;
  515. .bot-area {
  516. height: 100%;
  517. padding: 10px;
  518. background: var(--image-bj1) no-repeat center;
  519. background-size: 100% 100%;
  520. box-sizing: border-box;
  521. }
  522. }
  523. .icon-toggle {
  524. position: absolute;
  525. right: 220px;
  526. top: 17px;
  527. img {
  528. width: 26px;
  529. height: 26px;
  530. cursor: pointer;
  531. }
  532. }
  533. }
  534. </style>