index.vue 25 KB

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