index.vue 19 KB

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