index.vue 25 KB

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