index.vue 24 KB

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