index.vue 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698
  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. @select-row="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" 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. cameraAddrs.push({ name: item['name'], addr: item['addr'] });
  280. });
  281. }
  282. if (cameraNames.length > 0) {
  283. // 请求接口从装备院拿数据
  284. const addrs: string[] = await cameraAddrList({ cameraNameList: cameraNames });
  285. for (let i = 0; i < addrs.length; i++) {
  286. cameraAddrs.push({ name: '摄像头' + i, addr: addrs[i] });
  287. }
  288. }
  289. const obj = await deviceCameraInit(cameraAddrs, playerRef.value, webRtcServer);
  290. webRtcServer = obj.webRtcServerList;
  291. const playerDoms = obj.playerDoms;
  292. // 注意前后门适应需要对应 //[0] 后门 [1]前门
  293. await initCameraCanvas(...playerDoms);
  294. }
  295. // 切换检测数据
  296. async function getSelectRow(selectRow, index) {
  297. if (!selectRow) return;
  298. loading.value = true;
  299. selectRowIndex.value = index;
  300. const baseData: any = deviceBaseList.value.find((baseData: any) => baseData.id === selectRow.deviceID);
  301. Object.assign(selectData, initData, selectRow, baseData);
  302. isFrontOpenRunning = false; //开关门动作是否在进行
  303. isFrontCloseRunning = false; //开关门动作是否在进行
  304. isRearOpenRunning = false; //开关门动作是否在进行
  305. isRearCloseRunning = false; //开关门动作是否在进行
  306. frontDeviceState = 0; //记录设备状态,为了与下一次监测数据做比较
  307. rearDeviceState = 0; //记录设备状态,为了与下一次监测数据做比较
  308. // const type = selectData.nwindownum == 1 ? 'singleWindow' : 'doubleWindow';
  309. let type;
  310. if (selectData.deviceType == 'gate_ss') {
  311. type = 'fm2';
  312. } else {
  313. type = 'fm1';
  314. }
  315. setModelType(type).then(async () => {
  316. addMonitorText(selectData);
  317. loading.value = false;
  318. });
  319. await getCamera();
  320. }
  321. // 播放动画
  322. function playAnimation(handlerState) {
  323. switch (handlerState) {
  324. case 1: // 打开前门
  325. if (selectData.frontGateOpen == '0' && selectData.frontGateClose == '1') {
  326. modalTitle.value = '打开前门';
  327. modalType.value = '1';
  328. modalIsShow.value = true;
  329. } else {
  330. message.warning('前门已经打开或正在打开,请勿重新操作');
  331. }
  332. break;
  333. case 2: // 关闭前门
  334. if (selectData.frontGateOpen == '1' && selectData.frontGateClose == '0') {
  335. modalTitle.value = '关闭前门';
  336. modalType.value = '2';
  337. modalIsShow.value = true;
  338. } else {
  339. message.warning('前门已经关闭或正在关闭,请勿重新操作');
  340. }
  341. break;
  342. case 3: // 打开后门
  343. if (selectData.rearGateOpen == '0' && selectData.rearGateClose == '1') {
  344. modalTitle.value = '打开后门';
  345. modalType.value = '3';
  346. modalIsShow.value = true;
  347. } else {
  348. message.warning('后门已经打开或正在打开,请勿重新操作');
  349. }
  350. break;
  351. case 4: // 关闭后门
  352. if (selectData.rearGateOpen == '1' && selectData.rearGateClose == '0') {
  353. modalTitle.value = '关闭后门';
  354. modalType.value = '4';
  355. modalIsShow.value = true;
  356. } else {
  357. message.warning('后门已经关闭或正在关闭,请勿重新操作');
  358. }
  359. break;
  360. case 5: // 打开前后门
  361. if (
  362. selectData.frontGateOpen == '0' &&
  363. selectData.frontGateClose == '1' &&
  364. selectData.rearGateOpen == '0' &&
  365. selectData.rearGateClose == '1'
  366. ) {
  367. modalTitle.value = '打开前后门';
  368. modalType.value = '5';
  369. modalIsShow.value = true;
  370. } else {
  371. message.warning('前后门已经打开或正在打开,请勿重新操作');
  372. }
  373. break;
  374. case 6: // 关闭前后门
  375. if (
  376. selectData.frontGateOpen == '1' &&
  377. selectData.frontGateClose == '0' &&
  378. selectData.rearGateOpen == '1' &&
  379. selectData.rearGateClose == '0'
  380. ) {
  381. modalTitle.value = '关闭前后门';
  382. modalType.value = '6';
  383. modalIsShow.value = true;
  384. } else {
  385. message.warning('前后门已经关闭或正在关闭,请勿重新操作');
  386. }
  387. break;
  388. }
  389. if (globalConfig?.simulatedPassword) {
  390. handleOK('', handlerState + '');
  391. }
  392. }
  393. function handleOK(passWord, handlerState) {
  394. // if (passWord !== '123456') {
  395. // message.warning('密码不正确,请重新输入');
  396. // return;
  397. // }
  398. if ((isFrontOpenRunning || isFrontCloseRunning) && (handlerState == 2 || handlerState == 1 || handlerState == 5 || handlerState == 6)) {
  399. return;
  400. }
  401. if ((isRearOpenRunning || isRearCloseRunning) && (handlerState == 3 || handlerState == 4 || handlerState == 5 || handlerState == 6)) {
  402. return;
  403. }
  404. const data = {
  405. deviceid: selectData.deviceID,
  406. devicetype: selectData.deviceType,
  407. paramcode: '',
  408. value: null,
  409. password: passWord,
  410. masterComputer: selectData.masterComputer,
  411. };
  412. let handler = () => {};
  413. switch (handlerState) {
  414. case '1': // 打开前门
  415. if (selectData.frontGateOpen == '0' && selectData.frontGateClose == '1') {
  416. handler = () => {
  417. frontDoorIsOpen.value = true;
  418. };
  419. data.paramcode = 'frontGateOpen_S';
  420. }
  421. break;
  422. case '2': // 关闭前门
  423. if (selectData.frontGateOpen == '1' && selectData.frontGateClose == '0') {
  424. handler = () => {
  425. frontDoorIsOpen.value = false;
  426. };
  427. data.paramcode = 'frontGateClose_S';
  428. }
  429. break;
  430. case '3': // 打开后门
  431. if (selectData.rearGateOpen == '0' && selectData.rearGateClose == '1') {
  432. handler = () => {
  433. backDoorIsOpen.value = true;
  434. };
  435. data.paramcode = 'rearGateOpen_S';
  436. }
  437. break;
  438. case '4': // 关闭后门
  439. if (selectData.rearGateOpen == '1' && selectData.rearGateClose == '0') {
  440. handler = () => {
  441. backDoorIsOpen.value = false;
  442. };
  443. data.paramcode = 'rearGateClose_S';
  444. }
  445. break;
  446. case '5': // 打开前后门
  447. if (
  448. selectData.frontGateOpen == '0' &&
  449. selectData.frontGateClose == '1' &&
  450. selectData.rearGateOpen == '0' &&
  451. selectData.rearGateClose == '1'
  452. ) {
  453. handler = () => {
  454. frontDoorIsOpen.value = true;
  455. backDoorIsOpen.value = true;
  456. };
  457. data.paramcode = 'sameTimeOpen';
  458. }
  459. break;
  460. case '6': // 关闭前后门
  461. if (
  462. selectData.frontGateOpen == '1' &&
  463. selectData.frontGateClose == '0' &&
  464. selectData.rearGateOpen == '1' &&
  465. selectData.rearGateClose == '0'
  466. ) {
  467. handler = () => {
  468. frontDoorIsOpen.value = false;
  469. backDoorIsOpen.value = false;
  470. };
  471. data.paramcode = 'sameTimeClose';
  472. }
  473. break;
  474. }
  475. if (data.paramcode) {
  476. deviceControlApi(data).then((res) => {
  477. // 模拟时开启
  478. if (res.success) {
  479. modalIsShow.value = false;
  480. if (globalConfig.History_Type == 'remote') {
  481. message.success('指令已下发至生产管控平台成功!');
  482. } else {
  483. message.success('指令已下发成功!');
  484. }
  485. }
  486. });
  487. }
  488. }
  489. /** 开关门动画调用 */
  490. let isFrontOpenRunning = false; //开关门动作是否在进行
  491. let isFrontCloseRunning = false; //开关门动作是否在进行
  492. let isRearOpenRunning = false; //开关门动作是否在进行
  493. let isRearCloseRunning = false; //开关门动作是否在进行
  494. let frontDeviceState = 0; //记录设备状态,为了与下一次监测数据做比较
  495. let rearDeviceState = 0; //记录设备状态,为了与下一次监测数据做比较
  496. function monitorAnimation(selectData) {
  497. const timeScale = 0.003;
  498. if (selectData.frontGateOpenCtrl == 1 || selectData.frontGateOpenCtrl === true) {
  499. isFrontCloseRunning = false;
  500. if (selectData.frontGateOpen == 0 && selectData.frontGateClose == 0) {
  501. //打开前门1
  502. if (!isFrontOpenRunning) {
  503. frontDoorIsOpen.value = true;
  504. backDoorIsOpen.value = true;
  505. isFrontOpenRunning = true;
  506. play(1, timeScale);
  507. frontDeviceState = 1;
  508. }
  509. }
  510. if (selectData.frontGateOpen == 1 && selectData.frontGateClose == 0) {
  511. isFrontOpenRunning = false;
  512. if (frontDeviceState != 1) {
  513. import.meta.env.VITE_GLOB_IS_SIMULATE ? play(1, timeScale) : play(1);
  514. frontDeviceState = 1;
  515. frontDoorIsOpen.value = false;
  516. backDoorIsOpen.value = true;
  517. }
  518. }
  519. } else {
  520. if (selectData.frontGateOpen == 0 && selectData.frontGateClose == 0) {
  521. //关闭前门
  522. isFrontOpenRunning = false;
  523. if (!isFrontCloseRunning) {
  524. isFrontCloseRunning = true;
  525. play(2, timeScale);
  526. frontDeviceState = 2;
  527. frontDoorIsOpen.value = true;
  528. backDoorIsOpen.value = true;
  529. }
  530. }
  531. if (selectData.frontGateClose == 1 && selectData.frontGateOpen == 0) {
  532. isFrontCloseRunning = false;
  533. if (frontDeviceState == 1) {
  534. import.meta.env.VITE_GLOB_IS_SIMULATE ? play(2, timeScale) : play(2);
  535. frontDeviceState = 2;
  536. frontDoorIsOpen.value = false;
  537. // backDoorIsOpen.value = false
  538. }
  539. }
  540. }
  541. if (selectData.rearGateOpenCtrl == 1 || selectData.rearGateOpenCtrl === true) {
  542. isRearCloseRunning = false;
  543. if (selectData.rearGateOpen == 0 && selectData.rearGateClose == 0) {
  544. //打开后门
  545. if (!isRearOpenRunning) {
  546. isRearOpenRunning = true;
  547. play(3, timeScale);
  548. rearDeviceState = 3;
  549. frontDoorIsOpen.value = true;
  550. backDoorIsOpen.value = true;
  551. }
  552. }
  553. if (selectData.rearGateOpen == 1 && selectData.rearGateClose == 0) {
  554. isRearOpenRunning = false;
  555. if (rearDeviceState != 3) {
  556. rearDeviceState = 3;
  557. import.meta.env.VITE_GLOB_IS_SIMULATE ? play(3, timeScale) : play(3);
  558. backDoorIsOpen.value = false;
  559. frontDoorIsOpen.value = true;
  560. }
  561. }
  562. } else {
  563. if (selectData.rearGateOpen == 0 && selectData.rearGateClose == 0) {
  564. //关闭后门
  565. isRearOpenRunning = false;
  566. if (!isRearCloseRunning) {
  567. isRearCloseRunning = true;
  568. play(4, timeScale);
  569. rearDeviceState = 4;
  570. frontDoorIsOpen.value = true;
  571. backDoorIsOpen.value = true;
  572. }
  573. }
  574. if (selectData.rearGateClose == 1 && selectData.rearGateOpen == 0) {
  575. isRearCloseRunning = false;
  576. if (rearDeviceState == 3) {
  577. rearDeviceState = 4;
  578. import.meta.env.VITE_GLOB_IS_SIMULATE ? play(4, timeScale) : play(4);
  579. backDoorIsOpen.value = false;
  580. }
  581. }
  582. }
  583. // console.log('frontGateOpen:', selectData.frontGateOpen, ' frontGateClose:', selectData.frontGateClose, ' rearGateOpen:', selectData.rearGateOpen, ' rearGateClose:', selectData.rearGateClose, ' frontGateOpenCtrl:', selectData.frontGateOpenCtrl, ' rearGateOpenCtrl:', selectData.rearGateOpenCtrl)
  584. }
  585. function handleCancel() {
  586. modalIsShow.value = false;
  587. modalTitle.value = '';
  588. modalType.value = '';
  589. }
  590. // 远程、就地切换
  591. function changeType() {
  592. const data = {
  593. deviceid: selectData.deviceID,
  594. devicetype: selectData.deviceType,
  595. paramcode: 'autoRoManualControl',
  596. value: selectData.autoRoManual,
  597. };
  598. deviceControlApi(data).then(() => {
  599. if (globalConfig.History_Type == 'remote') {
  600. message.success('指令已下发至生产管控平台成功!');
  601. } else {
  602. message.success('指令已下发成功!');
  603. }
  604. });
  605. }
  606. onMounted(async () => {
  607. loading.value = true;
  608. mountedThree().then(async () => {
  609. await getMonitor(true);
  610. loading.value = false;
  611. });
  612. });
  613. onBeforeUnmount(() => {
  614. getDeviceBaseList();
  615. });
  616. onUnmounted(() => {
  617. if (timer) {
  618. clearTimeout(timer);
  619. timer = undefined;
  620. }
  621. destroy();
  622. if (webRtcServer.length > 0) {
  623. webRtcServer.forEach((item) => {
  624. item.disconnect();
  625. });
  626. }
  627. });
  628. </script>
  629. <style lang="less" scoped>
  630. @import '/@/design/vent/modal.less';
  631. .scene-box {
  632. .bottom-tabs-box {
  633. height: 350px;
  634. }
  635. }
  636. .button-box {
  637. border: none !important;
  638. height: 34px !important;
  639. &:hover {
  640. background: linear-gradient(#2cd1ff55, #1eb0ff55) !important;
  641. }
  642. &::before {
  643. height: 27px !important;
  644. background: linear-gradient(#1fa6cb, #127cb5) !important;
  645. }
  646. &::after {
  647. top: 35px !important;
  648. }
  649. }
  650. :deep(.@{ventSpace}-tabs-tabpane-active) {
  651. height: 100%;
  652. }
  653. ::-webkit-scrollbar-thumb {
  654. -webkit-box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
  655. background: #4288a444;
  656. }
  657. </style>