index.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586
  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³/min)', isShow: true, valList: [] },
  123. // { name: '等积孔(m²)', isShow: true, valList: [] },
  124. // { name: '外部漏风率', isShow: false, val: 0 },
  125. { name: '有效风量率', isShow: false, val: '0%' },
  126. ]);
  127. let nowTimeYear = ref('');
  128. let nowTimeWeek = ref('');
  129. let nowTime = ref('');
  130. const centerModalRef = ref();
  131. const fullModalRef = ref();
  132. const globSetting = useGlobSetting();
  133. const pageType = ref('');
  134. let router = useRouter();
  135. const pageResult = ref({});
  136. function goDetail(deviceType) {
  137. //lxh
  138. // pageType.value = deviceType;
  139. if (deviceType == 'fanMain') {
  140. router.push('/monitorChannel/monitor-fanmain');
  141. } else if (deviceType == 'fanLocal') {
  142. if (sysOrgCode !== 'ymdnymdn') {
  143. router.push('/monitorChannel/monitor-fanlocal');
  144. } else {
  145. router.push('/fanlocal-page/home');
  146. }
  147. } else if (deviceType == 'windrect') {
  148. router.push('/monitorChannel/monitor-windrect');
  149. } else if (deviceType == 'warning') {
  150. router.push('/monitorChannel/monitor-alarm-home');
  151. }
  152. }
  153. function goHome() {
  154. pageType.value = 'home';
  155. }
  156. function getList() {
  157. list({}).then((res) => {
  158. console.log(res, 'res-----------');
  159. fanLocalList.length = 0;
  160. fanLocalList.push(res.fanlocal);
  161. mainList.value = res.fanmain;
  162. centerList = res.midinfo[0].sysdata;
  163. // 窝兔沟模拟风量
  164. // centerList = {
  165. // zongfengliang: "8010", // 总风量
  166. // xufengliang: '7232', // 有效风量
  167. // zonghuifeng: '8188' // 总会风
  168. // }
  169. // 总回
  170. navList[0].valList =
  171. centerList && centerList.zonghuifeng
  172. ? centerList.zonghuifeng.split('').map((el) => {
  173. return { val: el };
  174. })
  175. : [];
  176. // 总进
  177. navList[1].valList =
  178. centerList && centerList.zongjinfeng
  179. ? centerList.zongjinfeng
  180. .toString()
  181. .split('')
  182. .map((el) => {
  183. return { val: el };
  184. })
  185. : [];
  186. // 计划风量
  187. navList[2].valList =
  188. centerList && centerList.xufengliang
  189. ? centerList.xufengliang
  190. .toString()
  191. .split('')
  192. .map((el) => {
  193. return { val: el };
  194. })
  195. : [];
  196. if (centerList && centerList.zongfengliang && centerList.zongjinfeng) {
  197. // 外部漏风率 (zongfengliang-zongjinfeng)/zongfengliang
  198. navList[3].val =
  199. (((parseFloat(centerList.zongfengliang) - parseFloat(centerList.zongjinfeng)) / parseFloat(centerList.zongfengliang)) * 100).toFixed(2) +
  200. '%';
  201. // navList[4].val = ((centerList.xufengliang / parseFloat(centerList.zongfengliang)) * 100).toFixed(2) + '%';
  202. } else {
  203. navList[3].val = '0%';
  204. }
  205. if (res.midinfo[0] && res.midinfo[0].sysinfo) {
  206. navList[4].val = (res.midinfo[0].sysinfo.useM3Perent ? res.midinfo[0].sysinfo.useM3Perent : '0') + '%';
  207. }
  208. flList.value = res.windrect || res.sys_wind;
  209. if (res.sys_majorpath.length != 0) {
  210. lineList.value = res.sys_majorpath;
  211. } else {
  212. let paramArr: any = [];
  213. // paramArr.push({
  214. // deviceName: '关键路线1',
  215. // deviceType: 'sys_majorpath',
  216. // deviceID: Math.random() * 100,
  217. // majorpath: {
  218. // drag_1: 380,
  219. // drag_2: 167,
  220. // drag_3: 333,
  221. // drag_total: Math.abs(
  222. // Number(
  223. // res.fanmain && res.fanmain[0]
  224. // ? res.fanmain[0].readData.Fan1FanPre ||
  225. // res.fanmain[0].readData.Fan2FanPre ||
  226. // res.fanmain[0].readData.DataPa ||
  227. // 680 + (Math.random() * 2 - 1 * 5)
  228. // : 680 + (Math.random() * 2 - 1 * 5)
  229. // )
  230. // ),
  231. // m3_total: Number(
  232. // res.fanmain && res.fanmain[0]
  233. // ? res.fanmain[0].readData.Fan1m3 ||
  234. // res.fanmain[0].readData.Fan2m3 ||
  235. // res.fanmain[0].readData.m3 ||
  236. // 8138 + (Math.random() * 2 - 1 * 20)
  237. // : 8138 + (Math.random() * 2 - 1 * 20)
  238. // ),
  239. // },
  240. // });
  241. lineList.value = paramArr;
  242. }
  243. if (res.sys_surface_caimei.length != 0) {
  244. workList.value = res.sys_surface_caimei;
  245. } else {
  246. let paramArr: any = [];
  247. // paramArr.push({
  248. // deviceName: '工作面',
  249. // deviceType: 'sys_surface_caimei',
  250. // deviceID: '11111',
  251. // history: [],
  252. // jin: 100,
  253. // hui: 200,
  254. // xufengliang: 300,
  255. // });
  256. workList.value = getDate(paramArr);
  257. }
  258. warnData.value = res.warn || [];
  259. deviceData.value = res.device || {};
  260. });
  261. }
  262. //获取当前时间年月日时分秒
  263. function getNowTime() {
  264. setInterval(() => {
  265. nowTimeYear.value = dayjs().format('YYYY/MM/DD');
  266. let week = dayjs(new Date().getTime()).day();
  267. switch (week) {
  268. case 0:
  269. nowTimeWeek.value = '星期日';
  270. break;
  271. case 1:
  272. nowTimeWeek.value = '星期一';
  273. break;
  274. case 2:
  275. nowTimeWeek.value = '星期二';
  276. break;
  277. case 3:
  278. nowTimeWeek.value = '星期三';
  279. break;
  280. case 4:
  281. nowTimeWeek.value = '星期四';
  282. break;
  283. case 5:
  284. nowTimeWeek.value = '星期五';
  285. break;
  286. case 6:
  287. nowTimeWeek.value = '星期六';
  288. break;
  289. }
  290. let date = new Date();
  291. let hours = date.getHours();
  292. let minutes = date.getMinutes();
  293. let seconds = date.getSeconds();
  294. if (minutes >= 0 && minutes <= 9) {
  295. minutes = `0${minutes}`;
  296. }
  297. if (seconds >= 0 && seconds <= 9) {
  298. seconds = `0${seconds}`;
  299. }
  300. nowTime.value = `${hours}:${minutes}:${seconds}`;
  301. }, 1000);
  302. }
  303. function goModalDetail() {
  304. router.push('/micro-vent-3dModal/dashboard/analysis?type=model3D');
  305. }
  306. const changePageType = (pageType) => {
  307. actions.setGlobalState({ pageObj: { pageType: pageType } });
  308. };
  309. onMounted(() => {
  310. const currentRouteObj = unref(currentRoute);
  311. if (currentRouteObj && currentRouteObj['query'] && currentRouteObj['query']['deviceType']) {
  312. pageType.value = 'model3D';
  313. } else {
  314. pageType.value = 'home';
  315. }
  316. actions.onGlobalStateChange((newState) => {
  317. for (const key in newState) {
  318. if (key === 'pageObj') {
  319. const pageObj = newState[key];
  320. if (pageObj && pageObj.pageType) {
  321. pageType.value = pageObj.pageType;
  322. if (pageObj.timesolution) {
  323. pageResult.value = pageObj.timesolution;
  324. }
  325. }
  326. }
  327. }
  328. });
  329. getNowTime();
  330. getList();
  331. timer = Number(
  332. setInterval(() => {
  333. getList();
  334. }, 10000)
  335. );
  336. });
  337. onBeforeUnmount(() => {
  338. clearInterval(timer);
  339. timer = null;
  340. });
  341. onUnmounted(() => {
  342. pageType.value = '';
  343. });
  344. </script>
  345. <style lang="less" scoped>
  346. @font-face {
  347. font-family: 'douyuFont';
  348. src: url('../../../../assets/font/douyuFont.otf');
  349. }
  350. @font-face {
  351. font-family: 'yjsz';
  352. src: url('../../../../assets/font/yjsz.TTF');
  353. }
  354. .home-container {
  355. width: 100%;
  356. height: 100%;
  357. position: relative;
  358. .header {
  359. width: 100%;
  360. height: 76px;
  361. position: relative;
  362. background: url('../../../../assets//images//home-container/header-nav.png') no-repeat;
  363. .head-time {
  364. position: absolute;
  365. top: 14px;
  366. left: 15px;
  367. color: #b5c9e9;
  368. font-size: 14px;
  369. span {
  370. margin-right: 20px;
  371. letter-spacing: 2px;
  372. }
  373. }
  374. .main-title {
  375. position: absolute;
  376. left: 50%;
  377. top: 50%;
  378. transform: translate(-50%, -50%);
  379. color: #fff;
  380. font-size: 24px;
  381. font-family: 'douyuFont';
  382. }
  383. }
  384. .home-contents {
  385. display: flex;
  386. justify-content: space-between;
  387. height: calc(100% - 76px);
  388. padding: 10px;
  389. box-sizing: border-box;
  390. .left-content {
  391. display: flex;
  392. flex-direction: column;
  393. flex: 1;
  394. justify-content: space-between;
  395. height: 100%;
  396. .monitor-box {
  397. display: flex;
  398. flex: 1;
  399. width: 100%;
  400. background: url('../../../../assets/images/home-container/dialog.png') no-repeat;
  401. background-size: 100% 100%;
  402. }
  403. .monitor-box1 {
  404. margin: 10px 0px;
  405. }
  406. }
  407. .center-content {
  408. display: flex;
  409. flex-direction: column;
  410. justify-content: space-between;
  411. flex: 2;
  412. height: 100%;
  413. margin: 0px 10px;
  414. .three-box {
  415. position: relative;
  416. display: flex;
  417. background-color: #fff;
  418. flex: 2;
  419. width: 100%;
  420. margin-bottom: 15px;
  421. background: url('../../../../assets/images/home-container/three-dialog.png') no-repeat;
  422. background-size: 100% 100%;
  423. .three-nav {
  424. position: absolute;
  425. z-index: 9999;
  426. left: 50%;
  427. top: 38px;
  428. transform: translate(-50%, 0);
  429. width: 812px;
  430. height: 89px;
  431. padding: 0px 20px;
  432. box-sizing: border-box;
  433. display: flex;
  434. justify-content: space-around;
  435. align-items: center;
  436. background: url('../../../../assets/images/home-container/three-nav.png') no-repeat;
  437. .nav-item {
  438. display: flex;
  439. flex: 1;
  440. flex-direction: column;
  441. justify-content: space-around;
  442. align-items: center;
  443. height: 80%;
  444. .item-label {
  445. color: #98f5ff;
  446. }
  447. .item-value {
  448. position: relative;
  449. width: 125px;
  450. height: 37px;
  451. padding: 0px 5px;
  452. box-sizing: border-box;
  453. display: flex;
  454. justify-content: space-between;
  455. align-items: center;
  456. background: url('../../../../assets/images/home-container/item-value.png') no-repeat;
  457. .bg-box {
  458. position: relative;
  459. width: 20px;
  460. height: 26px;
  461. border-bottom: 2px solid #063493;
  462. background: linear-gradient(to right, rgba(1, 194, 249), rgba(0, 125, 252));
  463. .box-line {
  464. position: absolute;
  465. left: 0;
  466. top: 50%;
  467. transform: translate(0, -50%);
  468. height: 1px;
  469. width: 100%;
  470. background-color: rgba(6, 52, 147, 0.6);
  471. }
  472. .value-text {
  473. position: absolute;
  474. left: 50%;
  475. top: 50%;
  476. transform: translate(-50%, -50%);
  477. color: #fff;
  478. font-size: 22px;
  479. font-family: 'yjsz';
  480. font-weight: 500;
  481. }
  482. }
  483. .value-text1 {
  484. width: 100%;
  485. text-align: center;
  486. color: #fff;
  487. font-size: 22px;
  488. font-family: 'yjsz';
  489. font-weight: 500;
  490. }
  491. }
  492. }
  493. }
  494. .three-modal {
  495. width: 100%;
  496. height: 100%;
  497. padding: 20px 17px 20px 15px;
  498. box-sizing: border-box;
  499. // position: absolute;
  500. // background-color: var(--vent-base-color);
  501. .btn-icon {
  502. width: 40px;
  503. height: 40px;
  504. background: url('/@/assets/images/vent/home/tosmall.png') no-repeat center;
  505. background-size: 100% 100%;
  506. position: absolute;
  507. z-index: 99999;
  508. bottom: 30px;
  509. right: 30px;
  510. }
  511. }
  512. }
  513. .wind-box {
  514. display: flex;
  515. flex: 1;
  516. width: 100%;
  517. background: url('../../../../assets/images/home-container/dialog1.png') no-repeat;
  518. background-size: 100% 100%;
  519. }
  520. }
  521. .right-content {
  522. display: flex;
  523. flex-direction: column;
  524. justify-content: space-between;
  525. flex: 1;
  526. height: 100%;
  527. .monitor-box {
  528. display: flex;
  529. flex: 1;
  530. width: 100%;
  531. background: url('../../../../assets/images/home-container/dialog.png') no-repeat;
  532. background-size: 100% 100%;
  533. }
  534. .monitor-box1 {
  535. margin: 10px 0px;
  536. }
  537. }
  538. }
  539. }
  540. // #__qiankun_microapp_wrapper_for_micro_vent_3_d_modal__{
  541. // width: 100% !important;
  542. // height: 100% !important;
  543. // }
  544. </style>