index.vue 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632
  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="deviceDetail" class="device-detail">
  5. <div id="deviceCard" class="device-card" style="z-index: -1; position: absolute">
  6. <div class="title">KJ-980-F矿用本安型监控分站</div>
  7. <div class="detail-box">
  8. <div class="left-box"></div>
  9. <div class="right-box">
  10. <div><span class="detail-title">规格型号:</span> <span>KJ-980-F</span></div>
  11. <div
  12. ><span class="detail-title">技术参数:</span>
  13. <span
  14. >380V,电机功率22kW,50Hz,B级绝缘,额定电流42.2A,效率90.5%,能效等级3,接法角型,2940r/min,轴承6311/CM 6211/CM,功率因数0.89</span
  15. ></div
  16. >
  17. </div>
  18. </div>
  19. </div>
  20. </div>
  21. <div id="damper3D" style="width: 100%; height: 100%; position: absolute; overflow: hidden"></div>
  22. </div>
  23. <div class="scene-box">
  24. <div class="top-box">
  25. <div class="top-center row">
  26. <!-- <div class="button-box" :class="{ 'button-disable': backDoorIsOpen }" @click="playAnimation(1)">打开前门</div>
  27. <div class="button-box" :class="{ 'button-disable': backDoorIsOpen }" @click="playAnimation(2)">关闭前门</div>
  28. <div class="button-box" :class="{ 'button-disable': frontDoorIsOpen }" @click="playAnimation(3)">打开后门</div>
  29. <div class="button-box" :class="{ 'button-disable': frontDoorIsOpen }" @click="playAnimation(4)">关闭后门</div>
  30. <div class="button-box" :class="{ 'button-disable': frontDoorIsOpen || backDoorIsOpen }" @click="playAnimation(5)">打开前后门</div> -->
  31. <!-- <div
  32. class="button-box"
  33. :class="{ 'button-disable': (frontDoorIsOpen && !backDoorIsOpen) || (backDoorIsOpen && !frontDoorIsOpen) }"
  34. @click="playAnimation(6)"
  35. >关闭前后门</div> -->
  36. <div class="button-box" @click="playAnimation(1)">打开前门</div>
  37. <div class="button-box" @click="playAnimation(2)">关闭前门</div>
  38. <div class="button-box" @click="playAnimation(3)">打开后门</div>
  39. <div class="button-box" @click="playAnimation(4)">关闭后门</div>
  40. <div class="button-box" @click="playAnimation(5)">打开前后门</div>
  41. <div
  42. class="button-box"
  43. @click="playAnimation(6)"
  44. >关闭前后门</div>
  45. <!-- <div class="button-box" @click="enterMY">漫游</div> -->
  46. </div>
  47. <div class="top-right row">
  48. <div class="control-type row">
  49. <div class="control-title">控制模式:</div>
  50. <a-radio-group v-model:value="selectData.masterComputer" @change="changeType">
  51. <a-radio :value="`0`">就地</a-radio>
  52. <a-radio :value="`1`">远程</a-radio>
  53. </a-radio-group>
  54. </div>
  55. <div class="run-type row">
  56. <div class="control-title">运行状态:</div>
  57. <a-radio-group v-model:value="controlType">
  58. <a-radio :value="`1`">检修</a-radio>
  59. </a-radio-group>
  60. </div>
  61. <div class="run-state row">
  62. <div class="control-title">网络状态:</div>
  63. <a-radio-group v-model:value="selectData.netStatus">
  64. <a-radio :value="`1`">运行</a-radio>
  65. </a-radio-group>
  66. </div>
  67. </div>
  68. </div>
  69. <div class="title-text">
  70. {{ selectData.strname }}
  71. </div>
  72. <div class="bottom-tabs-box" @mousedown="setDivHeight($event, 250, scroll)">
  73. <a-tabs class="tabs-box" v-model:activeKey="activeKey" @change="tabChange">
  74. <a-tab-pane key="1" tab="实时监测">
  75. <MonitorTable
  76. v-if="activeKey === '1' && isRefresh"
  77. class="monitor-table"
  78. columnsType="gate_monitor"
  79. :dataSource="dataSource"
  80. design-scope="gate-monitor"
  81. @selectRow="getSelectRow"
  82. :scroll="scroll"
  83. title="风门监测"
  84. :isShowPagination="false"
  85. >
  86. <template #filterCell="{ column, record }">
  87. <template v-if="record.frontGateOpenCtrl">
  88. <a-tag v-if="column.dataIndex === 'frontGateOpen' && record.frontGateOpen == 0 && record.frontGateClose == 0" color="red">正在打开</a-tag>
  89. <a-tag v-else-if="column.dataIndex === 'frontGateOpen'" color="processing">打开</a-tag>
  90. </template>
  91. <template v-else>
  92. <a-tag v-if="column.dataIndex === 'frontGateOpen' && record.frontGateOpen == 0 && record.frontGateClose == 0" color="red">正在关闭</a-tag>
  93. <a-tag v-else-if="column.dataIndex === 'frontGateOpen' && record.frontGateOpen == 0 && record.frontGateClose == 1" color="default">关闭</a-tag>
  94. <a-tag v-else-if="column.dataIndex === 'frontGateOpen' && record.frontGateOpen == 1 && record.frontGateClose == 0" color="default">打开</a-tag>
  95. </template>
  96. <template v-if="record.rearGateOpenCtrl">
  97. <a-tag v-if="column.dataIndex === 'rearGateOpen' && record.rearGateOpen == 0 && record.rearGateClose == 0" color="red">正在打开</a-tag>
  98. <a-tag v-else-if="column.dataIndex === 'rearGateOpen'" color="processing">打开</a-tag>
  99. </template>
  100. <template v-else>
  101. <a-tag v-if="column.dataIndex === 'rearGateOpen' && record.rearGateOpen == 0 && record.rearGateClose == 0" color="red">正在关闭</a-tag>
  102. <a-tag v-else-if="column.dataIndex === 'rearGateOpen' && record.rearGateOpen == 0 && record.rearGateClose == 1" color="default">关闭</a-tag>
  103. <a-tag v-else-if="column.dataIndex === 'rearGateOpen' && record.rearGateOpen == 1 && record.rearGateClose == 0" color="default">打开</a-tag>
  104. </template>
  105. <a-tag v-if="column.dataIndex === 'warnFlag'" :color="record.warnFlag == 0 ? 'green' : 'red'">{{
  106. record.warnFlag == 0 ? '正常' : '报警'
  107. }}</a-tag>
  108. <a-tag v-if="column.dataIndex === 'netStatus'" :color="record.netStatus == 0 ? 'default' : 'green'">{{
  109. record.netStatus == 0 ? '断开' : '连接'
  110. }}</a-tag>
  111. </template>
  112. </MonitorTable>
  113. </a-tab-pane>
  114. <a-tab-pane key="2" tab="实时曲线图" force-render>
  115. <div class="tab-item" v-if="activeKey === '2' && isRefresh">
  116. <DeviceEcharts
  117. chartsColumnsType="gate_chart"
  118. xAxisPropType="strname"
  119. :dataSource="dataSource"
  120. height="100%"
  121. :chartsColumns="chartsColumns"
  122. :device-list-api="list"
  123. device-type="gate"
  124. />
  125. </div>
  126. </a-tab-pane>
  127. <a-tab-pane key="3" tab="历史数据">
  128. <div class="tab-item" v-if="activeKey === '3' && isRefresh">
  129. <HistoryTable columns-type="gate" device-type="gate" :device-list-api="getTableList" designScope="gate-history" :scroll="scroll"/>
  130. </div>
  131. </a-tab-pane>
  132. <a-tab-pane key="4" tab="报警历史">
  133. <div class="tab-item" v-if="activeKey === '4' && isRefresh">
  134. <AlarmHistoryTable columns-type="alarm" device-type="gate" :device-list-api="getTableList" designScope="alarm-history" :scroll="scroll"/>
  135. </div>
  136. </a-tab-pane>
  137. <a-tab-pane key="5" tab="操作历史">
  138. <div class="tab-item" v-if="activeKey === '5' && isRefresh">
  139. <HandlerHistoryTable columns-type="operatorhistory" device-type="gate" :device-list-api="getTableList" designScope="alarm-history" :scroll="scroll"/>
  140. </div>
  141. </a-tab-pane>
  142. </a-tabs>
  143. </div>
  144. </div>
  145. <div style="z-index: -1; position: absolute; top: 50px; right: 10px; width: 300px; height: 280px; margin: auto" class="palyer1">
  146. <LivePlayer id="fm-player1" ref="player1" :videoUrl="flvURL1()" muted live loading controls />
  147. <LivePlayer id="fm-player2" ref="player2" :videoUrl="flvURL1()" muted live loading controls style="margin-top: 10px" />
  148. </div>
  149. <!-- <a-modal v-model:visible="modalIsShow" :title="modalTitle" @ok="handleOk">
  150. <div class="modal-container">
  151. <div class="vent-flex-row">
  152. <ExclamationCircleFilled style="color: #ffb700; font-size: 30px" />
  153. <div class="warning-text">您是否要进行{{ modalTitle }}操作?</div>
  154. </div>
  155. </div>
  156. </a-modal> -->
  157. <HandleModal :modal-is-show="modalIsShow" :modal-title="modalTitle" :modal-type="modalType" @handle-ok="handleOK" @handle-cancel="handleCancel" />
  158. </template>
  159. <script setup lang="ts">
  160. import LivePlayer from '@liveqing/liveplayer-v3';
  161. import {onBeforeUnmount, onUnmounted, onMounted, ref, reactive, toRaw, nextTick, watch } from 'vue';
  162. import DeviceEcharts from '../comment/DeviceEcharts.vue';
  163. import MonitorTable from '../comment/MonitorTable.vue';
  164. import HistoryTable from '../comment/HistoryTable.vue';
  165. import AlarmHistoryTable from '../comment/AlarmHistoryTable.vue';
  166. import HandlerHistoryTable from '../comment/HandlerHistoryTable.vue';
  167. import HandleModal from './modal.vue';
  168. import { mountedThree, addFmText, play, destroy, setModelType } from './gate.threejs';
  169. import { deviceControlApi } from '/@/api/vent/index';
  170. import { message } from 'ant-design-vue';
  171. import { list, getTableList } from './gate.api';
  172. import { chartsColumns } from './gate.data';
  173. import lodash from 'lodash';
  174. import { setDivHeight } from '/@/utils/event';
  175. const player1 = ref(null);
  176. const player2 = ref(null);
  177. const activeKey = ref('1'); // tab
  178. const loading = ref(false);
  179. const isRefresh = ref(true)
  180. const scroll = reactive({
  181. y: 240
  182. })
  183. const frontDoorIsOpen = ref(false); //前门是否开启
  184. const backDoorIsOpen = ref(false); //后门是否开启
  185. const modalIsShow = ref<boolean>(false); // 是否显示模态框
  186. const modalTitle = ref(''); // 模态框标题显示内容,根据设备操作类型决定
  187. const modalType = ref(''); // 模态框内容显示类型,设备操作类型
  188. const selectRowIndex = ref(0); // 选中行
  189. const dataSource = ref([]);
  190. const deviceBaseList = ref([]); // 设备基本信息
  191. const controlType = ref(1); // 设备运行状态
  192. const tabChange = (activeKeyVal) => {
  193. activeKey.value = activeKeyVal;
  194. };
  195. const initData = {
  196. deviceID: '',
  197. deviceType: '',
  198. strname: '',
  199. frontRearDP: '-', //压差
  200. sourcePressure: '-', //气源压力
  201. netStatus: '0', //通信状态
  202. frontGateOpen: '0',
  203. frontGateClose: '1',
  204. rearGateOpen: '0',
  205. rearGateClose: '1',
  206. fault: '气源压力超限',
  207. masterComputer: 0,
  208. frontGateOpenCtrl: false,
  209. rearGateOpenCtrl: false
  210. };
  211. // 监测数据
  212. const selectData = reactive(lodash.cloneDeep(initData));
  213. const flvURL1 = () => {
  214. // return `https://sf1-hscdn-tos.pstatp.com/obj/media-fe/xgplayer_doc_video/flv/xgplayer-demo-360p.flv`;
  215. return ''
  216. };
  217. const flvURL2 = () => {
  218. return `https://sf1-hscdn-tos.pstatp.com/obj/media-fe/xgplayer_doc_video/flv/xgplayer-demo-360p.flv`;
  219. };
  220. // 获取设备基本信息列表
  221. function getDeviceBaseList() {
  222. getTableList({ pageSize: 1000 }).then((res) => {
  223. deviceBaseList.value = res.records;
  224. });
  225. };
  226. // https获取监测数据
  227. let timer: null | NodeJS.Timeout = null;
  228. function getMonitor(flag?){
  229. if (Object.prototype.toString.call(timer) === '[object Null]') {
  230. timer = setTimeout(() => {
  231. list({ devicetype: 'gate', pagetype: 'normal' }).then((res) => {
  232. if (res.msgTxt && res.msgTxt[0]) {
  233. dataSource.value = res.msgTxt[0].datalist || [];
  234. dataSource.value.forEach((data: any) => {
  235. const readData = data.readData;
  236. data = Object.assign(data, readData);
  237. });
  238. if (dataSource.value.length > selectRowIndex.value) {
  239. const data: any = toRaw(dataSource.value[selectRowIndex.value]); //maxarea
  240. Object.assign(selectData, data);
  241. addFmText(selectData);
  242. monitorAnimation(selectData)
  243. if (timer) {
  244. timer = null;
  245. }
  246. getMonitor();
  247. }
  248. }
  249. });
  250. }, flag ? 0 : 1000);
  251. }
  252. };
  253. // 切换检测数据
  254. async function getSelectRow(selectRow, index) {
  255. if (!selectRow) return;
  256. loading.value = true;
  257. selectRowIndex.value = index;
  258. const baseData: any = deviceBaseList.value.find((baseData: any) => baseData.id === selectRow.deviceID);
  259. Object.assign(selectData, initData, selectRow, baseData);
  260. isFrontRunning = false //开关门动作是否在进行
  261. isRearRunning = false //开关门动作是否在进行
  262. frontDeviceState = 0 //记录设备状态,为了与下一次监测数据做比较
  263. rearDeviceState = 0 //记录设备状态,为了与下一次监测数据做比较
  264. // const type = selectData.nwindownum == 1 ? 'singleWindow' : 'doubleWindow';
  265. setModelType('fm1').then(() => {
  266. addFmText(selectData);
  267. loading.value = false;
  268. });
  269. };
  270. // 播放动画
  271. function playAnimation(handlerState) {
  272. switch (handlerState) {
  273. case 1: // 打开前门
  274. if (selectData.frontGateOpen == '0' && selectData.frontGateClose == '1') {
  275. modalTitle.value = '打开前门';
  276. modalType.value = '1';
  277. modalIsShow.value = true;
  278. }else{
  279. message.warning('前门已经打开或正在打开,请勿重新操作')
  280. }
  281. break;
  282. case 2: // 关闭前门
  283. if (selectData.frontGateOpen == '1' && selectData.frontGateClose == '0') {
  284. modalTitle.value = '关闭前门';
  285. modalType.value = '2';
  286. modalIsShow.value = true;
  287. } else {
  288. message.warning('前门已经关闭或正在关闭,请勿重新操作')
  289. }
  290. break;
  291. case 3: // 打开后门
  292. if (selectData.rearGateOpen == '0' && selectData.rearGateClose == '1') {
  293. modalTitle.value = '打开后门';
  294. modalType.value = '3';
  295. modalIsShow.value = true;
  296. } else {
  297. message.warning('后门已经打开或正在打开,请勿重新操作')
  298. }
  299. break;
  300. case 4: // 关闭后门
  301. if (selectData.rearGateOpen == '1' && selectData.rearGateClose == '0') {
  302. modalTitle.value = '关闭后门';
  303. modalType.value = '4';
  304. modalIsShow.value = true;
  305. } else {
  306. message.warning('后门已经关闭或正在关闭,请勿重新操作')
  307. }
  308. break;
  309. case 5: // 打开前后门
  310. if (selectData.frontGateOpen == '0' && selectData.frontGateClose == '1' && selectData.rearGateOpen == '0' && selectData.rearGateClose == '1') {
  311. modalTitle.value = '打开前后门';
  312. modalType.value = '5';
  313. modalIsShow.value = true;
  314. } else {
  315. message.warning('前后门已经打开或正在打开,请勿重新操作')
  316. }
  317. break;
  318. case 6: // 关闭前后门
  319. if (selectData.frontGateOpen == '1' && selectData.frontGateClose == '0' && selectData.rearGateOpen == '1' && selectData.rearGateClose == '0') {
  320. modalTitle.value = '关闭前后门';
  321. modalType.value = '6';
  322. modalIsShow.value = true;
  323. } else {
  324. message.warning('前后门已经关闭或正在关闭,请勿重新操作')
  325. }
  326. break;
  327. }
  328. };
  329. function handleOK(passWord, handlerState) {
  330. if (passWord !== '123456') {
  331. message.warning('密码不正确,请重新输入');
  332. return;
  333. }
  334. if(isFrontRunning && (handlerState == 2 || handlerState == 1 || handlerState == 5 || handlerState == 6)){
  335. return
  336. }
  337. if (isRearRunning && (handlerState == 3 || handlerState == 4 || handlerState == 5 || handlerState == 6)) {
  338. return
  339. }
  340. const data = {
  341. deviceid: selectData.deviceID,
  342. devicetype: selectData.deviceType,
  343. paramcode: '',
  344. value: null,
  345. masterComputer: selectData.masterComputer,
  346. };
  347. let handler = () => {};
  348. switch (handlerState) {
  349. case '1': // 打开前门
  350. if (selectData.frontGateOpen == '0' && selectData.frontGateClose == '1') {
  351. handler = () => {
  352. frontDoorIsOpen.value = true;
  353. };
  354. data.paramcode = 'frontGateOpen_S';
  355. }
  356. break;
  357. case '2': // 关闭前门
  358. if (selectData.frontGateOpen == '1' && selectData.frontGateClose == '0') {
  359. handler = () => {
  360. frontDoorIsOpen.value = false;
  361. };
  362. data.paramcode = 'frontGateClose_S';
  363. }
  364. break;
  365. case '3': // 打开后门
  366. if (selectData.rearGateOpen == '0' && selectData.rearGateClose == '1') {
  367. handler = () => {
  368. backDoorIsOpen.value = true;
  369. };
  370. data.paramcode = 'rearGateOpen_S';
  371. }
  372. break;
  373. case '4': // 关闭后门
  374. if (selectData.rearGateOpen == '1' && selectData.rearGateClose == '0') {
  375. handler = () => {
  376. backDoorIsOpen.value = false;
  377. };
  378. data.paramcode = 'rearGateClose_S';
  379. }
  380. break;
  381. case '5': // 打开前后门
  382. if (selectData.frontGateOpen == '0' && selectData.frontGateClose == '1' && selectData.rearGateOpen == '0' && selectData.rearGateClose == '1') {
  383. handler = () => {
  384. frontDoorIsOpen.value = true;
  385. backDoorIsOpen.value = true;
  386. };
  387. data.paramcode = 'sameTimeOpen';
  388. }
  389. break;
  390. case '6': // 关闭前后门
  391. if (selectData.frontGateOpen == '1' && selectData.frontGateClose == '0' && selectData.rearGateOpen == '1' && selectData.rearGateClose == '0') {
  392. handler = () => {
  393. frontDoorIsOpen.value = false;
  394. backDoorIsOpen.value = false;
  395. };
  396. data.paramcode = 'sameTimeClose';
  397. }
  398. break;
  399. }
  400. if (data.paramcode) {
  401. deviceControlApi(data)
  402. .then((res) => {
  403. // 模拟时开启
  404. if (res.success) {
  405. modalIsShow.value = false;
  406. message.success('操作成功!')
  407. }
  408. })
  409. }
  410. };
  411. /** 开关门动画调用 */
  412. let isFrontRunning = false //开关门动作是否在进行
  413. let isRearRunning = false //开关门动作是否在进行
  414. let frontDeviceState = 0 //记录设备状态,为了与下一次监测数据做比较
  415. let rearDeviceState = 0 //记录设备状态,为了与下一次监测数据做比较
  416. function monitorAnimation(selectData) {
  417. const timeScale = 0.0003
  418. if (selectData.frontGateOpenCtrl) {
  419. if (selectData.frontGateOpen == 0 && selectData.frontGateClose == 0) {
  420. //打开前门1
  421. if(!isFrontRunning){
  422. frontDoorIsOpen.value = true
  423. backDoorIsOpen.value = true
  424. isFrontRunning = true
  425. play(1, timeScale)
  426. frontDeviceState = 1
  427. }
  428. }
  429. if (selectData.frontGateOpen == 1 && selectData.frontGateClose == 0) {
  430. isFrontRunning = false
  431. if (frontDeviceState != 1) {
  432. import.meta.env.VITE_GLOB_IS_SIMULATE ? play(1, timeScale) : play(1)
  433. frontDeviceState = 1
  434. frontDoorIsOpen.value = false
  435. backDoorIsOpen.value = true
  436. }
  437. }
  438. } else {
  439. if (selectData.frontGateOpen == 0 && selectData.frontGateClose == 0) {
  440. //关闭前门
  441. if(!isFrontRunning){
  442. isFrontRunning = true
  443. play(2, timeScale)
  444. frontDeviceState = 2
  445. frontDoorIsOpen.value = true
  446. backDoorIsOpen.value = true
  447. }
  448. }
  449. if (selectData.frontGateClose == 1 && selectData.frontGateOpen == 0) {
  450. isFrontRunning = false
  451. if (frontDeviceState == 1) {
  452. import.meta.env.VITE_GLOB_IS_SIMULATE ? play(2, timeScale) : play(2)
  453. frontDeviceState = 2
  454. frontDoorIsOpen.value = false
  455. // backDoorIsOpen.value = false
  456. }
  457. }
  458. }
  459. if (selectData.rearGateOpenCtrl) {
  460. if (selectData.rearGateOpen == 0 && selectData.rearGateClose == 0) {
  461. //打开后门
  462. if(!isRearRunning){
  463. isRearRunning = true
  464. play(3, timeScale)
  465. rearDeviceState = 3
  466. frontDoorIsOpen.value = true
  467. backDoorIsOpen.value = true
  468. }
  469. }
  470. if (selectData.rearGateOpen == 1 && selectData.rearGateClose == 0) {
  471. isRearRunning = false
  472. if (rearDeviceState != 3) {
  473. rearDeviceState = 3
  474. import.meta.env.VITE_GLOB_IS_SIMULATE ? play(3, timeScale) : play(3)
  475. backDoorIsOpen.value = false
  476. frontDoorIsOpen.value = true
  477. }
  478. }
  479. } else {
  480. if (selectData.rearGateOpen == 0 && selectData.rearGateClose == 0) {
  481. //关闭后门
  482. if(!isRearRunning){
  483. isRearRunning = true
  484. play(4, timeScale)
  485. rearDeviceState = 4
  486. frontDoorIsOpen.value = true
  487. backDoorIsOpen.value = true
  488. }
  489. }
  490. if (selectData.rearGateClose == 1 && selectData.rearGateOpen == 0) {
  491. isRearRunning = false
  492. if (rearDeviceState == 3) {
  493. rearDeviceState = 4
  494. import.meta.env.VITE_GLOB_IS_SIMULATE ? play(4, timeScale) : play(4)
  495. // frontDoorIsOpen.value = false
  496. backDoorIsOpen.value = false
  497. }
  498. }
  499. }
  500. // if(!(selectData.frontGateOpen == 0 && selectData.frontGateClose == 0 && selectData.rearGateOpen == 0 && selectData.rearGateClose == 0)) {
  501. // if (selectData.frontGateOpenCtrl && selectData.rearGateOpenCtrl && selectData.frontGateOpen == 1 && selectData.rearGateOpen == 1) {
  502. // frontDoorIsOpen.value = true
  503. // backDoorIsOpen.value = true
  504. // }
  505. // if (!selectData.frontGateOpenCtrl && !selectData.rearGateOpenCtrl && selectData.frontGateClose == 1 && selectData.rearGateClose == 1) {
  506. // frontDoorIsOpen.value = false
  507. // backDoorIsOpen.value = false
  508. // }
  509. // }
  510. }
  511. function handleCancel() {
  512. modalIsShow.value = false;
  513. modalTitle.value = '';
  514. modalType.value = '';
  515. };
  516. // 远程、就地切换
  517. function changeType() {
  518. const data = {
  519. deviceid: selectData.deviceID,
  520. devicetype: selectData.deviceType,
  521. paramcode: 'masterComputerControl',
  522. value: selectData.masterComputer,
  523. };
  524. deviceControlApi(data).then(() => {
  525. message.success('状态切换成功!');
  526. });
  527. };
  528. // 视频播放
  529. function addPlayVideo() {
  530. if (player1.value && player2.value && player1.value?.play && player2.value?.play) {
  531. // player1.value.setMuted(false);
  532. // player2.value.setMuted(false);
  533. player1.value.play();
  534. player2.value.play();
  535. document.body.removeEventListener('mousedown', addPlayVideo);
  536. }
  537. };
  538. watch(() => scroll.y, () => {
  539. isRefresh.value = false
  540. nextTick(() => {
  541. isRefresh.value = true
  542. })
  543. })
  544. onMounted(() => {
  545. loading.value = true;
  546. mountedThree(player1.value, player2.value).then(() => {
  547. getMonitor(true);
  548. loading.value = false;
  549. });
  550. document.body.addEventListener('mousedown', addPlayVideo, false);
  551. });
  552. onBeforeUnmount(() => {
  553. getDeviceBaseList();
  554. });
  555. onUnmounted(() => {
  556. if (timer) {
  557. clearTimeout(timer);
  558. timer = undefined;
  559. }
  560. destroy();
  561. });
  562. </script>
  563. <style lang="less" scoped>
  564. @import '/@/design/vent/modal.less';
  565. .button-box {
  566. border: none !important;
  567. height: 34px !important;
  568. &:hover {
  569. background: linear-gradient(#2cd1ff55, #1eb0ff55) !important;
  570. }
  571. &::before {
  572. height: 27px !important;
  573. background: linear-gradient(#1fa6cb, #127cb5) !important;
  574. }
  575. &::after {
  576. top: 35px !important;
  577. }
  578. }
  579. :deep(.@{ventSpace}-tabs-tabpane-active) {
  580. overflow: auto;
  581. }
  582. ::-webkit-scrollbar-thumb {
  583. -webkit-box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
  584. background: #4288A444;
  585. }
  586. </style>