index.vue 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258
  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. import { getTableList } from './gasAssessment.api';
  73. type DeviceType = { deviceType: string; deviceName: string; datalist: any[] };
  74. const activeKey = ref('gasAssessment');
  75. const loading = ref(false);
  76. const dataSource = ref<DeviceType[]>([]);
  77. const pageType = ref('workFace');
  78. const activeUnitId = ref('');
  79. const gasUnitDataSource = ref([]);
  80. const isRefreshUnit = ref(false);
  81. function changeActive(activeValue) {
  82. activeKey.value = activeValue;
  83. }
  84. // 获取模型类型
  85. const changeModalType = (currentData) => {
  86. // 根据抽采单元
  87. isRefreshUnit.value = false;
  88. clearCss3D();
  89. clearTimeout(timer);
  90. timer = undefined;
  91. loading.value = true;
  92. setTimeout(async () => {
  93. setModelType(modalType);
  94. isRefreshUnit.value = true;
  95. timer = null;
  96. await getMonitor(true);
  97. setPlanes(gasUnitDataSource.value);
  98. setCss3D(gasUnitDataSource.value);
  99. loading.value = false;
  100. }, 1000);
  101. };
  102. const gasUnitNum = ref(5);
  103. let modalType = 'workFace1';
  104. const { options, optionValue, deviceActive, deviceValue, getSelectRow, getDeviceList } = useSystemSelect('sys_surface*', changeModalType);
  105. async function getSysDataSource() {
  106. let res = await getTableList({ strtype: 'sys_surface*', pagetype: 'normal' });
  107. if (res && res.records && res.records.length > 0) {
  108. if (options.value.length == 0) {
  109. // 初始时选择第一条数据
  110. for (let i = 0; i < res.records.length; i++) {
  111. const item = res.records[i];
  112. if (item['linkdevices'] && item['linkdevices'].length > 0) {
  113. const index = item['linkdevices'].findIndex((linkDevice) => linkDevice['deviceKind'] == 'unit');
  114. if (index > -1) {
  115. options.value.push(item);
  116. }
  117. }
  118. }
  119. }
  120. if (!optionValue.value && options.value.length > 0) {
  121. optionValue.value = options.value[0]['id'];
  122. getDeviceList(true);
  123. getSelectRow(optionValue.value);
  124. }
  125. }
  126. }
  127. // // 监测数据
  128. const selectData = ref([]);
  129. const monitorDataGroupNum = ref(0);
  130. // // https获取监测数据
  131. let timer: null | NodeJS.Timeout = null;
  132. function getMonitor(flag?) {
  133. if (Object.prototype.toString.call(timer) === '[object Null]') {
  134. return new Promise((resolve) => {
  135. timer = setTimeout(
  136. async () => {
  137. dataSource.value = await getDeviceList();
  138. const gasUnitData = dataSource.value.find((item) => item.deviceType.startsWith('unit'));
  139. if (gasUnitData) {
  140. gasUnitDataSource.value = gasUnitData['datalist'];
  141. monitorDataGroupNum.value = gasUnitData['datalist'].length;
  142. }
  143. if (timer) {
  144. timer = null;
  145. }
  146. resolve(1);
  147. await getMonitor();
  148. loading.value = false;
  149. },
  150. flag ? 0 : 1000
  151. );
  152. });
  153. }
  154. }
  155. watch(
  156. pageType,
  157. (newVal, oldVal) => {
  158. console.log('页面类型', newVal);
  159. if (newVal == 'gasUnit') {
  160. } else if (newVal == 'workFace') {
  161. }
  162. },
  163. {}
  164. );
  165. onBeforeMount(() => {});
  166. onMounted(async () => {
  167. loading.value = true;
  168. timer = null;
  169. mountedThree(pageType, activeUnitId).then(async () => {
  170. gasUnitNum.value = 4;
  171. loading.value = false;
  172. await getSysDataSource();
  173. nextTick(async () => {
  174. await getMonitor(true);
  175. });
  176. });
  177. });
  178. onUnmounted(() => {
  179. if (timer) {
  180. clearTimeout(timer);
  181. }
  182. timer = undefined;
  183. destroy();
  184. });
  185. </script>
  186. <style lang="less">
  187. @import '/@/design/vent/modal.less';
  188. .@{ventSpace}-select-dropdown {
  189. background: #ffffff !important;
  190. border-bottom: 1px solid rgba(236, 236, 236, 0.4);
  191. backdrop-filter: blur(10px);
  192. .@{ventSpace}-select-item-option-selected,
  193. .@{ventSpace}-select-item-option-active {
  194. background-color: #ffffff33 !important;
  195. }
  196. .@{ventSpace}-select-item:hover {
  197. background-color: #ffffff33 !important;
  198. }
  199. }
  200. </style>
  201. <style lang="less" scoped>
  202. @ventSpace: zxm;
  203. @import '/@/design/vent/modal.less';
  204. @import '@/views/vent/monitorManager/comment/less/workFace.less';
  205. .bg {
  206. width: 100%;
  207. height: 100%;
  208. display: flex;
  209. justify-content: center;
  210. align-items: center;
  211. overflow: hidden;
  212. position: absolute;
  213. pointer-events: auto;
  214. z-index: 0;
  215. }
  216. .point-event {
  217. pointer-events: none !important;
  218. }
  219. :deep(.four-border-bg) {
  220. backdrop-filter: blur(10px);
  221. .title {
  222. text-align: center;
  223. color: var(--vent-modal-title);
  224. }
  225. .monitor-item {
  226. display: flex;
  227. justify-content: space-between;
  228. .monitor-title {
  229. width: 90px;
  230. }
  231. .monitor-val {
  232. color: var(--vent-modal-title);
  233. .val {
  234. padding-right: 3px;
  235. }
  236. }
  237. }
  238. }
  239. </style>