index.vue 25 KB

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