index.vue 28 KB

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