index.vue 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268
  1. <template>
  2. <div class="bg" style="width: 100%; height: 100%; display: flex; justify-content: center; align-items: center; overflow: hidden">
  3. <a-spin :spinning="loading" />
  4. <div id="fanLocal3D" style="width: 100%; height: 100%; position: absolute; overflow: hidden"> </div>
  5. <div id="fanLocal3DCSS" class="threejs-Object-CSS" style="width: 100%; height: 100%; position: absolute; overflow: hidden">
  6. <div style="z-index: -1; position: relative">
  7. <div class="elementTag" id="inputBox">
  8. <div class="elementContent">
  9. <p>风筒入口风速:{{ selectData.windSpeed1 ? selectData.windSpeed1 : '-' }}</p>
  10. <p>风筒入口瓦斯浓度 {{ selectData.gas1 ? selectData.gas1 : '-' }}</p>
  11. </div>
  12. </div>
  13. <div class="elementTag" id="outBox">
  14. <div class="elementContent elementContent-r">
  15. <p>迎头供风量:{{ selectData.windQuantity1 ? selectData.windQuantity2 : '-' }}</p>
  16. <p>迎头瓦斯浓度:{{ selectData.gas1 ? selectData.gas1 : '-' }}</p>
  17. </div>
  18. </div>
  19. <div class="elementTag" id="returnBox">
  20. <div class="elementContent">
  21. <p>回风流瓦斯浓度:{{ selectData.gas3 ? selectData.gas3 : '-' }}</p>
  22. </div>
  23. </div>
  24. <div class="elementTag" id="gateBox">
  25. <div class="elementContent">
  26. <p>风门状态:关</p>
  27. <p>风门过风面积:{{ selectData.gas1 ? selectData.gas1 : '-' }}</p>
  28. </div>
  29. </div>
  30. <div class="elementTag" id="windownBox">
  31. <div class="elementContent">
  32. <p>风窗全风压回风流:0</p>
  33. </div>
  34. </div>
  35. </div>
  36. </div>
  37. </div>
  38. <div class="scene-box">
  39. <div class="title-text">
  40. {{ selectData.strinstallpos }}
  41. </div>
  42. <div class="bottom-tabs-box" @mousedown="setDivHeight($event, 240, scroll)">
  43. <dv-border-box8 :dur="5" :style="`padding: 5px; height: ${scroll.y + 100}px`" >
  44. <a-tabs class="tabs-box" v-model:activeKey="activeKey" @change="tabChange">
  45. <a-tab-pane key="1" tab="实时监测">
  46. <GroupMonitorTable ref="MonitorDataTable" v-if="activeKey === '1' " :dataSource="dataSource" columnsType="sys_surface_junya" @selectRow="getSelectRow" :scroll="scroll"/>
  47. </a-tab-pane>
  48. <a-tab-pane key="2" tab="实时曲线图" force-render>
  49. <div class="tab-item" v-if="activeKey === '2' ">
  50. <div class="vent-flex-row-between" style="height: 100%">
  51. <BarSingle
  52. :xAxisData="[
  53. { key: 'T1', valueKey: 'gas1' },
  54. { key: 'T2', valueKey: 'gas2' },
  55. { key: 'T3', valueKey: 'gas3' },
  56. { key: 'T4', valueKey: 'gas4' },
  57. ]"
  58. :dataSource="dataSource[selectRowIndex]"
  59. height="100%"
  60. :chartsColumns="chartsColumns"
  61. style="flex: 3"
  62. />
  63. <BarSingle
  64. :xAxisData="[
  65. { key: 'F1', valueKey: 'windQuantity1' },
  66. { key: 'F2', valueKey: 'windQuantity2' },
  67. ]"
  68. :dataSource="dataSource[selectRowIndex]"
  69. height="100%"
  70. :chartsColumns="chartsColumns1"
  71. style="flex: 2"
  72. />
  73. </div>
  74. </div>
  75. </a-tab-pane>
  76. <a-tab-pane key="3" tab="历史数据">
  77. <div class="tab-item" v-if="activeKey === '3' ">
  78. <HistoryTable columns-type="sys_surface_junya" device-type="sys_surface_junya" :device-list-api="baseList" designScope="sys_surface_junya-history" />
  79. </div>
  80. </a-tab-pane>
  81. <a-tab-pane key="4" tab="报警历史">
  82. <div class="tab-item" v-if="activeKey === '4' ">
  83. <AlarmHistoryTable columns-type="alarm" device-type="sys_surface_junya" :device-list-api="baseList" designScope="alarm-history" />
  84. </div>
  85. </a-tab-pane>
  86. <a-tab-pane key="5" tab="操作历史">
  87. <div class="tab-item" v-if="activeKey === '5' ">
  88. <HandlerHistoryTable columns-type="operator_history" device-type="sys_surface_junya" :device-list-api="baseList" designScope="alarm-history" />
  89. </div>
  90. </a-tab-pane>
  91. </a-tabs>
  92. </dv-border-box8>
  93. </div>
  94. </div>
  95. <div style="z-index: -1; position: absolute; top: 50px; right: 10px; width: 300px; height: 280px; margin: auto" class="player1">
  96. <LivePlayer id="jb-player1" ref="player1" :videoUrl="flvURL1()" muted live loading controls />
  97. </div>
  98. </template>
  99. <script setup lang="ts">
  100. import { onBeforeMount, ref, onMounted, nextTick, toRaw, reactive, onUnmounted, watch } from 'vue';
  101. import BarSingle from '../../../../components/chart/BarSingle.vue';
  102. import GroupMonitorTable from '../comment/GroupMonitorTable.vue';
  103. import HistoryTable from '../comment/HistoryTable.vue';
  104. import AlarmHistoryTable from '../comment/AlarmHistoryTable.vue';
  105. import HandlerHistoryTable from '../comment/HandlerHistoryTable.vue';
  106. import { mountedThree, setModelType, destroy, addCssText, addText, playSmoke } from './balancePress.three';
  107. import lodash from 'lodash';
  108. import { getTableList, list } from '/@/views/vent/monitorManager/fanLocalMonitor/fanLocal.api';
  109. import { list as baseList } from '../../deviceManager/fanTabel/fan.api';
  110. import { chartsColumns, chartsColumns1 } from './balancePress.data';
  111. import LivePlayer from '@liveqing/liveplayer-v3';
  112. import { setDivHeight } from '/@/utils/event';
  113. import { BorderBox8 as DvBorderBox8 } from '@kjgl77/datav-vue3';
  114. const scroll = reactive({
  115. y: 180
  116. })
  117. const loading = ref(false);
  118. const activeKey = ref('1');
  119. const player1 = ref();
  120. // 默认初始是第一行
  121. const selectRowIndex = ref(0);
  122. // 监测数据
  123. const initData = {
  124. deviceID: '',
  125. deviceType: '',
  126. strname: '',
  127. dataDh: '-', //压差
  128. dataDtestq: '-', //测试风量
  129. sourcePressure: '-', //气源压力
  130. dataDequivalarea: '-',
  131. netStatus: '0', //通信状态
  132. fault: '气源压力超限',
  133. };
  134. const flvURL1 = () => {
  135. // return `https://sf1-hscdn-tos.pstatp.com/obj/media-fe/xgplayer_doc_video/flv/xgplayer-demo-360p.flv`;
  136. return ''
  137. };
  138. // 监测数据
  139. const selectData = reactive(lodash.cloneDeep(initData));
  140. const tabChange = (activeKeyVal) => {
  141. activeKey.value = activeKeyVal;
  142. // if (activeKeyVal == 1) {
  143. // nextTick(() => {
  144. // MonitorDataTable.value.setSelectedRowKeys([selectData.deviceID])
  145. // })
  146. // }
  147. };
  148. const dataSource = ref([]);
  149. //
  150. async function getDataSource(){
  151. const res = await list({ devicetype: 'sys_surface_junya', pagetype: 'normal' });
  152. const dataArr = res.msgTxt[0].datalist || [];
  153. dataSource.value = [];
  154. dataArr.forEach((data) => {
  155. const readData = data.readData;
  156. data = Object.assign(data, readData);
  157. dataSource.value.push(data);
  158. });
  159. const data: any = toRaw(dataSource.value[selectRowIndex.value]); //maxarea
  160. return data;
  161. };
  162. // https获取监测数据
  163. let timer: null | NodeJS.Timeout = null;
  164. function getMonitor(flag?) {
  165. if (Object.prototype.toString.call(timer) === '[object Null]') {
  166. timer = setTimeout(async () => {
  167. await getDataSource();
  168. Object.assign(selectData, deviceBaseList.value, dataSource.value[selectRowIndex.value]);
  169. addText(selectData);
  170. // playAnimation(data, selectData.maxarea);
  171. if (timer) {
  172. timer = null;
  173. }
  174. getMonitor();
  175. }, flag ? 0 :1000);
  176. }
  177. };
  178. // 获取设备基本信息列表
  179. const deviceBaseList = ref([]);
  180. function getDeviceBaseList() {
  181. getTableList({ pageSize: 1000 }).then((res) => {
  182. deviceBaseList.value = res.records;
  183. });
  184. };
  185. // 切换检测数据
  186. function getSelectRow(id) {
  187. if (!id) return;
  188. loading.value = true;
  189. const baseDataIndex: any = dataSource.value.findIndex((baseData: any) => baseData.deviceID === id);
  190. selectRowIndex.value = baseDataIndex;
  191. const type = baseDataIndex > 0 ? 'fm' : 'fc';
  192. setModelType(type).then(() => {
  193. loading.value = false;
  194. });
  195. // const data = dataSource.value[baseDataIndex];
  196. // addCssText(selectRowIndex.value);
  197. return;
  198. };
  199. function addPlayVideo() {
  200. if (player1.value && player1.value.play) {
  201. if (!player1.value.paused()) player1.value.play();
  202. document.body.removeEventListener('mousedown', addPlayVideo);
  203. }
  204. };
  205. onBeforeMount(() => {
  206. getDeviceBaseList();
  207. });
  208. onMounted(() => {
  209. // loading.value = true;
  210. mountedThree(player1.value).then(() => {
  211. nextTick(() => {
  212. getMonitor(true);
  213. // addCssText(selectRowIndex.value);
  214. playSmoke('startSmoke', 'top', 30, 'open');
  215. });
  216. });
  217. document.body.addEventListener('mousedown', addPlayVideo, false);
  218. });
  219. onUnmounted(() => {
  220. destroy();
  221. if (timer) {
  222. clearTimeout(timer);
  223. timer = undefined;
  224. }
  225. });
  226. </script>
  227. <style scoped lang="less">
  228. @import '/@/design/vent/modal.less';
  229. :deep(.@{ventSpace}-tabs-tabpane-active) {
  230. overflow: auto;
  231. }
  232. .input-box {
  233. display: flex;
  234. align-items: center;
  235. .input-title {
  236. color: #73e8fe;
  237. width: auto;
  238. }
  239. margin-right: 10px;
  240. }
  241. .label {
  242. max-width: 220px;
  243. }
  244. .@{ventSpace}-input {
  245. width: 150px;
  246. }
  247. </style>