ventilateWarn.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568
  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 : 2000
  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. clearTimeout(timer);
  241. if (!activeIndex.value && !loading.value) {
  242. activeIndex1.value = ind;
  243. loading.value = true;
  244. setTimeout(() => {
  245. getMonitor();
  246. loading.value = false;
  247. }, 2000);
  248. }
  249. }
  250. //获取通风监控测点信息
  251. async function getWindDeviceList() {
  252. const cardTfList: any[] = [];
  253. const chartTfList: any[] = [];
  254. let res = await getDevice({ devicetype: 'windrect', pagetype: 'normal' });
  255. if (res && res.msgTxt[0]) {
  256. let list = res.msgTxt[0].datalist || [];
  257. if (list.length > 0) {
  258. list.forEach((el: any) => {
  259. const readData = el.readData;
  260. el = Object.assign(el, readData);
  261. cardTfList.push({
  262. label: '通信状态',
  263. value: el.netStatus == '0' ? '断开' : '连接',
  264. listR: [
  265. { id: 0, label: '安装位置', dw: '', value: el.strinstallpos },
  266. { id: 1, label: '风量', dw: 'm³/min', value: el.m3 || '--' },
  267. { id: 2, label: '风速', dw: 'm/s', value: el.va || '--' },
  268. { id: 4, label: '时间', dw: '', value: el.readTime },
  269. {
  270. id: 3,
  271. label: '是否报警',
  272. dw: '',
  273. value: el.warnFlag == '0' ? '正常' : el.warnFlag == 1 ? '报警' : el.warnFlag == 2 ? '断开' : '未监测',
  274. },
  275. ],
  276. });
  277. // 初始化预测曲线配置,分别为x轴时间、平均、最大、最小、实时
  278. const avgParam = el.avgParam || {
  279. avg_vent_value: 0,
  280. max_vent_value: 0,
  281. min_vent_value: 0,
  282. };
  283. chartTfList.push({
  284. label: el.strinstallpos,
  285. time: new Date(),
  286. data: [avgParam.avg_m3_value, avgParam.max_m3_value, avgParam.min_m3_value, el.readData.m3],
  287. });
  288. });
  289. }
  290. cardListTf.value = cardTfList;
  291. chartListTf.value = chartTfList;
  292. }
  293. }
  294. async function getRealTimeNetData() {
  295. const modalData = await modalParam({});
  296. if (modalData && modalData.param && modalData.param.records.length && modalData.param.records.length > 0) {
  297. const res = await realTimeNetCal({ modelID: modalData.param.records[0]['defaultmodelid'] });
  298. if (res && res['result']) ventTunDataSource.value = res['result']['tuns'];
  299. let data = [];
  300. ventTunDataSource.value.forEach((el) => {
  301. if (el['dHTotal'] && el['oldHTotal']) {
  302. el['leveld'] = ((el['dHTotal'] - el['oldHTotal']) / el['oldHTotal']) * 100;
  303. data.push(el['leveld']);
  304. } else {
  305. data = [];
  306. }
  307. });
  308. hdData.maxLevel = '正常';
  309. }
  310. }
  311. onMounted(async () => {
  312. const { sysOrgCode, sysDataType } = useGlobSetting();
  313. showToggle.value = sysDataType || 'report';
  314. await getMenuList();
  315. await getMonitor();
  316. });
  317. onUnmounted(() => {
  318. if (timer) {
  319. clearTimeout(timer);
  320. timer = undefined;
  321. }
  322. if (timer1) {
  323. clearTimeout(timer1);
  324. timer1 = undefined;
  325. }
  326. });
  327. </script>
  328. <style lang="less" scoped>
  329. @import '/@/design/theme.less';
  330. @{theme-deepblue} {
  331. .ventilateWarn {
  332. --image-border: url('/@/assets/images/themify/deepblue/fire/border.png');
  333. --image-no-choice: url('/@/assets/images/themify/deepblue/fire/no-choice.png');
  334. --image-choice: url('/@/assets/images/themify/deepblue/fire/choice.png');
  335. --image-bj1: url('/@/assets/images/themify/deepblue/fire/bj1.png');
  336. --image-jinfengliang: url('/@/assets/images/themify/deepblue/fire/jinfengliang.png');
  337. --image-huifengliang: url('/@/assets/images/themify/deepblue/fire/huifengliang.png');
  338. --image-xufengliang: url('/@/assets/images/themify/deepblue/fire/xufengliang.png');
  339. }
  340. }
  341. .ventilateWarn {
  342. --image-border: url('/@/assets/images/fire/border.png');
  343. --image-no-choice: url('/@/assets/images/fire/no-choice.png');
  344. --image-choice: url('/@/assets/images/fire/choice.png');
  345. --image-bj1: url('/@/assets/images/fire/bj1.png');
  346. --image-jinfengliang: url('/@/assets/images/fire/jinfengliang.png');
  347. --image-huifengliang: url('/@/assets/images/fire/huifengliang.png');
  348. --image-xufengliang: url('/@/assets/images/fire/xufengliang.png');
  349. --border-image-1: linear-gradient(to bottom, #2d74a0, #2d74a0, #2d74a0);
  350. --border-image-2: linear-gradient(to bottom, transparent, #024688, transparent);
  351. position: reactive;
  352. width: 100%;
  353. height: 100%;
  354. padding: 80px 10px 15px 10px;
  355. box-sizing: border-box;
  356. .ventilate-top {
  357. width: 100%;
  358. display: flex;
  359. justify-content: space-between;
  360. height: 50%;
  361. margin-bottom: 15px;
  362. background: var(--image-border) no-repeat center;
  363. background-size: 100% 100%;
  364. padding-right: 15px;
  365. .alarm-menu {
  366. height: 100%;
  367. width: 332px;
  368. padding: 10px;
  369. box-sizing: border-box;
  370. .type-btn {
  371. width: 100%;
  372. height: 28px;
  373. line-height: 28px;
  374. background-color: var(--vent-warn-tab-bg);
  375. border: 2px solid var(--vent-warn-tab-border);
  376. margin-bottom: 20px;
  377. border-radius: 5px;
  378. box-sizing: border-box;
  379. display: flex;
  380. justify-content: space-between;
  381. .btn {
  382. width: 50%;
  383. height: 24px;
  384. line-height: 24px;
  385. font-size: 14px;
  386. text-align: center;
  387. color: var(--vent-font-color);
  388. cursor: pointer;
  389. }
  390. .btn1 {
  391. width: 50%;
  392. height: 24px;
  393. line-height: 24px;
  394. font-size: 14px;
  395. color: var(--vent-font-color);
  396. text-align: center;
  397. border-radius: 2px;
  398. background: var(--vent-warn-tab-bg-actived);
  399. cursor: pointer;
  400. }
  401. }
  402. .card-btn {
  403. width: 100%;
  404. height: calc(100% - 50px);
  405. overflow-y: auto;
  406. .btn {
  407. position: relative;
  408. width: 81%;
  409. height: 24%;
  410. margin-bottom: 6%;
  411. font-family: 'douyuFont';
  412. background: var(--image-no-choice) no-repeat;
  413. background-size: 100% 100%;
  414. cursor: pointer;
  415. .text {
  416. width: 80%;
  417. position: absolute;
  418. left: 50%;
  419. top: 28px;
  420. font-size: 14px;
  421. color: var(--vent-table-action-link);
  422. text-align: center;
  423. transform: translate(-50%, 0);
  424. }
  425. .warn {
  426. width: 100%;
  427. position: absolute;
  428. left: 50%;
  429. bottom: 8px;
  430. font-size: 12px;
  431. color: var(--vent-font-color);
  432. text-align: center;
  433. transform: translate(-50%, 0);
  434. }
  435. }
  436. .btn1 {
  437. position: relative;
  438. width: 100%;
  439. height: 24%;
  440. margin-bottom: 6%;
  441. font-family: 'douyuFont';
  442. background: var(--image-choice) no-repeat;
  443. background-size: 100% 100%;
  444. cursor: pointer;
  445. .text {
  446. width: 80%;
  447. position: absolute;
  448. left: 50%;
  449. top: 28px;
  450. font-size: 14px;
  451. color: var(--vent-table-action-link);
  452. text-align: center;
  453. transform: translate(-62%, 0);
  454. }
  455. .warn {
  456. width: 100%;
  457. position: absolute;
  458. left: 50%;
  459. bottom: 8px;
  460. font-size: 14px;
  461. color: var(--vent-font-color);
  462. text-align: center;
  463. transform: translate(-60%, 0);
  464. }
  465. }
  466. .hd-content {
  467. position: relative;
  468. width: 100%;
  469. height: 300px;
  470. padding: 0 20px;
  471. background: var(--image-no-choice) no-repeat;
  472. background-size: 100% 100%;
  473. .hd-content-text {
  474. display: flex;
  475. width: 100%;
  476. height: 200px;
  477. align-items: center;
  478. justify-content: center;
  479. font-size: 18px;
  480. color: var(--vent-font-yellow-color);
  481. }
  482. .hd-content-val {
  483. position: absolute;
  484. width: calc(100% - 40px);
  485. display: flex;
  486. justify-content: center;
  487. font-family: 'douyuFont';
  488. bottom: 80px;
  489. font-size: 20px;
  490. color: var(--vent-table-action-link);
  491. }
  492. }
  493. }
  494. }
  495. .ventilate-content {
  496. height: 100%;
  497. width: calc(100% - 332px);
  498. padding: 10px 0px;
  499. box-sizing: border-box;
  500. margin-right: 10px;
  501. }
  502. }
  503. .tun-box {
  504. width: 600px;
  505. height: 300px;
  506. }
  507. .ventilate-bottom {
  508. height: calc(50% - 15px);
  509. background: var(--image-border) no-repeat center;
  510. background-size: 100% 100%;
  511. padding: 10px;
  512. box-sizing: border-box;
  513. .bot-area {
  514. height: 100%;
  515. padding: 10px;
  516. background: var(--image-bj1) no-repeat center;
  517. background-size: 100% 100%;
  518. box-sizing: border-box;
  519. }
  520. }
  521. .icon-toggle {
  522. position: absolute;
  523. right: 220px;
  524. top: 17px;
  525. img {
  526. width: 26px;
  527. height: 26px;
  528. cursor: pointer;
  529. }
  530. }
  531. }
  532. </style>