index.vue 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782
  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 lodash from 'lodash';
  203. import { setDivHeight } from '/@/utils/event';
  204. import { BorderBox8 as DvBorderBox8 } from '@kjgl77/datav-vue3';
  205. import { useRouter } from 'vue-router';
  206. import LivePlayer from '@liveqing/liveplayer-v3';
  207. import { useModal } from '/@/components/Modal';
  208. import { useCamera } from '/@/hooks/system/useCamera';
  209. import { usePermission } from '/@/hooks/web/usePermission';
  210. const { hasPermission } = usePermission();
  211. const globalConfig = inject('globalConfig');
  212. const { currentRoute } = useRouter();
  213. const MonitorDataTable = ref();
  214. const playerRef = ref();
  215. const activeKey = ref('1'); // tab
  216. const loading = ref(false);
  217. const scroll = reactive({
  218. y: 230,
  219. });
  220. const frontDoorIsOpen = ref(false); //前门是否开启
  221. const backDoorIsOpen = ref(false); //后门是否开启
  222. const midDoorIsOpen = ref(false); //中间门是否开启
  223. const modalIsShow = ref<boolean>(false); // 是否显示模态框
  224. const modalTitle = ref(''); // 模态框标题显示内容,根据设备操作类型决定
  225. const modalType = ref(''); // 模态框内容显示类型,设备操作类型
  226. const selectRowIndex = ref(-1); // 选中行
  227. const dataSource = ref([]);
  228. const deviceBaseList = ref([]); // 设备基本信息
  229. const [registerModal, { openModal, closeModal }] = useModal();
  230. const { getCamera, removeCamera } = useCamera();
  231. const tabChange = (activeKeyVal) => {
  232. activeKey.value = activeKeyVal;
  233. if (activeKeyVal == 1) {
  234. nextTick(() => {
  235. MonitorDataTable.value.setSelectedRowKeys([selectData.deviceID]);
  236. });
  237. }
  238. };
  239. const initData = {
  240. deviceID: '',
  241. deviceType: '',
  242. strname: '',
  243. frontRearDP: '-', //压差
  244. // sourcePressure: '-', //气源压力
  245. runRoRecondition: null,
  246. autoRoManual: null,
  247. netStatus: '0', //通信状态
  248. frontGateOpen: '0',
  249. frontGateClose: '1',
  250. rearGateOpen: '0',
  251. rearGateClose: '1',
  252. midGateOpen: '0',
  253. midGateClose: '1',
  254. fault: '气源压力超限',
  255. masterComputer: 0,
  256. frontGateOpenCtrl: false,
  257. rearGateOpenCtrl: false,
  258. cameras: [],
  259. };
  260. // 监测数据
  261. const selectData = reactive(lodash.cloneDeep(initData));
  262. const flvURL1 = () => {
  263. // return ''
  264. return `/video/gate.mp4`;
  265. };
  266. function deviceEdit(e: Event, type: string, record) {
  267. e.stopPropagation();
  268. openModal(true, {
  269. type,
  270. deviceId: record['deviceID'],
  271. });
  272. }
  273. // 获取设备基本信息列表
  274. function getDeviceBaseList() {
  275. getTableList({ pageSize: 1000 }).then((res) => {
  276. deviceBaseList.value = res.records;
  277. });
  278. }
  279. // https获取监测数据
  280. let timer: null | NodeJS.Timeout = null;
  281. async function getMonitor(flag?) {
  282. if (Object.prototype.toString.call(timer) === '[object Null]') {
  283. timer = await setTimeout(
  284. async () => {
  285. const res = await list({ devicetype: 'gate', pagetype: 'normal' });
  286. if (res.msgTxt && res.msgTxt[0]) {
  287. dataSource.value = res.msgTxt[0].datalist || [];
  288. dataSource.value.forEach((data: any) => {
  289. const readData = data.readData;
  290. data = Object.assign(data, readData);
  291. });
  292. if (dataSource.value.length > 0 && selectRowIndex.value == -1) {
  293. // 初始打开页面
  294. if (currentRoute.value && currentRoute.value['query'] && currentRoute.value['query']['id']) {
  295. MonitorDataTable.value.setSelectedRowKeys([currentRoute.value['query']['id']]);
  296. } else {
  297. MonitorDataTable.value.setSelectedRowKeys([dataSource.value[0]['deviceID']]);
  298. }
  299. }
  300. Object.assign(selectData, dataSource.value[selectRowIndex.value]);
  301. addMonitorText(selectData);
  302. monitorAnimation(selectData);
  303. if (timer) {
  304. timer = null;
  305. }
  306. getMonitor();
  307. }
  308. },
  309. flag ? 0 : 1000
  310. );
  311. }
  312. }
  313. // 切换检测数据
  314. async function getSelectRow(selectRow, index) {
  315. if (!selectRow) return;
  316. loading.value = true;
  317. selectRowIndex.value = index;
  318. const baseData: any = deviceBaseList.value.find((baseData: any) => baseData.id === selectRow.deviceID);
  319. Object.assign(selectData, initData, selectRow, baseData);
  320. isFrontOpenRunning = false; //开关门动作是否在进行
  321. isRearOpenRunning = false; //开关门动作是否在进行
  322. isMidOpenRunning = false; //开关门动作是否在进行
  323. frontDeviceState = 0; //记录设备状态,为了与下一次监测数据做比较
  324. rearDeviceState = 0; //记录设备状态,为了与下一次监测数据做比较
  325. midDeviceState = 0; //记录设备状态,为了与下一次监测数据做比较
  326. // const type = selectData.nwindownum == 1 ? 'singleWindow' : 'doubleWindow';
  327. let type;
  328. if (selectData['doorUse'] == 2) {
  329. type = 'fmXr';
  330. } else {
  331. if (selectData.deviceType == 'gate_ss') {
  332. type = 'fm2';
  333. } else if (selectData.deviceType == 'gate_qd') {
  334. type = 'fm3';
  335. } else if (selectData.deviceType == 'gate_ss_two' || selectData.deviceType == 'gate_ss_two1') {
  336. type = 'fmTwoSs';
  337. } else {
  338. type = 'fm1'; // 液压
  339. }
  340. }
  341. setModelType(type).then(async () => {
  342. addMonitorText(selectData);
  343. loading.value = false;
  344. });
  345. await getCamera(selectRow.deviceID, playerRef.value);
  346. }
  347. // 播放动画
  348. function playAnimation(handlerState) {
  349. switch (handlerState) {
  350. case 1: // 打开前门
  351. if (selectData.frontGateOpen == '0' && selectData.frontGateClose == '1') {
  352. modalTitle.value = '打开前门';
  353. modalType.value = '1';
  354. modalIsShow.value = true;
  355. } else {
  356. message.warning('前门已经打开或正在打开,请勿重新操作');
  357. }
  358. break;
  359. case 2: // 关闭前门
  360. if (selectData.frontGateOpen == '1' && selectData.frontGateClose == '0') {
  361. modalTitle.value = '关闭前门';
  362. modalType.value = '2';
  363. modalIsShow.value = true;
  364. } else {
  365. message.warning('前门已经关闭或正在关闭,请勿重新操作');
  366. }
  367. break;
  368. case 3: // 打开后门
  369. if (selectData.rearGateOpen == '0' && selectData.rearGateClose == '1') {
  370. modalTitle.value = '打开后门';
  371. modalType.value = '3';
  372. modalIsShow.value = true;
  373. } else {
  374. message.warning('后门已经打开或正在打开,请勿重新操作');
  375. }
  376. break;
  377. case 4: // 关闭后门
  378. if (selectData.rearGateOpen == '1' && selectData.rearGateClose == '0') {
  379. modalTitle.value = '关闭后门';
  380. modalType.value = '4';
  381. modalIsShow.value = true;
  382. } else {
  383. message.warning('后门已经关闭或正在关闭,请勿重新操作');
  384. }
  385. break;
  386. case 8: // 打开中间门
  387. if (selectData.midGateOpen == '0' && selectData.midGateClose == '1') {
  388. modalTitle.value = '打开中间门';
  389. modalType.value = '8';
  390. modalIsShow.value = true;
  391. } else {
  392. message.warning('后门已经打开或正在打开,请勿重新操作');
  393. }
  394. break;
  395. case 9: // 关闭中间门
  396. if (selectData.midGateOpen == '1' && selectData.midGateClose == '0') {
  397. modalTitle.value = '关闭中间门';
  398. modalType.value = '9';
  399. modalIsShow.value = true;
  400. } else {
  401. message.warning('后门已经关闭或正在关闭,请勿重新操作');
  402. }
  403. break;
  404. case 5: // 打开前后门
  405. if (
  406. selectData.frontGateOpen == '0' &&
  407. selectData.frontGateClose == '1' &&
  408. selectData.rearGateOpen == '0' &&
  409. selectData.rearGateClose == '1'
  410. ) {
  411. modalTitle.value = '打开前后门';
  412. modalType.value = '5';
  413. modalIsShow.value = true;
  414. } else {
  415. message.warning('前后门已经打开或正在打开,请勿重新操作');
  416. }
  417. break;
  418. case 6: // 关闭前后门
  419. if (
  420. selectData.frontGateOpen == '1' &&
  421. selectData.frontGateClose == '0' &&
  422. selectData.rearGateOpen == '1' &&
  423. selectData.rearGateClose == '0'
  424. ) {
  425. modalTitle.value = '关闭前后门';
  426. modalType.value = '6';
  427. modalIsShow.value = true;
  428. } else {
  429. message.warning('前后门已经关闭或正在关闭,请勿重新操作');
  430. }
  431. break;
  432. case 7: // 关闭前后门
  433. modalTitle.value = '控制模式切换';
  434. modalType.value = '7';
  435. modalIsShow.value = true;
  436. break;
  437. }
  438. if (globalConfig?.simulatedPassword) {
  439. handleOK('', handlerState + '');
  440. }
  441. }
  442. function handleOK(passWord, handlerState) {
  443. // if (passWord !== '123456') {
  444. // message.warning('密码不正确,请重新输入');
  445. // return;
  446. // }
  447. // if (isOpenRunning && (handlerState == 2 || handlerState == 1 || handlerState == 5 || handlerState == 6)) {
  448. // return;
  449. // }
  450. // if (isOpenRunning && (handlerState == 3 || handlerState == 4 || handlerState == 5 || handlerState == 6)) {
  451. // return;
  452. // }
  453. if (isOpenRunning) {
  454. return;
  455. }
  456. const data = {
  457. deviceid: selectData.deviceID,
  458. devicetype: selectData.deviceType,
  459. paramcode: '',
  460. value: null,
  461. password: passWord || globalConfig?.simulatedPassword,
  462. masterComputer: selectData.masterComputer,
  463. };
  464. let handler = () => {};
  465. switch (handlerState) {
  466. case '1': // 打开前门
  467. if (selectData.frontGateOpen == '0' && selectData.frontGateClose == '1') {
  468. handler = () => {
  469. frontDoorIsOpen.value = true;
  470. };
  471. data.paramcode = 'frontGateOpen_S';
  472. }
  473. break;
  474. case '2': // 关闭前门
  475. if (selectData.frontGateOpen == '1' && selectData.frontGateClose == '0') {
  476. handler = () => {
  477. frontDoorIsOpen.value = false;
  478. };
  479. data.paramcode = 'frontGateClose_S';
  480. }
  481. break;
  482. case '3': // 打开后门
  483. if (selectData.rearGateOpen == '0' && selectData.rearGateClose == '1') {
  484. handler = () => {
  485. backDoorIsOpen.value = true;
  486. };
  487. data.paramcode = 'rearGateOpen_S';
  488. }
  489. break;
  490. case '4': // 关闭后门
  491. if (selectData.rearGateOpen == '1' && selectData.rearGateClose == '0') {
  492. handler = () => {
  493. backDoorIsOpen.value = false;
  494. };
  495. data.paramcode = 'rearGateClose_S';
  496. }
  497. break;
  498. case '8': // 打开中间门
  499. if (selectData.midGateOpen == '0' && selectData.midGateClose == '1') {
  500. handler = () => {
  501. midDoorIsOpen.value = true;
  502. };
  503. data.paramcode = 'midGateOpen_S';
  504. }
  505. break;
  506. case '9': // 关闭中间门
  507. if (selectData.midGateOpen == '1' && selectData.midGateClose == '0') {
  508. handler = () => {
  509. midDoorIsOpen.value = false;
  510. };
  511. data.paramcode = 'midGateClose_S';
  512. }
  513. break;
  514. case '5': // 打开前后门
  515. if (
  516. selectData.frontGateOpen == '0' &&
  517. selectData.frontGateClose == '1' &&
  518. selectData.rearGateOpen == '0' &&
  519. selectData.rearGateClose == '1'
  520. ) {
  521. handler = () => {
  522. frontDoorIsOpen.value = true;
  523. backDoorIsOpen.value = true;
  524. };
  525. data.paramcode = 'sameTimeOpen';
  526. }
  527. break;
  528. case '6': // 关闭前后门
  529. if (
  530. selectData.frontGateOpen == '1' &&
  531. selectData.frontGateClose == '0' &&
  532. selectData.rearGateOpen == '1' &&
  533. selectData.rearGateClose == '0'
  534. ) {
  535. handler = () => {
  536. frontDoorIsOpen.value = false;
  537. backDoorIsOpen.value = false;
  538. };
  539. data.paramcode = 'sameTimeClose';
  540. }
  541. break;
  542. case '7': // 远程与就地
  543. data.paramcode = 'autoRoManualControl';
  544. data.value = selectData.autoRoManual;
  545. }
  546. if (data.paramcode) {
  547. deviceControlApi(data).then((res) => {
  548. // 模拟时开启
  549. if (res.success) {
  550. modalIsShow.value = false;
  551. if (globalConfig.History_Type == 'remote') {
  552. message.success('指令已下发至生产管控平台成功!');
  553. } else {
  554. message.success('指令已下发成功!');
  555. }
  556. }
  557. });
  558. }
  559. }
  560. let isOpenRunning = false; //开关门动作是否在进行
  561. /** 开关门动画调用 */
  562. let isFrontOpenRunning = false; //开关门动作是否在进行
  563. // let isFrontCloseRunning = false; //开关门动作是否在进行
  564. let isRearOpenRunning = false; //开关门动作是否在进行
  565. // let isRearCloseRunning = false; //开关门动作是否在进行
  566. let isMidOpenRunning = false; //中间门动作是否在进行
  567. // let isMidCloseRunning = false; //中间门动作是否在进行
  568. // 0 关闭 1 正在打开 2 打开 3正在关闭
  569. let frontDeviceState = 0; //记录设备状态,为了与下一次监测数据做比较
  570. let rearDeviceState = 0; //记录设备状态,为了与下一次监测数据做比较
  571. let midDeviceState = 0; //记录设备状态,为了与下一次监测数据做比较
  572. function monitorAnimation(selectData) {
  573. const timeScale = 0.005;
  574. if (selectData.frontGateOpen == '1' && selectData.frontGateClose == '0' && !isFrontOpenRunning) {
  575. isFrontOpenRunning = true;
  576. if (frontDeviceState != 1) {
  577. // import.meta.env.VITE_GLOB_IS_SIMULATE ? play(1, timeScale) : play(1);
  578. play(1, timeScale);
  579. frontDeviceState = 1;
  580. frontDoorIsOpen.value = false;
  581. backDoorIsOpen.value = true;
  582. }
  583. }
  584. if (selectData.frontGateOpen == '0' && selectData.frontGateClose == '0' && !isFrontOpenRunning) {
  585. isFrontOpenRunning = true;
  586. if (frontDeviceState != 1) {
  587. // import.meta.env.VITE_GLOB_IS_SIMULATE ? play(1, timeScale) : play(1);
  588. play(1, timeScale);
  589. frontDeviceState = 1;
  590. frontDoorIsOpen.value = false;
  591. backDoorIsOpen.value = true;
  592. }
  593. }
  594. if (selectData.frontGateClose == '1' && selectData.frontGateOpen == '0' && isFrontOpenRunning) {
  595. isFrontOpenRunning = false;
  596. if (frontDeviceState != 0) {
  597. // import.meta.env.VITE_GLOB_IS_SIMULATE ? play(2, timeScale) : play(2);
  598. play(2, timeScale);
  599. frontDeviceState = 0;
  600. frontDoorIsOpen.value = false;
  601. // backDoorIsOpen.value = false
  602. }
  603. }
  604. if (selectData.rearGateOpen == '1' && selectData.rearGateClose == '0' && !isRearOpenRunning) {
  605. isRearOpenRunning = true;
  606. if (rearDeviceState != 1) {
  607. rearDeviceState = 1;
  608. // import.meta.env.VITE_GLOB_IS_SIMULATE ? play(3, timeScale) : play(3);
  609. play(3, timeScale);
  610. backDoorIsOpen.value = false;
  611. frontDoorIsOpen.value = true;
  612. }
  613. }
  614. if (selectData.rearGateOpen == '0' && selectData.rearGateClose == '0' && !isRearOpenRunning) {
  615. isRearOpenRunning = true;
  616. if (rearDeviceState != 1) {
  617. rearDeviceState = 1;
  618. // import.meta.env.VITE_GLOB_IS_SIMULATE ? play(3, timeScale) : play(3);
  619. play(3, timeScale);
  620. backDoorIsOpen.value = false;
  621. frontDoorIsOpen.value = true;
  622. }
  623. }
  624. if (selectData.rearGateClose == '1' && selectData.rearGateOpen == '0' && isRearOpenRunning) {
  625. isRearOpenRunning = false;
  626. if (rearDeviceState != 0) {
  627. rearDeviceState = 0;
  628. // import.meta.env.VITE_GLOB_IS_SIMULATE ? play(4, timeScale) : play(4);
  629. play(4, timeScale);
  630. backDoorIsOpen.value = false;
  631. }
  632. }
  633. if (selectData.midGateOpen == '1' && selectData.midGateClose == '0' && !isMidOpenRunning) {
  634. isMidOpenRunning = true;
  635. if (midDeviceState != 1) {
  636. midDeviceState = 1;
  637. // import.meta.env.VITE_GLOB_IS_SIMULATE ? play(3, timeScale) : play(3);
  638. play(8, timeScale);
  639. backDoorIsOpen.value = false;
  640. frontDoorIsOpen.value = true;
  641. }
  642. }
  643. if (selectData.midGateOpen == '0' && selectData.midGateClose == '0' && !isMidOpenRunning) {
  644. isMidOpenRunning = true;
  645. if (midDeviceState != 1) {
  646. midDeviceState = 1;
  647. // import.meta.env.VITE_GLOB_IS_SIMULATE ? play(3, timeScale) : play(3);
  648. play(8, timeScale);
  649. backDoorIsOpen.value = false;
  650. frontDoorIsOpen.value = true;
  651. }
  652. }
  653. if (selectData.midGateClose == '1' && selectData.midGateOpen == '0' && isMidOpenRunning) {
  654. isMidOpenRunning = false;
  655. if (midDeviceState != 0) {
  656. midDeviceState = 0;
  657. // import.meta.env.VITE_GLOB_IS_SIMULATE ? play(4, timeScale) : play(4);
  658. play(9, timeScale);
  659. backDoorIsOpen.value = false;
  660. }
  661. }
  662. }
  663. function handleCancel() {
  664. modalIsShow.value = false;
  665. modalTitle.value = '';
  666. modalType.value = '';
  667. }
  668. // // 远程、就地切换
  669. // function changeType() {
  670. // const data = {
  671. // deviceid: selectData.deviceID,
  672. // devicetype: selectData.deviceType,
  673. // paramcode: 'autoRoManualControl',
  674. // value: selectData.autoRoManual,
  675. // };
  676. // deviceControlApi(data).then(() => {
  677. // if (globalConfig.History_Type == 'remote') {
  678. // message.success('指令已下发至生产管控平台成功!');
  679. // } else {
  680. // message.success('指令已下发成功!');
  681. // }
  682. // });
  683. // }
  684. onMounted(async () => {
  685. loading.value = true;
  686. const playerDom = document.getElementById('fm-player1')?.getElementsByClassName('vjs-tech')[0];
  687. mountedThree(playerDom).then(async () => {
  688. await getMonitor(true);
  689. loading.value = false;
  690. });
  691. });
  692. onBeforeUnmount(() => {
  693. getDeviceBaseList();
  694. });
  695. onUnmounted(() => {
  696. removeCamera();
  697. if (timer) {
  698. clearTimeout(timer);
  699. timer = undefined;
  700. }
  701. destroy();
  702. });
  703. </script>
  704. ,
  705. <style lang="less" scoped>
  706. @import '/@/design/vent/modal.less';
  707. .scene-box {
  708. .bottom-tabs-box {
  709. height: 350px;
  710. }
  711. }
  712. .button-box {
  713. border: none !important;
  714. height: 34px !important;
  715. &:hover {
  716. background: linear-gradient(#2cd1ff55, #1eb0ff55) !important;
  717. }
  718. &::before {
  719. height: 27px !important;
  720. background: linear-gradient(#1fa6cb, #127cb5) !important;
  721. }
  722. &::after {
  723. top: 35px !important;
  724. }
  725. }
  726. :deep(.@{ventSpace}-tabs-tabpane-active) {
  727. height: 100%;
  728. }
  729. ::-webkit-scrollbar-thumb {
  730. -webkit-box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
  731. background: #4288a444;
  732. }
  733. </style>