index.vue 24 KB

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