index.vue 18 KB

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