index.vue 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212
  1. <template>
  2. <div class="bg"
  3. style="width: 100%; height: 100%; display: flex; justify-content: center; align-items: center; overflow: hidden">
  4. <a-spin :spinning="loading" />
  5. <div id="chamber3D" v-show="!loading" style="width: 100%; height: 100%; position: absolute; overflow: hidden"> </div>
  6. <!-- <div id="damper3DCSS" v-show="!loading" style="width: 100%; height: 100%; top:0; left: 0; position: absolute; overflow: hidden;">
  7. <div>
  8. <div ref="elementContent" class="elementContent">
  9. <p><span class="data-title">压力(Pa):</span>{{selectData.frontRearDP}}</p>
  10. <p><span class="data-title">动力源压力(MPa):</span>{{selectData.sourcePressure}}</p>
  11. <p><span class="data-title">故障诊断:</span>
  12. <i
  13. :class="{'state-icon': true, 'open': selectData.messageBoxStatus, 'close': !selectData.messageBoxStatus}"
  14. ></i>{{selectData.fault}}</p>
  15. </div>
  16. </div>
  17. </div> -->
  18. </div>
  19. <div class="scene-box">
  20. <div class="title-text">
  21. {{ selectData.strname }}
  22. </div>
  23. <div class="center-container">
  24. <div class="lr left-box"></div>
  25. <div class="lr right-box">
  26. <div class="">
  27. </div>
  28. <div class="">
  29. </div>
  30. </div>
  31. </div>
  32. <div class="bottom-tabs-box">
  33. <MonitorTable columnsType="fiber_monitor" :dataSource="fiberDataSource" @selectRow="getSelectRow"
  34. design-scope="fiber-monitor" title="风窗监测" :scroll="{y: 240}" :isShowPagination="false">
  35. <template #filterCell="{ column, record }">
  36. <a-tag v-if="column.dataIndex === 'warnFlag'" :color="record.warnFlag == 0 ? 'green' : 'red'">{{
  37. record.warnFlag == 0 ? '正常' : '报警'
  38. }}</a-tag>
  39. <a-tag v-if="column.dataIndex === 'netStatus'" :color="record.netStatus == 0 ? 'default' : 'green'">{{
  40. record.netStatus == 0 ? '断开' : '连接'
  41. }}</a-tag>
  42. <div v-if="record.nwindownum == 1 && column.dataIndex === 'rearArea'">/</div>
  43. </template>
  44. </MonitorTable>
  45. </div>
  46. </div>
  47. </template>
  48. <script setup lang="ts">
  49. // import { message } from 'ant-design-vue';
  50. import { onBeforeMount, ref, onMounted, onUnmounted, reactive, toRaw } from 'vue';
  51. import MonitorTable from '../comment/MonitorTable.vue';
  52. import { mountedThree, destroy, addChamberText, setModelType } from './chamber.threejs';
  53. import { list } from './chamber.api';
  54. import lodash from 'lodash';
  55. const activeKey = ref('1');
  56. const loading = ref(false);
  57. // 默认初始是第一行
  58. const selectRowIndex = ref(0);
  59. const dataSource = ref([])
  60. const fiberDataSource = ref([]); //dusting
  61. const dustDataSource = ref([]);
  62. const tabChange = (activeKeyVal) => {
  63. activeKey.value = activeKeyVal;
  64. };
  65. const initData = {
  66. deviceID: '',
  67. deviceType: '',
  68. strname: '',
  69. };
  70. // 监测数据
  71. const selectData = reactive(lodash.cloneDeep(initData));
  72. // https获取监测数据
  73. let timer: null | NodeJS.Timeout = null;
  74. const getMonitor = () => {
  75. if (Object.prototype.toString.call(timer) === '[object Null]') {
  76. timer = setTimeout(async () => {
  77. const data = await getSysDataSource();
  78. Object.assign(selectData, data);
  79. if (timer) {
  80. timer = null;
  81. }
  82. getMonitor();
  83. }, 1000);
  84. }
  85. };
  86. const getSysDataSource = async () => {
  87. const res = await list({ devicetype: 'sys_dongshi', pagetype: 'normal' });
  88. dataSource.value = res.msgTxt[0].datalist || [];
  89. dataSource.value.forEach((data: any) => {
  90. const readData = data.readData;
  91. data = Object.assign(data, readData);
  92. });
  93. const data: any = toRaw(dataSource.value[selectRowIndex.value]); //maxarea
  94. return data;
  95. };
  96. const getDataSource = async (systemID) => {
  97. const res = await list({ devicetype: 'sys', systemID });
  98. const result = res.msgTxt[0];
  99. result.forEach(item => {
  100. if (item.type === 'dusting_auto') {
  101. // 喷粉
  102. dustDataSource.value = item.filter((data: any) => {
  103. const readData = data.readData;
  104. return Object.assign(data, readData);
  105. })
  106. }
  107. if (item.type === 'fiber_normal') {
  108. // 光纤
  109. fiberDataSource.value = item.filter((data: any) => {
  110. const readData = data.readData;
  111. return Object.assign(data, readData);
  112. })
  113. }
  114. if (item.type === 'sys') {
  115. // 硐室基本
  116. // fiberDataSource.value = item.filter((data: any) => {
  117. // const readData = data.readData;
  118. // return Object.assign(data, readData);
  119. // })
  120. }
  121. })
  122. }
  123. // 切换检测数据
  124. const getSelectRow = (selectRow, index) => {
  125. if (!selectRow) return;
  126. selectRowIndex.value = index;
  127. Object.assign(selectData, initData, selectRow);
  128. getDataSource(selectData.deviceID)
  129. // setModelType(type).then(() => {
  130. // });
  131. }
  132. onBeforeMount(() => {
  133. });
  134. onMounted(() => {
  135. loading.value = true;
  136. mountedThree().then(async () => {
  137. await setModelType('chamberBase');
  138. loading.value = false;
  139. getMonitor();
  140. });
  141. });
  142. onUnmounted(() => {
  143. destroy();
  144. if (timer) {
  145. clearTimeout(timer);
  146. timer = undefined;
  147. }
  148. });
  149. </script>
  150. <style lang="less" scoped>
  151. @import '/@/design/vent/modal.less';
  152. @ventSpace: zxm;
  153. .center-container{
  154. width: 100%;
  155. height: 550px;
  156. border: 1px solid #fff;
  157. margin-top: 30px;
  158. display: flex;
  159. justify-content: space-between;
  160. .lr{
  161. width: 250px;
  162. height: 100%;
  163. border: 1px solid #73e8fe;
  164. display: flex;
  165. flex-direction: column;
  166. }
  167. .right-box{
  168. width: 280px;
  169. }
  170. }
  171. :deep(.@{ventSpace}-tabs-tabpane-active) {
  172. overflow: auto;
  173. }
  174. .input-box {
  175. display: flex;
  176. align-items: center;
  177. padding-left: 10px;
  178. .input-title {
  179. color: #73e8fe;
  180. width: auto;
  181. }
  182. .@{ventSpace}-input-number {
  183. border-color: #ffffff88 !important;
  184. }
  185. margin-right: 10px;
  186. }
  187. </style>