1
0

index.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493
  1. <template>
  2. <div style="position: relative; width: 100%; height: 100%">
  3. <div class="home-container" v-if="pageType == 'home'">
  4. <div class="header">
  5. <div class="head-time">
  6. <span>{{ nowTime }}</span>
  7. <span>{{ weeks }}</span>
  8. <span>{{ timeDate }}</span>
  9. </div>
  10. <div class="main-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. <div class="nav-item" v-for="(item, index) in navList" :key="index">
  32. <div class="item-label">{{ item.name }}</div>
  33. <div class="item-value">
  34. <div v-if="item.isShow" class="bg-box" v-for="(ite, ind) in item.valList" :key="ind">
  35. <div class="box-line"></div>
  36. <div class="value-text">{{ ite.val }}</div>
  37. </div>
  38. <div v-else class="value-text1">{{ item.val }}</div>
  39. </div>
  40. </div>
  41. </div>
  42. <div class="three-modal" id="modalBox">
  43. <div class="btn-icon" @click="goModalDetail"></div>
  44. <!-- <iframe
  45. id="iframe"
  46. ref="iframe"
  47. src="http://182.92.126.35:8091/user/autologin"
  48. scrolling="auto"
  49. frameborder="0"
  50. width="100%"
  51. height="100%"
  52. ></iframe> -->
  53. </div>
  54. </div>
  55. <!-- 风量监测 -->
  56. <div class="wind-box">
  57. <windMonitor :flList="flList" @goDetail="goDetail" />
  58. </div>
  59. </div>
  60. <div class="right-content">
  61. <!-- 关键通风路线 -->
  62. <div class="monitor-box">
  63. <windLine :lineList="lineList" @goDetail="goDetail" />
  64. </div>
  65. <!-- 工作面智能管控 -->
  66. <div class="monitor-box monitor-box1">
  67. <workMonitor :workList="workList" @goDetail="goDetail" />
  68. </div>
  69. <!-- 设备预警 -->
  70. <div class="monitor-box">
  71. <deviceWarn :warnData="warnData" @goDetail="goDetail" />
  72. </div>
  73. </div>
  74. </div>
  75. </div>
  76. <DeviceMonitor v-else-if="pageType" :pageType="pageType" @goHome="goHome" />
  77. <div id="content" style="width: 100%; height: 100%; position: fixed"></div>
  78. </div>
  79. </template>
  80. <script lang="ts" setup>
  81. import { reactive, onMounted, ref, nextTick, computed } from 'vue';
  82. import fanMonitor from './components/fan-monitor.vue';
  83. import mainMonitor from './components/main-monitor.vue';
  84. import windDevice from './components/wind-device.vue';
  85. import windMonitor from './components/wind-monitor.vue';
  86. import windLine from './components/wind-line.vue';
  87. import workMonitor from './components/work-monitor.vue';
  88. import deviceWarn from './components/device-warn.vue';
  89. import { useGlobSetting } from '/@/hooks/setting';
  90. import { list } from './clique.api';
  91. import DeviceMonitor from '../../monitorManager/deviceMonitor/index.vue';
  92. import { useRouter } from 'vue-router';
  93. // import { Modal } from 'ant-design-vue';
  94. // import { ExclamationCircleOutlined } from '@ant-design/icons-vue';
  95. import moment from 'moment';
  96. import { getActions } from '/@/qiankun/state';
  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²)', isShow: true, valList: [{ val: '1' }, { val: '0' }, { val: '.' }, { val: '5' }, { val: '4' }] },
  111. { name: '外部漏风率', isShow: false, val: 0 },
  112. { name: '有效风量率', isShow: false, val: 0 },
  113. ]);
  114. const globSetting = useGlobSetting();
  115. const pageType = ref('home');
  116. let router = useRouter();
  117. function goDetail(deviceType) {
  118. // Modal.confirm({
  119. // content: () => '暂未连接井下设备!',
  120. // icon: () => createVNode(ExclamationCircleOutlined),
  121. // title: '消息提示',
  122. // onOk() {
  123. // return new Promise((resolve, reject) => {
  124. // setTimeout(Math.random() > 0.5 ? resolve : reject, 1000);
  125. // }).catch(() => console.log('Oops errors!'));
  126. // },
  127. // cancelText: () => '取消',
  128. // onCancel() {
  129. // Modal.destroyAll();
  130. // },
  131. // });
  132. //lxh
  133. // pageType.value = deviceType;
  134. // changeModalBox();
  135. if (deviceType == 'zhu') {
  136. router.push('/monitorChannel/monitor-fan-main');
  137. } else if (deviceType == 'ju') {
  138. router.push('/monitorChannel/monitor-fan-local');
  139. } else {
  140. router.push('/monitorChannel/monitor-gate');
  141. }
  142. }
  143. function goHome() {
  144. pageType.value = 'home';
  145. nextTick(() => {
  146. changeModalBox();
  147. });
  148. }
  149. function changeModalBox() {
  150. if (pageType.value === 'home') {
  151. const dom = document.getElementById('modalBox') as HTMLElement;
  152. if (dom && dom.parentElement) {
  153. const contentDom = document.getElementById('content') as HTMLElement;
  154. contentDom?.setAttribute(
  155. 'style',
  156. `top: ${dom.parentElement.offsetTop + 20}px; left: ${dom.parentElement.offsetLeft + 20}px; width: ${dom.offsetWidth - 40}px; height: ${dom.offsetHeight - 40
  157. }px; position: fixed;`
  158. );
  159. }
  160. } else {
  161. const dom = document.getElementById('modalBox') as HTMLElement;
  162. if (dom && dom.parentElement) {
  163. const contentDom = document.getElementById('content') as HTMLElement;
  164. contentDom?.setAttribute('style', `top:0px; left: 0px; width: 100%; height: 100%; position: fixed;`);
  165. }
  166. }
  167. }
  168. function getList() {
  169. list({}).then((res) => {
  170. console.log(res, 'res-----------');
  171. fanLocalList.length = 0;
  172. fanLocalList.push(res.fanlocal);
  173. mainList.value = res.fanmain;
  174. centerList = res.midinfo[0].sysdata;
  175. navList[0].valList = centerList.zongfengliang
  176. ? centerList.zongfengliang.split('').map((el) => {
  177. return { val: el };
  178. })
  179. : [];
  180. navList[1].valList = centerList.xufengliang
  181. ? centerList.xufengliang
  182. .toString()
  183. .split('')
  184. .map((el) => {
  185. return { val: el };
  186. })
  187. : [];
  188. if (centerList.zongfengliang && centerList.zonghuifeng) {
  189. navList[3].val =
  190. (((parseFloat(centerList.zongfengliang) - parseFloat(centerList.zonghuifeng)) / parseFloat(centerList.zonghuifeng)) * 100).toFixed(2) + '%';
  191. navList[4].val = ((centerList.xufengliang / parseFloat(centerList.zongfengliang)) * 100).toFixed(2) + '%';
  192. } else {
  193. navList[3].val = '0%';
  194. navList[4].val = '0%';
  195. }
  196. flList.value = res.windrect;
  197. lineList.value = res.sys_majorpath;
  198. workList.value = res.sys_surface_caimei;
  199. warnData.value = res.warn;
  200. deviceData.value = res.device;
  201. });
  202. }
  203. let weeks = computed(() => {
  204. let week = moment(new Date().getTime()).day();
  205. switch (week) {
  206. case 0:
  207. return '星期日';
  208. break;
  209. case 1:
  210. return '星期一';
  211. break;
  212. case 2:
  213. return '星期二';
  214. break;
  215. case 3:
  216. return '星期三';
  217. break;
  218. case 4:
  219. return '星期四';
  220. break;
  221. case 5:
  222. return '星期五';
  223. break;
  224. case 6:
  225. return '星期六';
  226. break;
  227. }
  228. });
  229. let nowTime = computed(() => {
  230. return moment().format('YYYY/MM/DD');
  231. });
  232. let timeDate = computed(() => {
  233. return moment().format('HH:MM:SS');
  234. });
  235. function goModalDetail() {
  236. actions.setGlobalState({ pageObj: { pageType: 'model3D' } });
  237. }
  238. onMounted(() => {
  239. getList();
  240. changeModalBox();
  241. const renderModal = () => {
  242. const element = document.getElementById('__qiankun_microapp_wrapper_for_micro_vent_3_d_modal__');
  243. if (element) {
  244. element?.setAttribute('style', 'width: 100%; height: 100%');
  245. } else {
  246. setTimeout(() => {
  247. renderModal();
  248. }, 2000);
  249. }
  250. };
  251. renderModal();
  252. timer = Number(
  253. setInterval(() => {
  254. getList();
  255. }, 10000)
  256. );
  257. });
  258. </script>
  259. <style lang="less" scoped>
  260. @font-face {
  261. font-family: 'douyuFont';
  262. src: url('../../../../assets/font/douyuFont.otf');
  263. }
  264. @font-face {
  265. font-family: 'yjsz';
  266. src: url('../../../../assets/font/yjsz.TTF');
  267. }
  268. .home-container {
  269. width: 100%;
  270. height: 100%;
  271. position: relative;
  272. .header {
  273. width: 100%;
  274. height: 76px;
  275. position: relative;
  276. background: url('../../../../assets//images//home-container/header-nav.png') no-repeat;
  277. .head-time {
  278. position: absolute;
  279. top: 14px;
  280. left: 15px;
  281. color: #b5c9e9;
  282. font-size: 14px;
  283. span {
  284. margin-right: 20px;
  285. letter-spacing: 2px;
  286. }
  287. }
  288. .main-title {
  289. position: absolute;
  290. left: 50%;
  291. top: 50%;
  292. transform: translate(-50%, -50%);
  293. color: #fff;
  294. font-size: 24px;
  295. font-family: 'douyuFont';
  296. }
  297. }
  298. .home-contents {
  299. display: flex;
  300. justify-content: space-between;
  301. height: calc(100% - 76px);
  302. padding: 10px;
  303. box-sizing: border-box;
  304. .left-content {
  305. display: flex;
  306. flex-direction: column;
  307. flex: 1;
  308. justify-content: space-between;
  309. height: 100%;
  310. .monitor-box {
  311. display: flex;
  312. flex: 1;
  313. width: 100%;
  314. background: url('../../../../assets/images/home-container/dialog.png') no-repeat;
  315. background-size: 100% 100%;
  316. }
  317. .monitor-box1 {
  318. margin: 10px 0px;
  319. }
  320. }
  321. .center-content {
  322. display: flex;
  323. flex-direction: column;
  324. justify-content: space-between;
  325. flex: 2;
  326. height: 100%;
  327. margin: 0px 10px;
  328. .three-box {
  329. position: relative;
  330. display: flex;
  331. background-color: #fff;
  332. flex: 2;
  333. width: 100%;
  334. margin-bottom: 15px;
  335. background: url('../../../../assets/images/home-container/three-dialog.png') no-repeat;
  336. background-size: 100% 100%;
  337. .three-nav {
  338. position: absolute;
  339. z-index: 9999;
  340. left: 50%;
  341. top: 38px;
  342. transform: translate(-50%, 0);
  343. width: 812px;
  344. height: 89px;
  345. padding: 0px 20px;
  346. box-sizing: border-box;
  347. display: flex;
  348. justify-content: space-around;
  349. align-items: center;
  350. background: url('../../../../assets/images/home-container/three-nav.png') no-repeat;
  351. .nav-item {
  352. display: flex;
  353. flex: 1;
  354. flex-direction: column;
  355. justify-content: space-around;
  356. align-items: center;
  357. height: 80%;
  358. .item-label {
  359. color: #98f5ff;
  360. }
  361. .item-value {
  362. position: relative;
  363. width: 125px;
  364. height: 37px;
  365. padding: 0px 5px;
  366. box-sizing: border-box;
  367. display: flex;
  368. justify-content: space-between;
  369. align-items: center;
  370. background: url('../../../../assets/images/home-container/item-value.png') no-repeat;
  371. .bg-box {
  372. position: relative;
  373. width: 20px;
  374. height: 26px;
  375. border-bottom: 2px solid #063493;
  376. background: linear-gradient(to right, rgba(1, 194, 249), rgba(0, 125, 252));
  377. .box-line {
  378. position: absolute;
  379. left: 0;
  380. top: 50%;
  381. transform: translate(0, -50%);
  382. height: 1px;
  383. width: 100%;
  384. background-color: rgba(6, 52, 147, 0.6);
  385. }
  386. .value-text {
  387. position: absolute;
  388. left: 50%;
  389. top: 50%;
  390. transform: translate(-50%, -50%);
  391. color: #fff;
  392. font-size: 22px;
  393. font-family: 'yjsz';
  394. font-weight: 500;
  395. }
  396. }
  397. .value-text1 {
  398. width: 100%;
  399. text-align: center;
  400. color: #fff;
  401. font-size: 22px;
  402. font-family: 'yjsz';
  403. font-weight: 500;
  404. }
  405. }
  406. }
  407. }
  408. .three-modal {
  409. width: 100%;
  410. height: 100%;
  411. padding: 20px 17px 20px 15px;
  412. box-sizing: border-box;
  413. position: relative;
  414. .btn-icon {
  415. width: 40px;
  416. height: 40px;
  417. background: url('/@/assets/images/vent/home/tosmall.png') no-repeat center;
  418. background-size: 100% 100%;
  419. position: absolute;
  420. z-index: 99999;
  421. bottom: 30px;
  422. right: 30px;
  423. }
  424. }
  425. }
  426. .wind-box {
  427. display: flex;
  428. flex: 1;
  429. width: 100%;
  430. background: url('../../../../assets/images/home-container/dialog1.png') no-repeat;
  431. background-size: 100% 100%;
  432. }
  433. }
  434. .right-content {
  435. display: flex;
  436. flex-direction: column;
  437. justify-content: space-between;
  438. flex: 1;
  439. height: 100%;
  440. .monitor-box {
  441. display: flex;
  442. flex: 1;
  443. width: 100%;
  444. background: url('../../../../assets/images/home-container/dialog.png') no-repeat;
  445. background-size: 100% 100%;
  446. }
  447. .monitor-box1 {
  448. margin: 10px 0px;
  449. }
  450. }
  451. }
  452. }
  453. // #__qiankun_microapp_wrapper_for_micro_vent_3_d_modal__{
  454. // width: 100% !important;
  455. // height: 100% !important;
  456. // }</style>