index.vue 26 KB

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