index.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582
  1. <template>
  2. <div v-if="pageType == 'home'" style="position: relative; width: 100%; height: 100%">
  3. <div class="home-container">
  4. <div class="header">
  5. <div class="head-time">
  6. <span>{{ nowTimeYear }}</span>
  7. <span>{{ nowTimeWeek }}</span>
  8. <span>{{ nowTime }}</span>
  9. </div>
  10. <div class="main-title">{{ title }}</div>
  11. </div>
  12. <div class="home-contents">
  13. <div class="left-content">
  14. <!-- 主通风机 -->
  15. <div class="monitor-box">
  16. <mainMonitor :maindata="mainList" @goDetail="goDetail" />
  17. </div>
  18. <!-- 局部通风机 -->
  19. <div class="monitor-box monitor-box1">
  20. <fanMonitor @goDetail="goDetail" :fandata="fanLocalList" />
  21. </div>
  22. <!-- 通风设备远程控制 -->
  23. <div class="monitor-box">
  24. <windDevice :devicedata="deviceData" @goDetail="goDetail" />
  25. </div>
  26. </div>
  27. <div class="center-content">
  28. <!-- 三维模型 -->
  29. <div class="three-box">
  30. <div class="three-nav" v-if="!hasPermission('monitor:show')">
  31. <template v-for="(item, index) in navList" :key="index">
  32. <div class="nav-item" v-if="(item.valList && item.valList.length > 0) || item.val">
  33. <div class="item-label">{{ item.name }}</div>
  34. <div class="item-value">
  35. <div v-if="item.isShow" class="bg-box" v-for="(ite, ind) in item.valList" :key="ind">
  36. <div class="box-line"></div>
  37. <div class="value-text">{{ ite.val }}</div>
  38. </div>
  39. <div v-else class="value-text1">{{ item.val }}</div>
  40. </div>
  41. </div>
  42. </template>
  43. </div>
  44. <div class="three-modal" id="modalBox" style="position: relative">
  45. <!-- <div class="btn-icon" @click="goModalDetail"></div> -->
  46. <!-- 展会不显示按钮 -->
  47. <div v-if="sysOrgCode !== 'mkyzhpt'" class="btn-icon" @click="goModalDetail"></div>
  48. <VentModal
  49. ref="centerModalRef"
  50. style="width: calc(100% - 30px); height: calc(100% - 30px); position: absolute; background-color: #fff"
  51. />
  52. </div>
  53. </div>
  54. <!-- 风量监测 -->
  55. <div class="wind-box">
  56. <windMonitor :flList="flList" @goDetail="goDetail" />
  57. </div>
  58. </div>
  59. <div class="right-content">
  60. <!-- 关键通风路线 -->
  61. <div class="monitor-box">
  62. <windLine :lineList="lineList" @goDetail="goDetail" />
  63. </div>
  64. <!-- 工作面智能管控 -->
  65. <div class="monitor-box monitor-box1">
  66. <workMonitor :workList="workList" @goDetail="goDetail" />
  67. </div>
  68. <!-- 设备预警 -->
  69. <div class="monitor-box">
  70. <deviceWarn :warnData="warnData" @goDetail="goDetail" />
  71. </div>
  72. </div>
  73. </div>
  74. </div>
  75. </div>
  76. <Network ref="NetworkRef" v-if="pageType == 'timesolution'" :pageResult="pageResult" @changePageType="changePageType" style="position: absolute" />
  77. <VentModal
  78. v-if="pageType == 'model3D' || pageType == 'timesolution'"
  79. ref="fullModalRef"
  80. style="width: calc(100% - 30px); height: calc(100% - 30px); position: absolute"
  81. />
  82. </template>
  83. <script lang="ts" setup>
  84. import { reactive, onMounted, ref, nextTick, computed, unref, inject, onBeforeUnmount, onUnmounted } from 'vue';
  85. import fanMonitor from './components/fan-monitor.vue';
  86. import mainMonitor from './components/main-monitor.vue';
  87. import windDevice from './components/wind-device.vue';
  88. import windMonitor from './components/wind-monitor.vue';
  89. import windLine from './components/wind-line.vue';
  90. import workMonitor from './components/work-monitor.vue';
  91. import deviceWarn from './components/device-warn.vue';
  92. import { useGlobSetting } from '/@/hooks/setting';
  93. import { list } from './clique.api';
  94. import Network from '../../monitorManager/deviceMonitor/components/network/index.vue';
  95. import { useRouter } from 'vue-router';
  96. import { router } from '/@/router';
  97. // import { Modal } from 'ant-design-vue';
  98. // import { ExclamationCircleOutlined } from '@ant-design/icons-vue';
  99. import dayjs from 'dayjs';
  100. import { getActions } from '/@/qiankun/state';
  101. import { unmountMicroApps, mountMicroApp } from '/@/qiankun';
  102. import { getDate } from './clique.data';
  103. import VentModal from '/@/components/vent/micro/ventModal.vue';
  104. import { usePermission } from '/@/hooks/web/usePermission';
  105. const { currentRoute } = useRouter();
  106. const { hasPermission } = usePermission();
  107. const { title, logoUrl, sysOrgCode } = useGlobSetting();
  108. const actions = getActions();
  109. let timer: NodeJS.Timeout | null = null;
  110. let fanLocalList = reactive<any[]>([]); //局部风机数据
  111. let mainList = ref<any[]>([]); //主通风机数据
  112. let centerList = reactive<any[]>([]); //中间区域数据
  113. let flList = ref<any[]>([]); //风量监测数据
  114. let lineList = ref<any>([]); //关键路线数据
  115. let workList = ref<any>([]); //工作面数据
  116. let warnData = ref<any>([]); //预警数据
  117. let deviceData = ref<any>({}); //设备监测数据
  118. let navList = reactive([
  119. { name: '总回风量(m³/min)', isShow: true, valList: [] },
  120. { name: '需风量(m³/min)', isShow: true, valList: [] },
  121. // { name: '有效风量(m³/min)', isShow: true, valList: [] },
  122. { name: '等积孔(m²)', isShow: true, valList: [] },
  123. { name: '外部漏风率', isShow: false, val: 0 },
  124. { name: '有效风量率', isShow: false, val: '0%' },
  125. ]);
  126. let nowTimeYear = ref('');
  127. let nowTimeWeek = ref('');
  128. let nowTime = ref('');
  129. const centerModalRef = ref();
  130. const fullModalRef = ref();
  131. const globSetting = useGlobSetting();
  132. const pageType = ref('');
  133. let router = useRouter();
  134. const pageResult = ref({});
  135. function goDetail(deviceType) {
  136. //lxh
  137. // pageType.value = deviceType;
  138. if (deviceType == 'fanMain') {
  139. router.push('/monitorChannel/monitor-fanmain');
  140. } else if (deviceType == 'fanLocal') {
  141. if (sysOrgCode !== 'ymdnymdn') {
  142. router.push('/monitorChannel/monitor-fanlocal');
  143. } else {
  144. router.push('/fanlocal-page/home');
  145. }
  146. } else if (deviceType == 'windrect') {
  147. router.push('/monitorChannel/monitor-windrect');
  148. } else if (deviceType == 'warning') {
  149. router.push('/monitorChannel/monitor-alarm-home');
  150. }
  151. }
  152. function goHome() {
  153. pageType.value = 'home';
  154. }
  155. function getList() {
  156. list({}).then((res) => {
  157. console.log(res, 'res-----------');
  158. fanLocalList.length = 0;
  159. fanLocalList.push(res.fanlocal);
  160. mainList.value = res.fanmain;
  161. centerList = res.midinfo[0].sysdata;
  162. // 窝兔沟模拟风量
  163. // centerList = {
  164. // zongfengliang: "8010", // 总风量
  165. // xufengliang: '7232', // 有效风量
  166. // zonghuifeng: '8188' // 总会风
  167. // }
  168. navList[0].valList =
  169. centerList && centerList.zongfengliang
  170. ? centerList.zongfengliang.split('').map((el) => {
  171. return { val: el };
  172. })
  173. : [];
  174. navList[1].valList =
  175. centerList && centerList.xufengliang
  176. ? centerList.xufengliang
  177. .toString()
  178. .split('')
  179. .map((el) => {
  180. return { val: el };
  181. })
  182. : [];
  183. navList[2].valList =
  184. centerList && centerList.dengjikong
  185. ? (Number(centerList.dengjikong) > 10 ? centerList.dengjikong.toFixed(2) : `0${centerList.dengjikong.toFixed(2)}`)
  186. .toString()
  187. .split('')
  188. .map((el) => {
  189. return { val: el };
  190. })
  191. : [];
  192. if (centerList && centerList.zongfengliang && centerList.zongjinfeng) {
  193. // 外部漏风率 (zongfengliang-zongjinfeng)/zongfengliang
  194. navList[3].val =
  195. (((parseFloat(centerList.zongfengliang) - parseFloat(centerList.zongjinfeng)) / parseFloat(centerList.zongfengliang)) * 100).toFixed(2) +
  196. '%';
  197. // navList[4].val = ((centerList.xufengliang / parseFloat(centerList.zongfengliang)) * 100).toFixed(2) + '%';
  198. } else {
  199. navList[3].val = '0%';
  200. }
  201. if (res.midinfo[0] && res.midinfo[0].sysinfo) {
  202. navList[4].val = (res.midinfo[0].sysinfo.useM3Perent ? res.midinfo[0].sysinfo.useM3Perent : '0') + '%';
  203. }
  204. flList.value = res.windrect || res.sys_wind;
  205. if (res.sys_majorpath.length != 0) {
  206. lineList.value = res.sys_majorpath;
  207. } else {
  208. let paramArr: any = [];
  209. // paramArr.push({
  210. // deviceName: '关键路线1',
  211. // deviceType: 'sys_majorpath',
  212. // deviceID: Math.random() * 100,
  213. // majorpath: {
  214. // drag_1: 380,
  215. // drag_2: 167,
  216. // drag_3: 333,
  217. // drag_total: Math.abs(
  218. // Number(
  219. // res.fanmain && res.fanmain[0]
  220. // ? res.fanmain[0].readData.Fan1FanPre ||
  221. // res.fanmain[0].readData.Fan2FanPre ||
  222. // res.fanmain[0].readData.DataPa ||
  223. // 680 + (Math.random() * 2 - 1 * 5)
  224. // : 680 + (Math.random() * 2 - 1 * 5)
  225. // )
  226. // ),
  227. // m3_total: Number(
  228. // res.fanmain && res.fanmain[0]
  229. // ? res.fanmain[0].readData.Fan1m3 ||
  230. // res.fanmain[0].readData.Fan2m3 ||
  231. // res.fanmain[0].readData.m3 ||
  232. // 8138 + (Math.random() * 2 - 1 * 20)
  233. // : 8138 + (Math.random() * 2 - 1 * 20)
  234. // ),
  235. // },
  236. // });
  237. lineList.value = paramArr;
  238. }
  239. if (res.sys_surface_caimei.length != 0) {
  240. workList.value = res.sys_surface_caimei;
  241. } else {
  242. let paramArr: any = [];
  243. // paramArr.push({
  244. // deviceName: '工作面',
  245. // deviceType: 'sys_surface_caimei',
  246. // deviceID: '11111',
  247. // history: [],
  248. // jin: 100,
  249. // hui: 200,
  250. // xufengliang: 300,
  251. // });
  252. workList.value = getDate(paramArr);
  253. }
  254. warnData.value = res.warn || [];
  255. deviceData.value = res.device || {};
  256. });
  257. }
  258. //获取当前时间年月日时分秒
  259. function getNowTime() {
  260. setInterval(() => {
  261. nowTimeYear.value = dayjs().format('YYYY/MM/DD');
  262. let week = dayjs(new Date().getTime()).day();
  263. switch (week) {
  264. case 0:
  265. nowTimeWeek.value = '星期日';
  266. break;
  267. case 1:
  268. nowTimeWeek.value = '星期一';
  269. break;
  270. case 2:
  271. nowTimeWeek.value = '星期二';
  272. break;
  273. case 3:
  274. nowTimeWeek.value = '星期三';
  275. break;
  276. case 4:
  277. nowTimeWeek.value = '星期四';
  278. break;
  279. case 5:
  280. nowTimeWeek.value = '星期五';
  281. break;
  282. case 6:
  283. nowTimeWeek.value = '星期六';
  284. break;
  285. }
  286. let date = new Date();
  287. let hours = date.getHours();
  288. let minutes = date.getMinutes();
  289. let seconds = date.getSeconds();
  290. if (minutes >= 0 && minutes <= 9) {
  291. minutes = `0${minutes}`;
  292. }
  293. if (seconds >= 0 && seconds <= 9) {
  294. seconds = `0${seconds}`;
  295. }
  296. nowTime.value = `${hours}:${minutes}:${seconds}`;
  297. }, 1000);
  298. }
  299. function goModalDetail() {
  300. router.push('/micro-vent-3dModal/dashboard/analysis?type=model3D');
  301. }
  302. const changePageType = (pageType) => {
  303. actions.setGlobalState({ pageObj: { pageType: pageType } });
  304. };
  305. onMounted(() => {
  306. const currentRouteObj = unref(currentRoute);
  307. if (currentRouteObj && currentRouteObj['query'] && currentRouteObj['query']['deviceType']) {
  308. pageType.value = 'model3D';
  309. } else {
  310. pageType.value = 'home';
  311. }
  312. actions.onGlobalStateChange((newState) => {
  313. for (const key in newState) {
  314. if (key === 'pageObj') {
  315. const pageObj = newState[key];
  316. if (pageObj && pageObj.pageType) {
  317. pageType.value = pageObj.pageType;
  318. if (pageObj.timesolution) {
  319. pageResult.value = pageObj.timesolution;
  320. }
  321. }
  322. }
  323. }
  324. });
  325. getNowTime();
  326. getList();
  327. timer = Number(
  328. setInterval(() => {
  329. getList();
  330. }, 10000)
  331. );
  332. });
  333. onBeforeUnmount(() => {
  334. clearInterval(timer);
  335. timer = null;
  336. });
  337. onUnmounted(() => {
  338. pageType.value = '';
  339. });
  340. </script>
  341. <style lang="less" scoped>
  342. @font-face {
  343. font-family: 'douyuFont';
  344. src: url('../../../../assets/font/douyuFont.otf');
  345. }
  346. @font-face {
  347. font-family: 'yjsz';
  348. src: url('../../../../assets/font/yjsz.TTF');
  349. }
  350. .home-container {
  351. width: 100%;
  352. height: 100%;
  353. position: relative;
  354. .header {
  355. width: 100%;
  356. height: 76px;
  357. position: relative;
  358. background: url('../../../../assets//images//home-container/header-nav.png') no-repeat;
  359. .head-time {
  360. position: absolute;
  361. top: 14px;
  362. left: 15px;
  363. color: #b5c9e9;
  364. font-size: 14px;
  365. span {
  366. margin-right: 20px;
  367. letter-spacing: 2px;
  368. }
  369. }
  370. .main-title {
  371. position: absolute;
  372. left: 50%;
  373. top: 50%;
  374. transform: translate(-50%, -50%);
  375. color: #fff;
  376. font-size: 24px;
  377. font-family: 'douyuFont';
  378. }
  379. }
  380. .home-contents {
  381. display: flex;
  382. justify-content: space-between;
  383. height: calc(100% - 76px);
  384. padding: 10px;
  385. box-sizing: border-box;
  386. .left-content {
  387. display: flex;
  388. flex-direction: column;
  389. flex: 1;
  390. justify-content: space-between;
  391. height: 100%;
  392. .monitor-box {
  393. display: flex;
  394. flex: 1;
  395. width: 100%;
  396. background: url('../../../../assets/images/home-container/dialog.png') no-repeat;
  397. background-size: 100% 100%;
  398. }
  399. .monitor-box1 {
  400. margin: 10px 0px;
  401. }
  402. }
  403. .center-content {
  404. display: flex;
  405. flex-direction: column;
  406. justify-content: space-between;
  407. flex: 2;
  408. height: 100%;
  409. margin: 0px 10px;
  410. .three-box {
  411. position: relative;
  412. display: flex;
  413. background-color: #fff;
  414. flex: 2;
  415. width: 100%;
  416. margin-bottom: 15px;
  417. background: url('../../../../assets/images/home-container/three-dialog.png') no-repeat;
  418. background-size: 100% 100%;
  419. .three-nav {
  420. position: absolute;
  421. z-index: 9999;
  422. left: 50%;
  423. top: 38px;
  424. transform: translate(-50%, 0);
  425. width: 812px;
  426. height: 89px;
  427. padding: 0px 20px;
  428. box-sizing: border-box;
  429. display: flex;
  430. justify-content: space-around;
  431. align-items: center;
  432. background: url('../../../../assets/images/home-container/three-nav.png') no-repeat;
  433. .nav-item {
  434. display: flex;
  435. flex: 1;
  436. flex-direction: column;
  437. justify-content: space-around;
  438. align-items: center;
  439. height: 80%;
  440. .item-label {
  441. color: #98f5ff;
  442. }
  443. .item-value {
  444. position: relative;
  445. width: 125px;
  446. height: 37px;
  447. padding: 0px 5px;
  448. box-sizing: border-box;
  449. display: flex;
  450. justify-content: space-between;
  451. align-items: center;
  452. background: url('../../../../assets/images/home-container/item-value.png') no-repeat;
  453. .bg-box {
  454. position: relative;
  455. width: 20px;
  456. height: 26px;
  457. border-bottom: 2px solid #063493;
  458. background: linear-gradient(to right, rgba(1, 194, 249), rgba(0, 125, 252));
  459. .box-line {
  460. position: absolute;
  461. left: 0;
  462. top: 50%;
  463. transform: translate(0, -50%);
  464. height: 1px;
  465. width: 100%;
  466. background-color: rgba(6, 52, 147, 0.6);
  467. }
  468. .value-text {
  469. position: absolute;
  470. left: 50%;
  471. top: 50%;
  472. transform: translate(-50%, -50%);
  473. color: #fff;
  474. font-size: 22px;
  475. font-family: 'yjsz';
  476. font-weight: 500;
  477. }
  478. }
  479. .value-text1 {
  480. width: 100%;
  481. text-align: center;
  482. color: #fff;
  483. font-size: 22px;
  484. font-family: 'yjsz';
  485. font-weight: 500;
  486. }
  487. }
  488. }
  489. }
  490. .three-modal {
  491. width: 100%;
  492. height: 100%;
  493. padding: 20px 17px 20px 15px;
  494. box-sizing: border-box;
  495. // position: absolute;
  496. // background-color: var(--vent-base-color);
  497. .btn-icon {
  498. width: 40px;
  499. height: 40px;
  500. background: url('/@/assets/images/vent/home/tosmall.png') no-repeat center;
  501. background-size: 100% 100%;
  502. position: absolute;
  503. z-index: 99999;
  504. bottom: 30px;
  505. right: 30px;
  506. }
  507. }
  508. }
  509. .wind-box {
  510. display: flex;
  511. flex: 1;
  512. width: 100%;
  513. background: url('../../../../assets/images/home-container/dialog1.png') no-repeat;
  514. background-size: 100% 100%;
  515. }
  516. }
  517. .right-content {
  518. display: flex;
  519. flex-direction: column;
  520. justify-content: space-between;
  521. flex: 1;
  522. height: 100%;
  523. .monitor-box {
  524. display: flex;
  525. flex: 1;
  526. width: 100%;
  527. background: url('../../../../assets/images/home-container/dialog.png') no-repeat;
  528. background-size: 100% 100%;
  529. }
  530. .monitor-box1 {
  531. margin: 10px 0px;
  532. }
  533. }
  534. }
  535. }
  536. // #__qiankun_microapp_wrapper_for_micro_vent_3_d_modal__{
  537. // width: 100% !important;
  538. // height: 100% !important;
  539. // }
  540. </style>