index.vue 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235
  1. <template>
  2. <CustomHeader
  3. :fieldNames="{ label: 'systemname', value: 'id', options: 'children' }"
  4. :options="options"
  5. @change="getSelectRow"
  6. :optionValue="optionValue"
  7. >瓦斯抽采达标评判</CustomHeader
  8. >
  9. <div class="bg" style="">
  10. <div id="workFace3D" style="width: 100%; height: 100%; position: absolute; overflow: hidden; z-index: 1; top: 0; pointer-events: auto"> </div>
  11. <div
  12. id="workFace3DCSS"
  13. v-show="pageType == 'workFace'"
  14. class="threejs-Object-CSS"
  15. style="width: 100%; height: 100%; position: absolute; pointer-events: none; overflow: hidden; z-index: 1; top: 0"
  16. >
  17. </div>
  18. </div>
  19. <template v-if="isRefreshUnit">
  20. <div class="modal-monitor vent-flex-row" style="display: none">
  21. <div v-for="groupNum in monitorDataGroupNum" :id="'gasUnitBox' + groupNum" :key="groupNum" style="margin: 0 5px">
  22. <FourBorderBg class="four-border-bg">
  23. <div class="title">抽采单元{{ groupNum }}</div>
  24. <div class="monitor-item" v-for="(gasUnit, index) in gasUnitDetail" :key="index">
  25. <div class="monitor-title">{{ gasUnit.title }}:</div>
  26. <div class="monitor-val">
  27. <span class="val">
  28. {{
  29. gasUnitDataSource[groupNum - 1] && gasUnitDataSource[groupNum - 1][gasUnit.code]
  30. ? gasUnitDataSource[groupNum - 1][gasUnit.code]
  31. : '-'
  32. }} </span
  33. ><span>{{ gasUnit.unit }}</span>
  34. </div>
  35. </div>
  36. </FourBorderBg>
  37. </div>
  38. </div>
  39. </template>
  40. <template v-if="activeKey == 'gasAssessment'">
  41. <WorkFace class="point-event" v-if="pageType == 'workFace'" :data-source="dataSource" />
  42. <gasUnit class="point-event" v-if="pageType == 'gasUnit'" />
  43. </template>
  44. <template v-if="activeKey == 'gasEcharts'">
  45. <GasEcharts class="point-event" />
  46. </template>
  47. <template v-if="activeKey == 'gasControl'">
  48. <GasControl class="point-event" />
  49. </template>
  50. <template v-if="activeKey == 'gasPiping'">
  51. <GasPiping class="point-event" />
  52. </template>
  53. <template v-if="activeKey == 'gasVideo'">
  54. <GasVideo class="point-event" />
  55. </template>
  56. <BottomMenu :navList="monitorNav" @change="changeActive" />
  57. </template>
  58. <script setup lang="ts">
  59. import FourBorderBg from '/@/components/vent/fourBorderBg.vue';
  60. import { onBeforeMount, ref, onMounted, onUnmounted, nextTick, watch } from 'vue';
  61. import CustomHeader from '/@/components/vent/customHeader.vue';
  62. import { gasUnitDetail, monitorNav } from './gasAssessment.data';
  63. import { mountedThree, destroy, setModelType, setCss3D, setPlanes, clearCss3D } from './threejs/gasAssessmen.threejs';
  64. import { useSystemSelect } from '/@/hooks/vent/useSystemSelect';
  65. import gasUnit from './components/gasUnit.vue';
  66. import GasEcharts from './components/gasEcharts.vue';
  67. import GasControl from './components/gasControl.vue';
  68. import GasPiping from './components/gasPipingEcharts.vue';
  69. import WorkFace from './components/workFace.vue';
  70. import GasVideo from './components/gasVideo.vue';
  71. import BottomMenu from '/@/views/vent/comment/components/bottomMenu.vue';
  72. type DeviceType = { deviceType: string; deviceName: string; datalist: any[] };
  73. const activeKey = ref('gasAssessment');
  74. const loading = ref(false);
  75. const dataSource = ref<DeviceType[]>([]);
  76. const pageType = ref('workFace');
  77. const activeUnitId = ref('');
  78. const gasUnitDataSource = ref([]);
  79. const isRefreshUnit = ref(false);
  80. function changeActive(activeValue) {
  81. activeKey.value = activeValue;
  82. }
  83. // 获取模型类型
  84. const changeModalType = (currentData) => {
  85. // 根据抽采单元
  86. isRefreshUnit.value = false;
  87. clearCss3D();
  88. timer = undefined;
  89. clearTimeout(timer);
  90. nextTick(async () => {
  91. setModelType(modalType);
  92. isRefreshUnit.value = true;
  93. timer = null;
  94. await getMonitor(true);
  95. setPlanes(gasUnitDataSource.value);
  96. setCss3D(gasUnitDataSource.value);
  97. });
  98. };
  99. const { options, optionValue, deviceActive, deviceValue, getSelectRow, getSysDataSource, getDeviceList } = useSystemSelect(
  100. 'sys_surface_caimei',
  101. changeModalType
  102. );
  103. const gasUnitNum = ref(5);
  104. let modalType = 'workFace1';
  105. // // 监测数据
  106. const selectData = ref([]);
  107. const monitorDataGroupNum = ref(0);
  108. // // https获取监测数据
  109. let timer: null | NodeJS.Timeout = null;
  110. function getMonitor(flag?) {
  111. if (Object.prototype.toString.call(timer) === '[object Null]') {
  112. return new Promise((resolve) => {
  113. timer = setTimeout(
  114. async () => {
  115. dataSource.value = await getDeviceList();
  116. const gasUnitData = dataSource.value.find((item) => item.deviceType.startsWith('unit'));
  117. if (gasUnitData) {
  118. gasUnitDataSource.value = gasUnitData['datalist'];
  119. monitorDataGroupNum.value = gasUnitData['datalist'].length;
  120. }
  121. if (timer) {
  122. timer = null;
  123. }
  124. resolve(1);
  125. await getMonitor();
  126. loading.value = false;
  127. },
  128. flag ? 0 : 1000
  129. );
  130. });
  131. }
  132. }
  133. watch(
  134. pageType,
  135. (newVal, oldVal) => {
  136. console.log('页面类型', newVal);
  137. if (newVal == 'gasUnit') {
  138. } else if (newVal == 'workFace') {
  139. }
  140. },
  141. {}
  142. );
  143. onBeforeMount(() => {});
  144. onMounted(async () => {
  145. loading.value = true;
  146. timer = null;
  147. mountedThree(pageType, activeUnitId).then(async () => {
  148. gasUnitNum.value = 4;
  149. loading.value = false;
  150. await getSysDataSource();
  151. nextTick(async () => {
  152. await getMonitor(true);
  153. });
  154. });
  155. });
  156. onUnmounted(() => {
  157. if (timer) {
  158. clearTimeout(timer);
  159. timer = undefined;
  160. }
  161. destroy();
  162. });
  163. </script>
  164. <style lang="less">
  165. @import '/@/design/vent/modal.less';
  166. .@{ventSpace}-select-dropdown {
  167. background: #ffffff !important;
  168. border-bottom: 1px solid rgba(236, 236, 236, 0.4);
  169. backdrop-filter: blur(10px);
  170. .@{ventSpace}-select-item-option-selected,
  171. .@{ventSpace}-select-item-option-active {
  172. background-color: #ffffff33 !important;
  173. }
  174. .@{ventSpace}-select-item:hover {
  175. background-color: #ffffff33 !important;
  176. }
  177. }
  178. </style>
  179. <style lang="less" scoped>
  180. @ventSpace: zxm;
  181. @import '/@/design/vent/modal.less';
  182. @import '@/views/vent/monitorManager/comment/less/workFace.less';
  183. .bg {
  184. width: 100%;
  185. height: 100%;
  186. display: flex;
  187. justify-content: center;
  188. align-items: center;
  189. overflow: hidden;
  190. position: absolute;
  191. pointer-events: auto;
  192. z-index: 0;
  193. }
  194. .point-event {
  195. pointer-events: none !important;
  196. }
  197. :deep(.four-border-bg) {
  198. backdrop-filter: blur(10px);
  199. .title {
  200. text-align: center;
  201. color: var(--vent-modal-title);
  202. }
  203. .monitor-item {
  204. display: flex;
  205. justify-content: space-between;
  206. .monitor-title {
  207. width: 90px;
  208. }
  209. .monitor-val {
  210. color: var(--vent-modal-title);
  211. .val {
  212. padding-right: 3px;
  213. }
  214. }
  215. }
  216. }
  217. </style>