index.vue 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657
  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. ></div
  16. >
  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" :class="{ 'button-disable': backDoorIsOpen }" @click="playAnimation(1)">打开前门</div>
  27. <div class="button-box" :class="{ 'button-disable': backDoorIsOpen }" @click="playAnimation(2)">关闭前门</div>
  28. <div class="button-box" :class="{ 'button-disable': frontDoorIsOpen }" @click="playAnimation(3)">打开后门</div>
  29. <div class="button-box" :class="{ 'button-disable': frontDoorIsOpen }" @click="playAnimation(4)">关闭后门</div>
  30. <div class="button-box" :class="{ 'button-disable': frontDoorIsOpen || backDoorIsOpen }" @click="playAnimation(5)">打开前后门</div>
  31. <div
  32. class="button-box"
  33. :class="{ 'button-disable': (frontDoorIsOpen && !backDoorIsOpen) || (backDoorIsOpen && !frontDoorIsOpen) }"
  34. @click="playAnimation(6)"
  35. >关闭前后门</div
  36. >
  37. <!-- <div class="button-box" @click="enterMY">漫游</div> -->
  38. </div>
  39. <div class="top-right row">
  40. <div class="control-type row">
  41. <div class="control-title">控制模式:</div>
  42. <a-radio-group v-model:value="selectData.masterComputer" @change="changeType">
  43. <a-radio :value="`0`">就地</a-radio>
  44. <a-radio :value="`1`">远程</a-radio>
  45. </a-radio-group>
  46. </div>
  47. <div class="run-type row">
  48. <div class="control-title">运行状态:</div>
  49. <a-radio-group v-model:value="controlType">
  50. <a-radio :value="`1`">检修</a-radio>
  51. </a-radio-group>
  52. </div>
  53. <div class="run-state row">
  54. <div class="control-title">网络状态:</div>
  55. <a-radio-group v-model:value="selectData.netStatus">
  56. <a-radio :value="`1`">运行</a-radio>
  57. </a-radio-group>
  58. </div>
  59. </div>
  60. </div>
  61. <div class="title-text">
  62. {{ selectData.stationname }}
  63. </div>
  64. <div class="bottom-tabs-box">
  65. <a-tabs class="tabs-box" v-model:activeKey="activeKey" @change="tabChange">
  66. <a-tab-pane key="1" tab="实时监测">
  67. <MonitorTable
  68. class="monitor-table"
  69. columnsType="gate_monitor"
  70. :dataSource="dataSource"
  71. design-scope="gate-monitor"
  72. @selectRow="getSelectRow"
  73. title="风门监测"
  74. >
  75. <template #filterCell="{ column, record }">
  76. <template v-if="record.frontGateOpenCtrl">
  77. <a-tag v-if="column.dataIndex === 'frontGateOpen' && record.frontGateOpen == 0 && record.frontGateClose == 0" color="red">正在打开</a-tag>
  78. <a-tag v-else-if="column.dataIndex === 'frontGateOpen'" color="processing">打开</a-tag>
  79. </template>
  80. <template v-else>
  81. <a-tag v-if="column.dataIndex === 'frontGateOpen' && record.frontGateOpen == 0 && record.frontGateClose == 0" color="red">正在关闭</a-tag>
  82. <a-tag v-else-if="column.dataIndex === 'frontGateOpen' && record.frontGateOpen == 0 && record.frontGateClose == 1" color="default">关闭</a-tag>
  83. <a-tag v-else-if="column.dataIndex === 'frontGateOpen' && record.frontGateOpen == 1 && record.frontGateClose == 0" color="default">打开</a-tag>
  84. </template>
  85. <template v-if="record.rearGateOpenCtrl">
  86. <a-tag v-if="column.dataIndex === 'rearGateOpen' && record.rearGateOpen == 0 && record.rearGateClose == 0" color="red">正在打开</a-tag>
  87. <a-tag v-else-if="column.dataIndex === 'rearGateOpen'" color="processing">打开</a-tag>
  88. </template>
  89. <template v-else>
  90. <a-tag v-if="column.dataIndex === 'rearGateOpen' && record.rearGateOpen == 0 && record.rearGateClose == 0" color="red">正在关闭</a-tag>
  91. <a-tag v-else-if="column.dataIndex === 'rearGateOpen' && record.rearGateOpen == 0 && record.rearGateClose == 1" color="default">关闭</a-tag>
  92. <a-tag v-else-if="column.dataIndex === 'rearGateOpen' && record.rearGateOpen == 1 && record.rearGateClose == 0" color="default">打开</a-tag>
  93. </template>
  94. <a-tag v-if="column.dataIndex === 'warnFlag'" :color="record.warnFlag == 0 ? 'green' : 'red'">{{
  95. record.warnFlag == 0 ? '正常' : '报警'
  96. }}</a-tag>
  97. <a-tag v-if="column.dataIndex === 'netStatus'" :color="record.netStatus == 0 ? 'default' : 'green'">{{
  98. record.netStatus == 0 ? '断开' : '连接'
  99. }}</a-tag>
  100. </template>
  101. </MonitorTable>
  102. </a-tab-pane>
  103. <a-tab-pane key="2" tab="实时曲线图" force-render>
  104. <div class="tab-item" v-if="activeKey === '2'">
  105. <DeviceEcharts
  106. chartsColumnsType="gate_chart"
  107. xAxisPropType="strname"
  108. :dataSource="dataSource"
  109. height="100%"
  110. :chartsColumns="chartsColumns"
  111. :device-list-api="list"
  112. device-type="gate"
  113. />
  114. </div>
  115. </a-tab-pane>
  116. <a-tab-pane key="3" tab="历史数据">
  117. <div class="tab-item">
  118. <HistoryTable columns-type="gate_history" device-type="gate" :device-list-api="baseList" designScope="gate-history" />
  119. </div>
  120. </a-tab-pane>
  121. <a-tab-pane key="4" tab="报警历史">
  122. <div class="tab-item">
  123. <AlarmHistoryTable columns-type="alarm_history" device-type="gate" :device-list-api="baseList" designScope="alarm-history" />
  124. </div>
  125. </a-tab-pane>
  126. <a-tab-pane key="5" tab="操作历史">
  127. <div class="tab-item">
  128. <HandlerHistoryTable columns-type="alarm_history" device-type="fanlocal" :device-list-api="baseList" designScope="alarm-history" />
  129. </div>
  130. </a-tab-pane>
  131. </a-tabs>
  132. </div>
  133. </div>
  134. <div style="z-index: -1; position: absolute; top: 50px; right: 10px; width: 300px; height: 280px; margin: auto" class="palyer1">
  135. <LivePlayer id="fm-player1" ref="player1" :videoUrl="flvURL1()" muted live loading controls />
  136. <LivePlayer id="fm-player2" ref="player2" :videoUrl="flvURL1()" muted live loading controls style="margin-top: 10px" />
  137. </div>
  138. <!-- <a-modal v-model:visible="modalIsShow" :title="modalTitle" @ok="handleOk">
  139. <div class="modal-container">
  140. <div class="vent-flex-row">
  141. <ExclamationCircleFilled style="color: #ffb700; font-size: 30px" />
  142. <div class="warning-text">您是否要进行{{ modalTitle }}操作?</div>
  143. </div>
  144. </div>
  145. </a-modal> -->
  146. <HandleModal :modal-is-show="modalIsShow" :modal-title="modalTitle" :modal-type="modalType" @handle-ok="handleOK" @handle-cancel="handleCancel" />
  147. </template>
  148. <script setup lang="ts">
  149. import LivePlayer from '@liveqing/liveplayer-v3';
  150. import { onBeforeMount, onBeforeUnmount, onUnmounted, onMounted, ref, reactive, toRaw, nextTick } from 'vue';
  151. import DeviceEcharts from '../comment/DeviceEcharts.vue';
  152. import MonitorTable from '../comment/MonitorTable.vue';
  153. import HistoryTable from '../comment/HistoryTable.vue';
  154. import AlarmHistoryTable from '../comment/AlarmHistoryTable.vue';
  155. import HandlerHistoryTable from '../comment/HandlerHistoryTable.vue';
  156. import HandleModal from './modal.vue';
  157. import { initWebSocket, getRecordList } from '/@/hooks/web/useVentWebSocket';
  158. import { mountedThree, addFmText, play, destroy, initOpenState, deviceDetailCard } from './gate.threejs';
  159. import { deviceControlApi } from '/@/api/vent/index';
  160. import { message } from 'ant-design-vue';
  161. import { list, getTableList } from './gate.api';
  162. import { chartsColumns } from './gate.data';
  163. import lodash from 'lodash';
  164. const player1 = ref(null);
  165. const player2 = ref(null);
  166. const activeKey = ref('1');
  167. const loading = ref(false);
  168. const frontDoorIsOpen = ref(false); //前门是否开启
  169. const backDoorIsOpen = ref(false); //后门是否开启
  170. const modalIsShow = ref<boolean>(false); // 是否显示模态框
  171. const modalTitle = ref(''); // 模态框标题显示内容,根据设备操作类型决定
  172. const modalType = ref(''); // 模态框内容显示类型,设备操作类型
  173. const selectRowIndex = ref(0);
  174. const dataSource = ref([]);
  175. const deviceBaseList = ref([]);
  176. // webSocket 请求 实时监测数据
  177. // const dataSource:any = computed(() => {
  178. // const data = [...getRecordList()] || []
  179. //
  180. // Object.assign(selectData, toRaw(data[selectRowIndex.value]))
  181. //
  182. // addFmText(selectData)
  183. //
  184. // return data;
  185. // });
  186. // 设备数据
  187. const controlType = ref(1);
  188. const tabChange = (activeKeyVal) => {
  189. activeKey.value = activeKeyVal;
  190. };
  191. const initData = {
  192. deviceID: '',
  193. deviceType: '',
  194. strname: '',
  195. frontRearDP: '-', //压差
  196. sourcePressure: '-', //气源压力
  197. netStatus: '0', //通信状态
  198. frontGateOpen: '0',
  199. rearGateOpen: '0',
  200. fault: '气源压力超限',
  201. masterComputer: 0,
  202. };
  203. // 监测数据
  204. const selectData = reactive(lodash.cloneDeep(initData));
  205. // 获取设备基本信息列表
  206. const getDeviceBaseList = () => {
  207. getTableList({ pageSize: 1000 }).then((res) => {
  208. deviceBaseList.value = res.records;
  209. });
  210. };
  211. // https获取监测数据
  212. let timer: null | NodeJS.Timeout = null;
  213. const getMonitor = () => {
  214. if (Object.prototype.toString.call(timer) === '[object Null]') {
  215. timer = setTimeout(() => {
  216. list({ devicetype: 'gate', pagetype: 'normal' }).then((res) => {
  217. if (res.msgTxt && res.msgTxt[0]) {
  218. dataSource.value = res.msgTxt[0].datalist || [];
  219. dataSource.value.forEach((data: any) => {
  220. const readData = data.readData;
  221. data = Object.assign(data, readData);
  222. });
  223. if (dataSource.value.length > selectRowIndex.value) {
  224. const data: any = toRaw(dataSource.value[selectRowIndex.value]); //maxarea
  225. Object.assign(selectData, data);
  226. addFmText(data);
  227. monitorAnimation(data)
  228. if (timer) {
  229. timer = null;
  230. }
  231. getMonitor();
  232. }
  233. }
  234. });
  235. }, 1000);
  236. }
  237. };
  238. // 切换检测数据
  239. const getSelectRow = async (selectRow, index) => {
  240. if (!selectRow) return;
  241. loading.value = true;
  242. selectRowIndex.value = index;
  243. const baseData: any = deviceBaseList.value.find((baseData: any) => baseData.id === selectRow.deviceID);
  244. Object.assign(selectData, initData, selectRow, baseData);
  245. // selectData = selectRow;
  246. // frontDoorIsOpen.value = selectData.frontGateOpen === '1';
  247. // backDoorIsOpen.value = selectData.rearGateOpen === '1';
  248. initOpenState(selectData)?.then(() => {
  249. loading.value = false;
  250. });
  251. };
  252. // 播放动画
  253. const playAnimation = (handlerState) => {
  254. switch (handlerState) {
  255. case 1: // 打开前门
  256. if (!frontDoorIsOpen.value && !backDoorIsOpen.value) {
  257. modalTitle.value = '打开前门';
  258. modalType.value = '1';
  259. modalIsShow.value = true;
  260. }
  261. break;
  262. case 2: // 关闭前门
  263. if (frontDoorIsOpen.value && !backDoorIsOpen.value) {
  264. modalTitle.value = '关闭前门';
  265. modalType.value = '2';
  266. modalIsShow.value = true;
  267. }
  268. break;
  269. case 3: // 打开后门
  270. if (!backDoorIsOpen.value && !frontDoorIsOpen.value) {
  271. modalTitle.value = '打开后门';
  272. modalType.value = '3';
  273. modalIsShow.value = true;
  274. }
  275. break;
  276. case 4: // 关闭后门
  277. if (backDoorIsOpen.value && !frontDoorIsOpen.value) {
  278. modalTitle.value = '关闭后门';
  279. modalType.value = '4';
  280. modalIsShow.value = true;
  281. }
  282. break;
  283. case 5: // 打开前后门
  284. if (!frontDoorIsOpen.value && !backDoorIsOpen.value) {
  285. modalTitle.value = '打开前后门';
  286. modalType.value = '5';
  287. modalIsShow.value = true;
  288. }
  289. break;
  290. case 6: // 关闭前后门
  291. if (frontDoorIsOpen.value && backDoorIsOpen.value) {
  292. modalTitle.value = '关闭前后门';
  293. modalType.value = '6';
  294. modalIsShow.value = true;
  295. }
  296. break;
  297. }
  298. };
  299. const handleOK = (passWord, handlerState) => {
  300. if (passWord !== '123456') {
  301. message.warning('密码不正确,请重新输入');
  302. return;
  303. }
  304. if(isFrontRunning && (handlerState == 2 || handlerState == 1 || handlerState == 5 || handlerState == 6)){
  305. return
  306. }
  307. if (isRearRunning && (handlerState == 3 || handlerState == 4 || handlerState == 5 || handlerState == 6)) {
  308. return
  309. }
  310. const data = {
  311. deviceid: selectData.deviceID,
  312. devicetype: selectData.deviceType,
  313. paramcode: '',
  314. value: null,
  315. masterComputer: selectData.masterComputer,
  316. };
  317. let handler = () => {};
  318. switch (handlerState) {
  319. case '1': // 打开前门
  320. if (!frontDoorIsOpen.value && !backDoorIsOpen.value) {
  321. handler = () => {
  322. frontDoorIsOpen.value = true;
  323. };
  324. data.paramcode = 'frontGateOpen_S';
  325. }
  326. break;
  327. case '2': // 关闭前门
  328. if (frontDoorIsOpen.value && !backDoorIsOpen.value) {
  329. handler = () => {
  330. frontDoorIsOpen.value = false;
  331. };
  332. data.paramcode = 'frontGateClose_S';
  333. }
  334. break;
  335. case '3': // 打开后门
  336. if (!backDoorIsOpen.value && !frontDoorIsOpen.value) {
  337. handler = () => {
  338. backDoorIsOpen.value = true;
  339. };
  340. data.paramcode = 'rearGateOpen_S';
  341. }
  342. break;
  343. case '4': // 关闭后门
  344. if (backDoorIsOpen.value && !frontDoorIsOpen.value) {
  345. handler = () => {
  346. backDoorIsOpen.value = false;
  347. };
  348. data.paramcode = 'rearGateClose_S';
  349. }
  350. break;
  351. case '5': // 打开前后门
  352. if (!frontDoorIsOpen.value && !backDoorIsOpen.value) {
  353. handler = () => {
  354. frontDoorIsOpen.value = true;
  355. backDoorIsOpen.value = true;
  356. };
  357. data.paramcode = 'sameTimeOpen';
  358. }
  359. break;
  360. case '6': // 关闭前后门
  361. if (frontDoorIsOpen.value && backDoorIsOpen.value) {
  362. handler = () => {
  363. frontDoorIsOpen.value = false;
  364. backDoorIsOpen.value = false;
  365. };
  366. data.paramcode = 'sameTimeClose';
  367. }
  368. break;
  369. }
  370. if (data.paramcode) {
  371. deviceControlApi(data)
  372. .then((res) => {
  373. // 模拟时开启
  374. // if (res.success) {
  375. // modalIsShow.value = false;
  376. // modalTitle.value = '';
  377. // modalType.value = '';
  378. // handler();
  379. // play(Number(handlerState));
  380. // }
  381. })
  382. }
  383. };
  384. /** 开关门动画调用 */
  385. let isFrontRunning = false //开关门动作是否在进行
  386. let isRearRunning = false //开关门动作是否在进行
  387. let frontDeviceState = 0 //记录设备状态,为了与下一次监测数据做比较
  388. let rearDeviceState = 0 //记录设备状态,为了与下一次监测数据做比较
  389. //backDoorIsOpen frontDoorIsOpen
  390. const monitorAnimation = (selectData) => {
  391. debugger
  392. const timeScale = 0.0003
  393. if (selectData.frontGateOpenCtrl) {
  394. if (selectData.frontGateOpen == 0 && selectData.frontGateClose == 0) {
  395. //打开前门1
  396. if(!isFrontRunning){
  397. frontDoorIsOpen.value = true
  398. backDoorIsOpen.value = true
  399. isFrontRunning = true
  400. play(1, timeScale)
  401. frontDeviceState = 1
  402. }
  403. }
  404. if (selectData.frontGateOpen == 1 && selectData.frontGateClose == 0) {
  405. isFrontRunning = false
  406. if (frontDeviceState != 1) {
  407. play(1)
  408. frontDeviceState = 1
  409. frontDoorIsOpen.value = false
  410. backDoorIsOpen.value = true
  411. }
  412. }
  413. } else {
  414. if (selectData.frontGateOpen == 0 && selectData.frontGateClose == 0) {
  415. //关闭前门
  416. if(!isFrontRunning){
  417. isFrontRunning = true
  418. play(2, timeScale)
  419. frontDeviceState = 2
  420. frontDoorIsOpen.value = true
  421. backDoorIsOpen.value = true
  422. }
  423. }
  424. if (selectData.frontGateClose == 1 && selectData.frontGateOpen == 0) {
  425. isFrontRunning = false
  426. if (frontDeviceState == 1) {
  427. play(2)
  428. frontDeviceState = 2
  429. frontDoorIsOpen.value = false
  430. // backDoorIsOpen.value = false
  431. }
  432. }
  433. }
  434. if (selectData.rearGateOpenCtrl) {
  435. if (selectData.rearGateOpen == 0 && selectData.rearGateClose == 0) {
  436. //打开后门
  437. if(!isRearRunning){
  438. isRearRunning = true
  439. play(3, timeScale)
  440. rearDeviceState = 3
  441. frontDoorIsOpen.value = true
  442. backDoorIsOpen.value = true
  443. }
  444. }
  445. if (selectData.rearGateOpen == 1 && selectData.rearGateClose == 0) {
  446. isRearRunning = false
  447. if (rearDeviceState != 3) {
  448. rearDeviceState = 3
  449. play(3)
  450. backDoorIsOpen.value = false
  451. frontDoorIsOpen.value = true
  452. }
  453. }
  454. } else {
  455. if (selectData.rearGateOpen == 0 && selectData.rearGateClose == 0) {
  456. //关闭后门
  457. if(!isRearRunning){
  458. isRearRunning = true
  459. play(4, timeScale)
  460. rearDeviceState = 4
  461. frontDoorIsOpen.value = true
  462. backDoorIsOpen.value = true
  463. }
  464. }
  465. if (selectData.rearGateClose == 1 && selectData.rearGateOpen == 0) {
  466. isRearRunning = false
  467. if (rearDeviceState == 3) {
  468. rearDeviceState = 4
  469. play(4)
  470. // frontDoorIsOpen.value = false
  471. backDoorIsOpen.value = false
  472. }
  473. }
  474. }
  475. if(!(selectData.frontGateOpen == 0 && selectData.frontGateClose == 0 && selectData.rearGateOpen == 0 && selectData.rearGateClose == 0)) {
  476. if (selectData.frontGateOpenCtrl && selectData.rearGateOpenCtrl && selectData.frontGateOpen == 1 && selectData.rearGateOpen == 1) {
  477. frontDoorIsOpen.value = true
  478. backDoorIsOpen.value = true
  479. }
  480. if (!selectData.frontGateOpenCtrl && !selectData.rearGateOpenCtrl && selectData.frontGateClose == 1 && selectData.rearGateClose == 1) {
  481. frontDoorIsOpen.value = false
  482. backDoorIsOpen.value = false
  483. }
  484. }
  485. // if (!selectData.frontGateOpenCtrl && selectData.rearGateOpenCtrl) {
  486. // frontDoorIsOpen.value = true
  487. // backDoorIsOpen.value = false
  488. // }
  489. // if (selectData.frontGateOpenCtrl && !selectData.rearGateOpenCtrl) {
  490. // frontDoorIsOpen.value = false
  491. // backDoorIsOpen.value = true
  492. // }
  493. // if (frontDeviceState == 1 || frontDeviceState == 2) {
  494. // frontDoorIsOpen.value = false
  495. // backDoorIsOpen.value = true
  496. // } else if (rearDeviceState == 3 || rearDeviceState == 4) {
  497. // frontDoorIsOpen.value = true
  498. // backDoorIsOpen.value = false
  499. // } else {
  500. // frontDoorIsOpen.value = false
  501. // backDoorIsOpen.value = false
  502. // }
  503. // if(selectData.frontGateOpenCtrl && selectData.rearGateOpenCtrl){
  504. // if (selectData.frontGateOpen == 0 && selectData.frontGateClose == 0 && !isFrontRunning && selectData.rearGateOpen == 0 && selectData.rearGateClose == 0 && !isRearRunning) {
  505. // //打开前后门
  506. // frontDoorIsOpen.value = true
  507. // backDoorIsOpen.value = true
  508. // }
  509. // if (selectData.frontGateOpen == 1 && selectData.frontGateClose == 0 && selectData.rearGateOpen == 1 && selectData.rearGateClose == 0) {
  510. // frontDoorIsOpen.value = true
  511. // backDoorIsOpen.value = true
  512. // }
  513. // }
  514. // if(!selectData.frontGateOpenCtrl && !selectData.rearGateOpenCtrl){
  515. // if (selectData.frontGateOpen == 0 && selectData.frontGateClose == 0 && !isFrontRunning && selectData.rearGateOpen == 0 && selectData.rearGateClose == 0 && !isRearRunning) {
  516. // //打开前后门
  517. // frontDoorIsOpen.value = true
  518. // backDoorIsOpen.value = true
  519. // }
  520. // if (selectData.frontGateOpen == 0 && selectData.frontGateClose == 1 && selectData.rearGateOpen == 0 && selectData.rearGateClose == 1) {
  521. // frontDoorIsOpen.value = false
  522. // backDoorIsOpen.value = false
  523. // }
  524. // }
  525. }
  526. const handleCancel = () => {
  527. modalIsShow.value = false;
  528. modalTitle.value = '';
  529. modalType.value = '';
  530. };
  531. // 远程、就地切换
  532. const changeType = () => {
  533. const data = {
  534. deviceid: selectData.deviceID,
  535. devicetype: selectData.deviceType,
  536. paramcode: 'masterComputerControl',
  537. value: selectData.masterComputer,
  538. };
  539. deviceControlApi(data).then(() => {
  540. message.success('状态切换成功!');
  541. });
  542. };
  543. const flvURL1 = () => {
  544. return `https://sf1-hscdn-tos.pstatp.com/obj/media-fe/xgplayer_doc_video/flv/xgplayer-demo-360p.flv`;
  545. };
  546. const flvURL2 = () => {
  547. return `https://sf1-hscdn-tos.pstatp.com/obj/media-fe/xgplayer_doc_video/flv/xgplayer-demo-360p.flv`;
  548. };
  549. // 视频播放
  550. const addPlayVideo = () => {
  551. if (player1.value && player2.value && player1.value?.play && player2.value?.play) {
  552. // player1.value.setMuted(false);
  553. // player2.value.setMuted(false);
  554. player1.value.play();
  555. player2.value.play();
  556. document.body.removeEventListener('mousedown', addPlayVideo);
  557. }
  558. };
  559. const handleOk = (e: MouseEvent) => {
  560. //
  561. };
  562. onBeforeMount(() => {
  563. const sendVal = JSON.stringify({ pagetype: 'normal', devicetype: 'gate', orgcode: '', ids: '', systemID: '' });
  564. initWebSocket(sendVal);
  565. });
  566. onMounted(() => {
  567. loading.value = true;
  568. mountedThree(player1.value, player2.value).then(() => {
  569. nextTick(() => {
  570. getMonitor();
  571. addFmText(selectData);
  572. deviceDetailCard();
  573. });
  574. loading.value = false;
  575. });
  576. document.body.addEventListener('mousedown', addPlayVideo, false);
  577. });
  578. onBeforeUnmount(() => {
  579. getDeviceBaseList();
  580. });
  581. onUnmounted(() => {
  582. if (timer) {
  583. clearTimeout(timer);
  584. timer = undefined;
  585. }
  586. destroy();
  587. });
  588. </script>
  589. <style lang="less" scoped>
  590. @import '/@/design/vent/modal.less';
  591. .button-box {
  592. border: none !important;
  593. height: 34px !important;
  594. &:hover {
  595. background: linear-gradient(#2cd1ff55, #1eb0ff55) !important;
  596. }
  597. &::before {
  598. height: 27px !important;
  599. background: linear-gradient(#1fa6cb, #127cb5) !important;
  600. }
  601. &::after {
  602. top: 35px !important;
  603. }
  604. }
  605. :deep(.ant-tabs-tabpane-active) {
  606. overflow: auto;
  607. }
  608. </style>