index.vue 15 KB

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