index.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330
  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="window3D" v-show="!loading" style="width: 100%; height: 100%; position: absolute; overflow: hidden"> </div>
  5. <!-- <div id="damper3DCSS" v-show="!loading" style="width: 100%; height: 100%; top:0; left: 0; position: absolute; overflow: hidden;">
  6. <div>
  7. <div ref="elementContent" class="elementContent">
  8. <p><span class="data-title">压力(Pa):</span>{{selectData.frontRearDP}}</p>
  9. <p><span class="data-title">动力源压力(MPa):</span>{{selectData.sourcePressure}}</p>
  10. <p><span class="data-title">故障诊断:</span>
  11. <i
  12. :class="{'state-icon': true, 'open': selectData.messageBoxStatus, 'close': !selectData.messageBoxStatus}"
  13. ></i>{{selectData.fault}}</p>
  14. </div>
  15. </div>
  16. </div> -->
  17. </div>
  18. <div class="scene-box">
  19. <div class="top-box">
  20. <div class="top-left row"> 井下测风装置集中管理 </div>
  21. <div class="top-center row">
  22. <div class="button-box" @click="start(0)">复位</div>
  23. <div class="button-box" @click="testPlay()">自测动画</div>
  24. <div class="button-box" @click="testPlay('up')">上</div>
  25. <div class="button-box" @click="testPlay('center')">中</div>
  26. <div class="button-box" @click="testPlay('down')">下</div>
  27. <div class="button-box" @click="testPlay('reset')">复位</div>
  28. </div>
  29. <div class="top-right row">
  30. <div class="control-type row">
  31. <div class="control-title">控制模式:</div>
  32. <a-radio-group v-model:value="controlType">
  33. <a-radio :value="1">就地</a-radio>
  34. <a-radio :value="2">远程</a-radio>
  35. </a-radio-group>
  36. </div>
  37. <div class="run-type row">
  38. <div class="control-title">运行状态:</div>
  39. <a-radio-group v-model:value="controlType">
  40. <a-radio :value="1">检修</a-radio>
  41. </a-radio-group>
  42. </div>
  43. <div class="run-state row">
  44. <div class="control-title">网络状态:</div>
  45. <a-radio-group v-model:value="controlType">
  46. <a-radio :value="1">运行</a-radio>
  47. </a-radio-group>
  48. </div>
  49. </div>
  50. </div>
  51. <div class="title-box"> 2-2煤主辅三联巷自动风窗 </div>
  52. <div class="tabs-box">
  53. <div class="tabs-button-group">
  54. <a-button class="tabs-button" type="primary" @click="start(1)">一键测风</a-button>
  55. <a-button class="tabs-button" type="primary">导出报表</a-button>
  56. </div>
  57. <a-tabs v-model:activeKey="activeKey" @change="tabChange">
  58. <a-tab-pane key="1" tab="实时监测">
  59. <MonitorTable columnsType="windrect_monitor" :dataSource="dataSource" design-scope="windrect-monitor" @selectRow="getSelectRow" title="测风装置监测" />
  60. </a-tab-pane>
  61. <a-tab-pane key="2" tab="实时曲线图" force-render>
  62. <div class="tab-item" v-if="activeKey === '2'">
  63. <lineMulti :chartData="dataSource" xAxisPropType="strname" :propTypeArr="propTypeArr" height="40vh" width="100%" />
  64. </div>
  65. </a-tab-pane>
  66. <a-tab-pane key="3" tab="历史数据">
  67. <div class="tab-item"> Content of Tab Pane 2 </div>
  68. </a-tab-pane>
  69. <a-tab-pane key="4" tab="操作历史">
  70. <div class="tab-item"> Content of Tab Pane 2 </div>
  71. </a-tab-pane>
  72. <a-tab-pane key="5" tab="实时报警">
  73. <div class="tab-item"> Content of Tab Pane 2 </div>
  74. </a-tab-pane>
  75. </a-tabs>
  76. </div>
  77. </div>
  78. <div style=" z-index: -1; position: absolute; top: 50px; right: 10px; width:300px;height:280px;margin:auto" class="palyer">
  79. <LivePlayer id="cf-player1" ref="player1" :videoUrl="flvURL1()" muted live loading controls />
  80. <LivePlayer id="cf-player2" ref="player2" :videoUrl="flvURL1()" muted live loading controls style="margin-top: 10px"/>
  81. </div>
  82. </template>
  83. <script setup lang="ts">
  84. import '/@/assets/less/modal.less';
  85. import lineMulti from '/@/components/chart/LineMulti.vue';
  86. import { onBeforeMount, computed, ref, onMounted, nextTick, onUnmounted, reactive, toRaw } from 'vue';
  87. import MonitorTable from '../comment/MonitorTable.vue';
  88. import { initWebSocket, getRecordList } from '/@/hooks/web/useVentWebSocket';
  89. import { deviceControlApi } from '/@/api/vent/index';
  90. import { mountedThree, destroy, addFmText, play, setModelType } from './windrect.threejs';
  91. import LivePlayer from '@liveqing/liveplayer-v3'
  92. import { list } from "/@/views/vent/monitorManager/windowMonitor/window.api";
  93. import { initOpenState } from "/@/views/vent/monitorManager/gateMonitor/gate.threejs";
  94. const player1 = ref(null)
  95. const player2 = ref(null)
  96. const activeKey = ref('1');
  97. const loading = ref(false);
  98. // 默认初始是第一行
  99. const selectRowIndex = ref(0);
  100. // 监测数据
  101. const selectData = reactive({
  102. deviceID: '',
  103. deviceType: '',
  104. strname: '',
  105. dataDh: '-', //压差
  106. dataDtestq: '-', //测试风量
  107. sourcePressure: '-', //气源压力
  108. dataDequivalarea: '-',
  109. netStatus: '0', //通信状态
  110. fault: '气源压力超限',
  111. });
  112. const flvURL1 = () =>{
  113. return `https://sf1-hscdn-tos.pstatp.com/obj/media-fe/xgplayer_doc_video/flv/xgplayer-demo-360p.flv`
  114. }
  115. const flvURL2 = () =>{
  116. return `https://sf1-hscdn-tos.pstatp.com/obj/media-fe/xgplayer_doc_video/flv/xgplayer-demo-360p.flv`
  117. }
  118. // const dataSource = computed(() => {
  119. // const data = [...getRecordList()] || [];
  120. // Object.assign(selectData, toRaw(data[selectRowIndex.value]));
  121. // addFmText(selectData);
  122. // return data;
  123. // });
  124. const dataSource = ref([]);
  125. const propTypeArr = new Map([
  126. ['incipientWindSpeed1', 'V1风速'],
  127. ['incipientWindSpeed2', 'V2风速'],
  128. ['incipientWindSpeed3', 'V3风速'],
  129. ['sourcePressure', '气源压力'],
  130. ]);
  131. const tabChange = (activeKeyVal) => {
  132. activeKey.value = activeKeyVal;
  133. };
  134. // 设备数据
  135. const controlType = ref(1);
  136. // https获取监测数据
  137. let timer: null | NodeJS.Timeout = null;
  138. const getMonitor = () => {
  139. if (Object.prototype.toString.call(timer) === '[object Null]') {
  140. timer = setTimeout(() => {
  141. list({ devicetype: 'windrect', pagetype: 'normal' }).then((res) => {
  142. dataSource.value = res.msgTxt[0].datalist || [];
  143. dataSource.value.forEach((data: any) => {
  144. const readData = data.readData;
  145. data = Object.assign(data, readData);
  146. });
  147. const data: any = toRaw(dataSource.value[selectRowIndex.value]); //maxarea
  148. Object.assign(selectData, data);
  149. addFmText(selectData);
  150. // 根据3个点位分别执行动画
  151. if(timer){
  152. timer = null;
  153. }
  154. getMonitor();
  155. });
  156. }, 1000);
  157. }
  158. };
  159. // 自测动画方法
  160. const testPlay = (flag) => {
  161. play(flag)
  162. // setTimeout(() => {
  163. // play('up')
  164. // }, 0)
  165. // setTimeout(() => {
  166. // play('center')
  167. // }, 10000)
  168. // setTimeout(() => {
  169. // play('down')
  170. // }, 40000)
  171. // setTimeout(() => {
  172. // play('up')
  173. // }, 60000)
  174. }
  175. // 切换检测数据
  176. const getSelectRow = (selectRow, index) => {
  177. selectRowIndex.value = index
  178. loading.value = true
  179. Object.assign(selectData, selectRow)
  180. const type = selectRowIndex.value < 6 ? 'lmWindRect': 'zdWindRect'
  181. setModelType(type).then(() => {
  182. addFmText(selectData);
  183. loading.value = false;
  184. })
  185. }
  186. const start = (flag) => {
  187. const data = {
  188. deviceid: selectData.deviceID,
  189. devicetype: selectData.deviceType,
  190. paramcode: flag == 1 ? 'testStart' : '',
  191. };
  192. deviceControlApi(data)
  193. .then((res) => {
  194. if (res.success) {
  195. //
  196. }
  197. })
  198. }
  199. const addPlayVideo = () => {
  200. if(player1.value.play && player2.value.play) {
  201. // player1.value.setMuted(false);
  202. // player2.value.setMuted(false);
  203. player1.value.play();
  204. player2.value.play();
  205. document.body.removeEventListener('mousedown', addPlayVideo)
  206. }
  207. }
  208. onBeforeMount(() => {
  209. // const sendVal = JSON.stringify({ pagetype: 'normal', devicetype: 'windrect', orgcode: '', ids: '', systemID: '' });
  210. // initWebSocket(sendVal);
  211. document.body.addEventListener('mousedown', addPlayVideo, false);
  212. });
  213. onMounted(() => {
  214. loading.value = true;
  215. mountedThree(player1.value, player2.value).then(() => {
  216. nextTick(() => {
  217. loading.value = false;
  218. getMonitor()
  219. addFmText(selectData);
  220. });
  221. });
  222. });
  223. onUnmounted(() => {
  224. destroy();
  225. if(timer) {
  226. clearTimeout(timer)
  227. timer = undefined;
  228. }
  229. });
  230. </script>
  231. <style scoped lang="less">
  232. .input-box {
  233. display: flex;
  234. align-items: center;
  235. .input-title {
  236. color: rgb(0, 255, 242);
  237. width: auto;
  238. }
  239. margin-right: 10px;
  240. }
  241. :deep(.jeecg-basic-table .ant-table-wrapper) {
  242. background-color: #ffffff00;
  243. }
  244. :deep(.ant-tabs-bar) {
  245. margin: 0;
  246. }
  247. :deep(.ant-table) {
  248. background-color: #ffffff00 !important;
  249. color: #fff;
  250. }
  251. :deep(.ant-table-header) {
  252. background-color: transparent;
  253. // height: 42px;
  254. }
  255. :deep(.ant-table-thead > tr > th) {
  256. background-color: transparent;
  257. border: none;
  258. }
  259. :deep(.ant-table-body > tr > th) {
  260. background-color: transparent;
  261. border: none;
  262. }
  263. :deep(.ant-table-body > tr > td) {
  264. border: none;
  265. }
  266. :deep(.ant-table-fixed-header > .ant-table-content > .ant-table-scroll > .ant-table-body) {
  267. background-color: #ffffff05;
  268. margin-top: 8px;
  269. &::-webkit-scrollbar {
  270. display: none;
  271. }
  272. }
  273. :deep(.jeecg-basic-table .ant-table-wrapper .ant-table-title) {
  274. padding: 0;
  275. }
  276. :deep(.jeecg-basic-table-row__striped td) {
  277. background-color: transparent;
  278. }
  279. :deep(.ant-table-tbody > tr:hover.ant-table-row > td) {
  280. background-color: #ffffff22;
  281. }
  282. :deep(.ant-table-tbody > tr:hover.ant-table-row > th) {
  283. background-color: #ffffff22;
  284. }
  285. :deep(.ant-table-thead > tr:hover.ant-table-row > td) {
  286. background-color: #ffffff22;
  287. }
  288. :deep(.ant-table-tbody > tr.ant-table-row-selected td) {
  289. background-color: #ffffff22;
  290. }
  291. :deep(.ant-table-tbody > tr > td) {
  292. border-color: #ffffff22;
  293. }
  294. :deep(.ant-table-thead > tr > th:hover) {
  295. background-color: transparent !important;
  296. }
  297. :deep(.ant-table-thead > tr > th) {
  298. color: #fff;
  299. }
  300. :deep(.ant-table-fixed-header .ant-table-scroll .ant-table-header) {
  301. background: #ffffff44;
  302. position: relative;
  303. z-index: 999;
  304. padding: 4px 0 !important;
  305. &::-webkit-scrollbar {
  306. display: none;
  307. }
  308. }
  309. :deep(.ant-tabs-nav) {
  310. color: #fff;
  311. }
  312. </style>