index.vue 17 KB

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