index.vue 9.6 KB

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