index.vue 23 KB

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