index.vue 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767
  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, removeCamera } = 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' || selectData.deviceType == 'gate_ss_two1') {
  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. 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 8: // 打开中间门
  388. if (selectData.midGateOpen == '0' && selectData.midGateClose == '1') {
  389. modalTitle.value = '打开中间门';
  390. modalType.value = '8';
  391. modalIsShow.value = true;
  392. } else {
  393. message.warning('后门已经打开或正在打开,请勿重新操作');
  394. }
  395. break;
  396. case 9: // 关闭中间门
  397. if (selectData.midGateOpen == '1' && selectData.midGateClose == '0') {
  398. modalTitle.value = '关闭中间门';
  399. modalType.value = '9';
  400. modalIsShow.value = true;
  401. } else {
  402. message.warning('后门已经关闭或正在关闭,请勿重新操作');
  403. }
  404. break;
  405. case 5: // 打开前后门
  406. if (
  407. selectData.frontGateOpen == '0' &&
  408. selectData.frontGateClose == '1' &&
  409. selectData.rearGateOpen == '0' &&
  410. selectData.rearGateClose == '1'
  411. ) {
  412. modalTitle.value = '打开前后门';
  413. modalType.value = '5';
  414. modalIsShow.value = true;
  415. } else {
  416. message.warning('前后门已经打开或正在打开,请勿重新操作');
  417. }
  418. break;
  419. case 6: // 关闭前后门
  420. if (
  421. selectData.frontGateOpen == '1' &&
  422. selectData.frontGateClose == '0' &&
  423. selectData.rearGateOpen == '1' &&
  424. selectData.rearGateClose == '0'
  425. ) {
  426. modalTitle.value = '关闭前后门';
  427. modalType.value = '6';
  428. modalIsShow.value = true;
  429. } else {
  430. message.warning('前后门已经关闭或正在关闭,请勿重新操作');
  431. }
  432. break;
  433. case 7: // 关闭前后门
  434. modalTitle.value = '控制模式切换';
  435. modalType.value = '7';
  436. modalIsShow.value = true;
  437. break;
  438. }
  439. if (globalConfig?.simulatedPassword) {
  440. handleOK('', handlerState + '');
  441. }
  442. }
  443. function handleOK(passWord, handlerState) {
  444. // if (passWord !== '123456') {
  445. // message.warning('密码不正确,请重新输入');
  446. // return;
  447. // }
  448. // if (isOpenRunning && (handlerState == 2 || handlerState == 1 || handlerState == 5 || handlerState == 6)) {
  449. // return;
  450. // }
  451. // if (isOpenRunning && (handlerState == 3 || handlerState == 4 || handlerState == 5 || handlerState == 6)) {
  452. // return;
  453. // }
  454. if (isOpenRunning) {
  455. return;
  456. }
  457. const data = {
  458. deviceid: selectData.deviceID,
  459. devicetype: selectData.deviceType,
  460. paramcode: '',
  461. value: null,
  462. password: passWord || globalConfig?.simulatedPassword,
  463. masterComputer: selectData.masterComputer,
  464. };
  465. let handler = () => {};
  466. switch (handlerState) {
  467. case '1': // 打开前门
  468. if (selectData.frontGateOpen == '0' && selectData.frontGateClose == '1') {
  469. handler = () => {
  470. frontDoorIsOpen.value = true;
  471. };
  472. data.paramcode = 'frontGateOpen_S';
  473. }
  474. break;
  475. case '2': // 关闭前门
  476. if (selectData.frontGateOpen == '1' && selectData.frontGateClose == '0') {
  477. handler = () => {
  478. frontDoorIsOpen.value = false;
  479. };
  480. data.paramcode = 'frontGateClose_S';
  481. }
  482. break;
  483. case '3': // 打开后门
  484. if (selectData.rearGateOpen == '0' && selectData.rearGateClose == '1') {
  485. handler = () => {
  486. backDoorIsOpen.value = true;
  487. };
  488. data.paramcode = 'rearGateOpen_S';
  489. }
  490. break;
  491. case '4': // 关闭后门
  492. if (selectData.rearGateOpen == '1' && selectData.rearGateClose == '0') {
  493. handler = () => {
  494. backDoorIsOpen.value = false;
  495. };
  496. data.paramcode = 'rearGateClose_S';
  497. }
  498. break;
  499. case '8': // 打开中间门
  500. if (selectData.midGateOpen == '0' && selectData.midGateClose == '1') {
  501. handler = () => {
  502. midDoorIsOpen.value = true;
  503. };
  504. data.paramcode = 'midGateOpen_S';
  505. }
  506. break;
  507. case '9': // 关闭中间门
  508. if (selectData.midGateOpen == '1' && selectData.midGateClose == '0') {
  509. handler = () => {
  510. midDoorIsOpen.value = false;
  511. };
  512. data.paramcode = 'midGateClose_S';
  513. }
  514. break;
  515. case '5': // 打开前后门
  516. if (
  517. selectData.frontGateOpen == '0' &&
  518. selectData.frontGateClose == '1' &&
  519. selectData.rearGateOpen == '0' &&
  520. selectData.rearGateClose == '1'
  521. ) {
  522. handler = () => {
  523. frontDoorIsOpen.value = true;
  524. backDoorIsOpen.value = true;
  525. };
  526. data.paramcode = 'sameTimeOpen';
  527. }
  528. break;
  529. case '6': // 关闭前后门
  530. if (
  531. selectData.frontGateOpen == '1' &&
  532. selectData.frontGateClose == '0' &&
  533. selectData.rearGateOpen == '1' &&
  534. selectData.rearGateClose == '0'
  535. ) {
  536. handler = () => {
  537. frontDoorIsOpen.value = false;
  538. backDoorIsOpen.value = false;
  539. };
  540. data.paramcode = 'sameTimeClose';
  541. }
  542. break;
  543. case '7': // 远程与就地
  544. data.paramcode = 'autoRoManualControl';
  545. data.value = selectData.autoRoManual;
  546. }
  547. if (data.paramcode) {
  548. deviceControlApi(data).then((res) => {
  549. // 模拟时开启
  550. if (res.success) {
  551. modalIsShow.value = false;
  552. if (globalConfig.History_Type == 'remote') {
  553. message.success('指令已下发至生产管控平台成功!');
  554. } else {
  555. message.success('指令已下发成功!');
  556. }
  557. }
  558. });
  559. }
  560. }
  561. let isOpenRunning = false; //开关门动作是否在进行
  562. /** 开关门动画调用 */
  563. let isFrontOpenRunning = false; //开关门动作是否在进行
  564. // let isFrontCloseRunning = false; //开关门动作是否在进行
  565. let isRearOpenRunning = false; //开关门动作是否在进行
  566. // let isRearCloseRunning = false; //开关门动作是否在进行
  567. let isMidOpenRunning = false; //中间门动作是否在进行
  568. // let isMidCloseRunning = false; //中间门动作是否在进行
  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 == '0' && selectData.frontGateClose == '0') {
  575. // //正在运行
  576. // // if (!isFrontOpenRunning) {
  577. // // frontDoorIsOpen.value = true;
  578. // // backDoorIsOpen.value = true;
  579. // // isFrontOpenRunning = true;
  580. // // play(1, timeScale);
  581. // // frontDeviceState = 1;
  582. // // }
  583. // }
  584. if (
  585. (selectData.frontGateOpen == '0' && selectData.frontGateClose == '0') ||
  586. (selectData.rearGateOpen == '0' && selectData.rearGateClose == '0') ||
  587. (selectData.midGateOpen == '0' && selectData.midGateClose == '0')
  588. ) {
  589. isOpenRunning = true;
  590. } else {
  591. isOpenRunning = false;
  592. }
  593. if (selectData.frontGateOpen == 1 && selectData.frontGateClose == '0' && !isFrontOpenRunning) {
  594. isFrontOpenRunning = true;
  595. if (frontDeviceState != 1) {
  596. // import.meta.env.VITE_GLOB_IS_SIMULATE ? play(1, timeScale) : play(1);
  597. play(1, timeScale);
  598. frontDeviceState = 1;
  599. frontDoorIsOpen.value = false;
  600. backDoorIsOpen.value = true;
  601. }
  602. }
  603. if (selectData.frontGateClose == 1 && selectData.frontGateOpen == '0' && isFrontOpenRunning) {
  604. isFrontOpenRunning = false;
  605. if (frontDeviceState != 2) {
  606. // import.meta.env.VITE_GLOB_IS_SIMULATE ? play(2, timeScale) : play(2);
  607. play(2, timeScale);
  608. frontDeviceState = 2;
  609. frontDoorIsOpen.value = false;
  610. // backDoorIsOpen.value = false
  611. }
  612. }
  613. if (selectData.rearGateOpen == 1 && selectData.rearGateClose == '0' && !isRearOpenRunning) {
  614. isRearOpenRunning = true;
  615. if (rearDeviceState != 3) {
  616. rearDeviceState = 3;
  617. // import.meta.env.VITE_GLOB_IS_SIMULATE ? play(3, timeScale) : play(3);
  618. play(3, timeScale);
  619. backDoorIsOpen.value = false;
  620. frontDoorIsOpen.value = true;
  621. }
  622. }
  623. if (selectData.rearGateClose == 1 && selectData.rearGateOpen == '0' && isRearOpenRunning) {
  624. isRearOpenRunning = false;
  625. if (rearDeviceState != 4) {
  626. rearDeviceState = 4;
  627. // import.meta.env.VITE_GLOB_IS_SIMULATE ? play(4, timeScale) : play(4);
  628. play(4, timeScale);
  629. backDoorIsOpen.value = false;
  630. }
  631. }
  632. if (selectData.midGateOpen == 1 && selectData.midGateClose == '0' && !isMidOpenRunning) {
  633. isMidOpenRunning = true;
  634. if (midDeviceState != 8) {
  635. midDeviceState = 8;
  636. // import.meta.env.VITE_GLOB_IS_SIMULATE ? play(3, timeScale) : play(3);
  637. play(8, timeScale);
  638. backDoorIsOpen.value = false;
  639. frontDoorIsOpen.value = true;
  640. }
  641. }
  642. if (selectData.midGateClose == 1 && selectData.midGateOpen == '0' && isMidOpenRunning) {
  643. isMidOpenRunning = false;
  644. if (midDeviceState != 9) {
  645. midDeviceState = 9;
  646. // import.meta.env.VITE_GLOB_IS_SIMULATE ? play(4, timeScale) : play(4);
  647. play(9, timeScale);
  648. backDoorIsOpen.value = false;
  649. }
  650. }
  651. }
  652. function handleCancel() {
  653. modalIsShow.value = false;
  654. modalTitle.value = '';
  655. modalType.value = '';
  656. }
  657. // // 远程、就地切换
  658. // function changeType() {
  659. // const data = {
  660. // deviceid: selectData.deviceID,
  661. // devicetype: selectData.deviceType,
  662. // paramcode: 'autoRoManualControl',
  663. // value: selectData.autoRoManual,
  664. // };
  665. // deviceControlApi(data).then(() => {
  666. // if (globalConfig.History_Type == 'remote') {
  667. // message.success('指令已下发至生产管控平台成功!');
  668. // } else {
  669. // message.success('指令已下发成功!');
  670. // }
  671. // });
  672. // }
  673. onMounted(async () => {
  674. loading.value = true;
  675. const playerDom = document.getElementById('fm-player1')?.getElementsByClassName('vjs-tech')[0];
  676. mountedThree(playerDom).then(async () => {
  677. await getMonitor(true);
  678. loading.value = false;
  679. });
  680. });
  681. onBeforeUnmount(() => {
  682. getDeviceBaseList();
  683. });
  684. onUnmounted(() => {
  685. removeCamera();
  686. if (timer) {
  687. clearTimeout(timer);
  688. timer = undefined;
  689. }
  690. destroy();
  691. });
  692. </script>
  693. ,
  694. <style lang="less" scoped>
  695. @import '/@/design/vent/modal.less';
  696. .scene-box {
  697. .bottom-tabs-box {
  698. height: 350px;
  699. }
  700. }
  701. .button-box {
  702. border: none !important;
  703. height: 34px !important;
  704. &:hover {
  705. background: linear-gradient(#2cd1ff55, #1eb0ff55) !important;
  706. }
  707. &::before {
  708. height: 27px !important;
  709. background: linear-gradient(#1fa6cb, #127cb5) !important;
  710. }
  711. &::after {
  712. top: 35px !important;
  713. }
  714. }
  715. :deep(.@{ventSpace}-tabs-tabpane-active) {
  716. height: 100%;
  717. }
  718. ::-webkit-scrollbar-thumb {
  719. -webkit-box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
  720. background: #4288a444;
  721. }
  722. </style>