index.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552
  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. if (res.midinfo[0].sysdata) {
  166. centerList = res.midinfo[0].sysdata;
  167. // 总回
  168. navList[0].valList =
  169. centerList && centerList.zonghuifeng
  170. ? centerList.zonghuifeng.split('').map((el) => {
  171. return { val: el };
  172. })
  173. : [];
  174. // 总进
  175. navList[1].valList =
  176. centerList && centerList.zongjinfeng
  177. ? centerList.zongjinfeng
  178. .toString()
  179. .split('')
  180. .map((el) => {
  181. return { val: el };
  182. })
  183. : [];
  184. // 计划风量
  185. navList[2].valList =
  186. centerList && centerList.xufengliang
  187. ? centerList.xufengliang
  188. .toString()
  189. .split('')
  190. .map((el) => {
  191. return { val: el };
  192. })
  193. : [];
  194. // 有效风量率
  195. navList[3].val = `${res.midinfo[0].sysinfo.useM3Perent}%` || '--';
  196. // 外部漏风率
  197. navList[4].val =
  198. (
  199. ((Number(res.midinfo[0].sysdata.zongfengliang) - Number(res.midinfo[0].sysdata.zongjinfeng)) /
  200. Number(res.midinfo[0].sysdata.zongfengliang)) *
  201. 100
  202. ).toFixed(1) + '%';
  203. }
  204. flList.value = res.windrect || res.sys_wind;
  205. if (res.sys_majorpath.length != 0) {
  206. lineList.value = res.sys_majorpath;
  207. } else {
  208. let paramArr: any = [];
  209. lineList.value = paramArr;
  210. }
  211. if (res.sys_surface_caimei.length != 0) {
  212. workList.value = res.sys_surface_caimei;
  213. } else {
  214. let paramArr: any = [];
  215. workList.value = getDate(paramArr);
  216. }
  217. warnData.value = res.warn || [];
  218. deviceData.value = res.device || {};
  219. });
  220. }
  221. //获取当前时间年月日时分秒
  222. function getNowTime() {
  223. setInterval(() => {
  224. nowTimeYear.value = dayjs().format('YYYY/MM/DD');
  225. let week = dayjs(new Date().getTime()).day();
  226. switch (week) {
  227. case 0:
  228. nowTimeWeek.value = '星期日';
  229. break;
  230. case 1:
  231. nowTimeWeek.value = '星期一';
  232. break;
  233. case 2:
  234. nowTimeWeek.value = '星期二';
  235. break;
  236. case 3:
  237. nowTimeWeek.value = '星期三';
  238. break;
  239. case 4:
  240. nowTimeWeek.value = '星期四';
  241. break;
  242. case 5:
  243. nowTimeWeek.value = '星期五';
  244. break;
  245. case 6:
  246. nowTimeWeek.value = '星期六';
  247. break;
  248. }
  249. let date = new Date();
  250. let hours = date.getHours();
  251. let minutes = date.getMinutes();
  252. let seconds = date.getSeconds();
  253. if (minutes >= 0 && minutes <= 9) {
  254. minutes = `0${minutes}`;
  255. }
  256. if (seconds >= 0 && seconds <= 9) {
  257. seconds = `0${seconds}`;
  258. }
  259. nowTime.value = `${hours}:${minutes}:${seconds}`;
  260. }, 1000);
  261. }
  262. function goModalDetail() {
  263. router.push('/micro-vent-3dModal/dashboard/analysis?type=model3D');
  264. }
  265. const changePageType = (pageType) => {
  266. actions.setGlobalState({ pageObj: { pageType: pageType } });
  267. };
  268. onMounted(() => {
  269. const currentRouteObj = unref(currentRoute);
  270. if (currentRouteObj && currentRouteObj['query'] && currentRouteObj['query']['deviceType']) {
  271. pageType.value = 'model3D';
  272. } else {
  273. pageType.value = 'home';
  274. }
  275. actions.onGlobalStateChange((newState) => {
  276. for (const key in newState) {
  277. if (key === 'pageObj') {
  278. const pageObj = newState[key];
  279. if (pageObj && pageObj.pageType) {
  280. pageType.value = pageObj.pageType;
  281. if (pageObj.timesolution) {
  282. pageResult.value = pageObj.timesolution;
  283. }
  284. }
  285. }
  286. }
  287. });
  288. getNowTime();
  289. getList();
  290. timer = Number(
  291. setInterval(() => {
  292. getList();
  293. }, 10000)
  294. );
  295. });
  296. onBeforeUnmount(() => {
  297. clearInterval(timer);
  298. timer = null;
  299. });
  300. onUnmounted(() => {
  301. pageType.value = '';
  302. });
  303. </script>
  304. <style lang="less" scoped>
  305. @font-face {
  306. font-family: 'douyuFont';
  307. src: url('../../../../assets/font/douyuFont.otf');
  308. }
  309. @font-face {
  310. font-family: 'yjsz';
  311. src: url('../../../../assets/font/yjsz.TTF');
  312. }
  313. .home-container {
  314. width: 100%;
  315. height: 100%;
  316. position: relative;
  317. .header {
  318. width: 100%;
  319. height: 76px;
  320. position: relative;
  321. background: url('../../../../assets//images//home-container/header-nav.png') no-repeat;
  322. .head-time {
  323. position: absolute;
  324. top: 14px;
  325. left: 15px;
  326. color: #b5c9e9;
  327. font-size: 14px;
  328. span {
  329. margin-right: 20px;
  330. letter-spacing: 2px;
  331. }
  332. }
  333. .main-title {
  334. position: absolute;
  335. left: 50%;
  336. top: 50%;
  337. transform: translate(-50%, -50%);
  338. color: #fff;
  339. font-size: 28px;
  340. font-weight: 600;
  341. display: flex;
  342. align-items: center;
  343. .logo {
  344. width: 32px;
  345. height: 32px;
  346. margin-right: 5px;
  347. }
  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: absolute;
  466. // background-color: var(--vent-base-color);
  467. .btn-icon {
  468. width: 40px;
  469. height: 40px;
  470. background: url('/@/assets/images/vent/home/tosmall.png') no-repeat center;
  471. background-size: 100% 100%;
  472. position: absolute;
  473. z-index: 99999;
  474. bottom: 30px;
  475. right: 30px;
  476. }
  477. }
  478. }
  479. .wind-box {
  480. display: flex;
  481. flex: 1;
  482. width: 100%;
  483. background: url('../../../../assets/images/home-container/dialog1.png') no-repeat;
  484. background-size: 100% 100%;
  485. }
  486. }
  487. .right-content {
  488. display: flex;
  489. flex-direction: column;
  490. justify-content: space-between;
  491. flex: 1;
  492. height: 100%;
  493. .monitor-box {
  494. display: flex;
  495. flex: 1;
  496. width: 100%;
  497. background: url('../../../../assets/images/home-container/dialog.png') no-repeat;
  498. background-size: 100% 100%;
  499. }
  500. .monitor-box1 {
  501. margin: 10px 0px;
  502. }
  503. }
  504. }
  505. }
  506. // #__qiankun_microapp_wrapper_for_micro_vent_3_d_modal__{
  507. // width: 100% !important;
  508. // height: 100% !important;
  509. // }
  510. </style>