index copy.vue 17 KB

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