index.vue 29 KB

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