index.vue 24 KB

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