index.vue 35 KB

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