gasInjection.vue 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306
  1. <template>
  2. <div class="company-home">
  3. <div class="top-bg">
  4. <div class="main-title">{{ mainTitle }}</div>
  5. </div>
  6. <div class="main-container">
  7. <div class="nav-cards">
  8. <navMenu @toggleMenu="toggleMenu"></navMenu>
  9. </div>
  10. <template v-if="menuName == 'zjm'">
  11. <div class="main-status"> 运行中 </div>
  12. <ModuleGasInject
  13. v-for="cfg in configs"
  14. :key="cfg.deviceType"
  15. :show-style="cfg.showStyle"
  16. :module-data="cfg.moduleData"
  17. :module-name="cfg.moduleName"
  18. :device-type="cfg.deviceType"
  19. :data="data"
  20. :visible="true"
  21. :visible-detail="cfg.showDetail"
  22. />
  23. </template>
  24. <template v-else>
  25. <ModuleGasInject
  26. v-for="cfg in configs"
  27. :key="cfg.deviceType"
  28. :show-style="cfg.showStyle"
  29. :module-data="cfg.moduleData"
  30. :module-name="cfg.moduleName"
  31. :device-type="cfg.deviceType"
  32. :data="data"
  33. :visible="true"
  34. :visible-detail="cfg.showDetail"
  35. />
  36. </template>
  37. <div :class="{ 'vent-modal': menuName == 'zjm', 'vent-modal-1': menuName == 'syq' || menuName == 'zqxt' || menuName == 'ccxt' }">
  38. <div class="modal-box">
  39. <Three3D ref="three3D" :modalName="'zhuqi'" class="modal-3d" @success="initModalAnimate" />
  40. </div>
  41. </div>
  42. <!-- <div v-if="menuName === 'syq'" class="syq-modal">
  43. </div> -->
  44. </div>
  45. </div>
  46. </template>
  47. <script lang="ts" setup>
  48. import { onMounted, onUnmounted, ref, computed, nextTick } from 'vue';
  49. import { useInitConfigs, useInitPage } from './hooks/useInit';
  50. import ModuleGasInject from './components/ModuleGasInject.vue';
  51. import navMenu from './components/gasInject/navMenu.vue';
  52. import Three3D from './components/three3D.vue';
  53. import { getHomeData } from './configurable.api';
  54. // import { useRoute } from 'vue-router';
  55. import { testConfigGasInject, testConfigGasInjectZq, testConfigGasInjectCc, testConfigGasInjectSy } from './configurable.data';
  56. import { animateCamera } from '/@/utils/threejs/util';
  57. import { modalAnimate } from './threejs/gasInjection';
  58. // import * as dat from 'dat.gui';
  59. // const gui = new dat.GUI();
  60. // gui.domElement.style = 'position:absolute;top:100px;left:10px;z-index:99999999999999';
  61. const { configs, fetchConfigs } = useInitConfigs();
  62. const { mainTitle, data, updateData } = useInitPage('注气驱替智能管控系统');
  63. const three3D = ref(null);
  64. let interval: number | undefined;
  65. let menuName = ref('zjm');
  66. //选项切换
  67. function toggleMenu(param) {
  68. menuName.value = param;
  69. switch (menuName.value) {
  70. case 'zjm':
  71. configs.value = testConfigGasInject;
  72. break;
  73. case 'syq':
  74. configs.value = testConfigGasInjectSy;
  75. break;
  76. case 'zqxt':
  77. configs.value = testConfigGasInjectZq;
  78. break;
  79. case 'ccxt':
  80. configs.value = testConfigGasInjectCc;
  81. break;
  82. }
  83. // 刷新/
  84. nextTick(async () => {
  85. three3D.value?.resizeRenderer();
  86. const modal = three3D.value.getModal();
  87. if (modal) {
  88. const oldCamera = modal.camera;
  89. const oldCameraPosition = { x: oldCamera.position.x, y: oldCamera.position.y, z: oldCamera.position.z };
  90. if (param == 'zqxt') {
  91. const newP = { x: -26.587483577770445, y: -1.885170491810538, z: 39.104309663143255 };
  92. const newT = { x: 10.919881491980828, y: -4.7228274957026946, z: 38.87645926712004 };
  93. await animateCamera(oldCameraPosition, { x: 0, y: 0, z: 0 }, newP, newT, modal);
  94. } else if (param == 'zjm') {
  95. const newP = { x: -45.69228602978097, y: 49.59721939545517, z: 2.6454258202266985 };
  96. const newT = { x: 9.289291846942458, y: -21.608842010051386, z: 2.7675348357947906 };
  97. await animateCamera(oldCameraPosition, { x: 0, y: 0, z: 0 }, newP, newT, modal);
  98. } else {
  99. const newP = { x: -43.18945276107877, y: 40.44347648044, z: 0.059975838354020664 };
  100. const newT = { x: 6.431421158296241, y: -23.819993211059913, z: 0.17017939135402457 };
  101. await animateCamera(oldCameraPosition, { x: 0, y: 0, z: 0 }, newP, newT, modal);
  102. }
  103. }
  104. });
  105. }
  106. function initModalAnimate(modal) {
  107. console.log('初始化模型', modal);
  108. modal.isRender = true;
  109. modalAnimate(modal);
  110. }
  111. onMounted(() => {
  112. // fetchConfigs('vent_new').then(() => {
  113. configs.value = testConfigGasInject;
  114. // updateEnhancedConfigs(configs.value);
  115. getHomeData({}).then(updateData);
  116. // });
  117. setInterval(() => {
  118. getHomeData({}).then(updateData);
  119. }, 60000);
  120. });
  121. onUnmounted(() => {
  122. clearInterval(interval);
  123. });
  124. </script>
  125. <style lang="less" scoped>
  126. @import '/@/design/theme.less';
  127. @{theme-deepblue} {
  128. .company-home {
  129. --image-modal-top: url('@/assets/images/gasInjection/1-1.png');
  130. --image-modal-status: url('@/assets/images/gasInjection/3-1.png');
  131. --image-modal-center: url('@/assets/images/gasInjection/1-2.png');
  132. }
  133. }
  134. .company-home {
  135. --image-modal-top: url('@/assets/images/gasInjection/1-1.png');
  136. --image-modal-status: url('@/assets/images/gasInjection/3-1.png');
  137. --image-modal-center: url('@/assets/images/gasInjection/1-2.png');
  138. width: 100%;
  139. height: 100%;
  140. color: @white;
  141. position: relative;
  142. background: url('@/assets/images/vent/homeNew/bg.png') no-repeat center;
  143. .top-bg {
  144. width: 100%;
  145. height: 66px;
  146. background: var(--image-modal-top) no-repeat center;
  147. background-size: 100% 100%;
  148. position: absolute;
  149. z-index: 1;
  150. .main-title {
  151. height: 66px;
  152. font-family: 'douyuFont';
  153. font-size: 20px;
  154. letter-spacing: 2px;
  155. display: flex;
  156. justify-content: center;
  157. align-items: center;
  158. }
  159. .top-nav {
  160. position: absolute;
  161. top: 0;
  162. width: 880px;
  163. height: 100%;
  164. display: flex;
  165. justify-content: flex-start;
  166. }
  167. }
  168. .main-container {
  169. position: absolute;
  170. top: 66px;
  171. width: 100%;
  172. height: calc(100% - 66px);
  173. padding: 0px 10px;
  174. box-sizing: border-box;
  175. }
  176. .main-status {
  177. display: flex;
  178. justify-content: center;
  179. align-items: center;
  180. width: 440px;
  181. height: 80px;
  182. font-size: 18px;
  183. font-family: 'douyuFont';
  184. margin: 10px 0px;
  185. background: var(--image-modal-status);
  186. background-size: 100% 100%;
  187. }
  188. .module-dropdown {
  189. padding: 10px;
  190. background-image: @vent-configurable-dropdown;
  191. border-bottom: 2px solid @vent-configurable-home-light-border;
  192. color: @vent-font-color;
  193. position: absolute;
  194. top: 70px;
  195. right: 460px;
  196. }
  197. .modal-box {
  198. width: calc(100% - 20px);
  199. height: calc(100% - 20px);
  200. position: relative;
  201. pointer-events: auto;
  202. margin: 10px;
  203. }
  204. .module-dropdown-original {
  205. padding: 10px;
  206. background-image: @vent-configurable-dropdown;
  207. border-bottom: 2px solid @vent-configurable-home-light-border;
  208. color: @vent-font-color;
  209. position: absolute;
  210. top: 70px;
  211. right: 460px;
  212. }
  213. .module-trigger-button {
  214. color: @vent-font-color;
  215. background-image: @vent-configurable-dropdown;
  216. border: none;
  217. border-bottom: 2px solid @vent-configurable-home-light-border;
  218. }
  219. .nav-cards {
  220. position: absolute;
  221. left: 50%;
  222. top: 0px;
  223. transform: translate(-50%, 0);
  224. width: 691px;
  225. height: 58px;
  226. background: var(--image-modal-center) no-repeat;
  227. background-size: 100% 100%;
  228. }
  229. }
  230. :deep(.loading-box) {
  231. position: unset;
  232. }
  233. .modal-box {
  234. width: 100%;
  235. height: 100%;
  236. position: relative;
  237. pointer-events: auto;
  238. }
  239. // 试验区模型区域样式
  240. .syq-modal {
  241. position: absolute;
  242. top: 135px;
  243. right: 20px;
  244. width: calc(100% - 510px);
  245. height: 515px;
  246. background: url('@/assets/images/gasInjection/syq/modal-bg.png') no-repeat;
  247. background-size: 100% 100%;
  248. }
  249. .vent-modal {
  250. position: absolute;
  251. top: 70px;
  252. left: 50%;
  253. transform: translate(-50%, 0px);
  254. width: calc(100% - 920px);
  255. height: 500px;
  256. background: url(/src/assets/images/gasInjection/syq/modal-bg.png) no-repeat;
  257. background-size: 100% 100%;
  258. pointer-events: auto;
  259. // padding: 15px;
  260. box-sizing: border-box;
  261. overflow: hidden;
  262. }
  263. .vent-modal-1 {
  264. position: absolute;
  265. top: 70px;
  266. left: 460px;
  267. width: calc(100% - 470px);
  268. height: 500px;
  269. background: url(/src/assets/images/gasInjection/syq/modal-bg.png) no-repeat;
  270. background-size: 100% 100%;
  271. pointer-events: auto;
  272. padding: 10px 15px;
  273. box-sizing: border-box;
  274. overflow: hidden;
  275. }
  276. .modal-3d {
  277. width: 100%;
  278. }
  279. </style>