index.vue 25 KB

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