index.vue 43 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060
  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
  29. v-if="hasPermission('btn:control') && (selectData.deviceType == 'gate_ss' || selectData.deviceType == 'gate_nomal3')"
  30. class="button-box"
  31. @click="playAnimation(8)"
  32. >打开中间门</div
  33. >
  34. <div
  35. v-if="hasPermission('btn:control') && (selectData.deviceType == 'gate_ss' || selectData.deviceType == 'gate_nomal3')"
  36. class="button-box"
  37. @click="playAnimation(9)"
  38. >关闭中间门</div
  39. >
  40. <div v-if="hasPermission('btn:control')" class="button-box" @click="playAnimation(3)">打开后门</div>
  41. <div v-if="hasPermission('btn:control')" class="button-box" @click="playAnimation(4)">关闭后门</div>
  42. <div v-if="!hasPermission('btn:controlWindow') && selectData.deviceType != 'gate_ss'" class="button-box" @click="playAnimation(5)"
  43. >同时打开</div
  44. >
  45. <div v-if="!hasPermission('btn:controlWindow') && selectData.deviceType != 'gate_ss'" class="button-box" @click="playAnimation(6)"
  46. >同时关闭</div
  47. >
  48. <div v-if="hasPermission('btn:controlWindow')" class="button-box" @click="playAnimation(10)">A窗控制</div>
  49. <div v-if="hasPermission('btn:controlWindow')" class="button-box" @click="playAnimation(11)">B窗控制</div>
  50. </div>
  51. <!-- 控制模式 -->
  52. <div class="top-right row" v-if="hasPermission('btn:remote')">
  53. <!-- -->
  54. <div class="vent-flex-m row" v-if="selectData.contrlMod == 'loopCtrl'">
  55. <div class="control-title">控制模式:</div>
  56. <a-radio-group v-model:value="selectData.autoRoManual">
  57. <template v-for="(item, index) in modelList" :key="index">
  58. <a-radio :value="item.value" :disabled="true">{{ item.text }}</a-radio>
  59. </template>
  60. </a-radio-group>
  61. <div class="button-box" @click="playAnimation(7)">切换模式</div>
  62. </div>
  63. <!-- 控制指令是多个,每个状态需要下发单独的指令 -->
  64. <div class="vent-flex-m row" v-else-if="selectData.contrlMod == 'codeCtrl'">
  65. <div class="control-title">控制模式:</div>
  66. <a-radio-group v-model:value="selectData.autoRoManual">
  67. <template v-for="(item, index) in modelList" :key="index">
  68. <a-radio :value="item.value" :disabled="true">{{ item.text }}</a-radio>
  69. </template>
  70. </a-radio-group>
  71. <div class="button-box" v-for="(item, index) in modelList" @click="playAnimation(7, item.value)" :key="index">{{ item.text }}</div>
  72. </div>
  73. <!-- 济南嘉鸿远程、就地、自动控制,自动切换,点位为true就是选中状态 -->
  74. <div class="vent-flex-m row" v-else-if="selectData.contrlMod == 'jnjhCtrl'">
  75. <div class="control-title">控制模式:</div>
  76. <a-radio v-model:checked="selectData.autoRoManual" :disabled="true">远程</a-radio>
  77. <a-radio v-model:checked="selectData.autoRoManual1" :disabled="true">自动</a-radio>
  78. <a-radio v-model:checked="selectData.autoRoManual2" :disabled="true">手动</a-radio>
  79. <div class="button-box" v-for="(item, index) in modelList" @click="playAnimation(7)" :key="index">{{ item.text }}</div>
  80. </div>
  81. <div class="vent-flex-m row" v-else>
  82. <div class="control-title">控制模式:</div>
  83. <a-radio-group v-model:value="selectData.autoRoManual">
  84. <template v-for="(item, index) in modelList" :key="index">
  85. <a-radio :value="item.value" :disabled="true">{{ item.text }}</a-radio>
  86. </template>
  87. </a-radio-group>
  88. <div class="button-box" v-for="(item, index) in modelList" @click="playAnimation(7, item.value)" :key="index">{{ item.text }}</div>
  89. </div>
  90. <!-- <div class="run-type row">
  91. <div class="control-title">运行状态:</div>
  92. <a-radio-group v-model:value="selectData.runRoRecondition">
  93. <a-radio :value="`0`">检修</a-radio>
  94. <a-radio :value="`1`">运行</a-radio>
  95. </a-radio-group>
  96. </div> -->
  97. </div>
  98. </div>
  99. <div class="title-text">
  100. {{ selectData.supplyAirAddr || selectData.strinstallpos || selectData.strname }}
  101. </div>
  102. <div class="bottom-tabs-box" @mousedown="setDivHeight($event, 350, scroll)">
  103. <dv-border-box8 :dur="5" :style="`padding: 5px; height: ${scroll.y + 120}px`">
  104. <a-tabs class="tabs-box" v-model:activeKey="activeKey" @change="tabChange">
  105. <a-tab-pane key="1" tab="实时监测">
  106. <MonitorTable
  107. v-if="activeKey === '1'"
  108. ref="MonitorDataTable"
  109. class="monitor-table"
  110. :columnsType="deviceType"
  111. :isShowActionColumn="true"
  112. :dataSource="dataSource"
  113. design-scope="gate-monitor"
  114. @selectRow="getSelectRow"
  115. :scroll="{ y: scroll.y - 40 }"
  116. title="风门监测"
  117. :isShowPagination="true"
  118. >
  119. <template #filterCell="{ column, record }">
  120. <a-tag v-if="column.dataIndex === 'frontGateOpen' && record.frontGateOpen == '0' && record.frontGateClose == '0'" color="red"
  121. >正在运行</a-tag
  122. >
  123. <a-tag v-else-if="column.dataIndex === 'frontGateOpen' && record.frontGateOpen == '0' && record.frontGateClose == 1" color="default"
  124. >关闭</a-tag
  125. >
  126. <a-tag v-else-if="column.dataIndex === 'frontGateOpen' && record.frontGateOpen == '1' && record.frontGateClose == '0'" color="#46C66F"
  127. >打开</a-tag
  128. >
  129. <a-tag v-else-if="column.dataIndex === 'frontGateOpen' && record.frontGateOpen == '1' && record.frontGateClose == '1'" color="#FF0000"
  130. >点位异常</a-tag
  131. >
  132. <a-tag v-if="column.dataIndex === 'rearGateOpen' && record.rearGateOpen == '0' && record.rearGateClose == '0'" color="red"
  133. >正在运行</a-tag
  134. >
  135. <a-tag v-else-if="column.dataIndex === 'rearGateOpen' && record.rearGateOpen == '0' && record.rearGateClose == '1'" color="default"
  136. >关闭</a-tag
  137. >
  138. <a-tag v-else-if="column.dataIndex === 'rearGateOpen' && record.rearGateOpen == '1' && record.rearGateClose == '0'" color="#46C66F"
  139. >打开</a-tag
  140. >
  141. <a-tag v-else-if="column.dataIndex === 'rearGateOpen' && record.rearGateOpen == '1' && record.rearGateClose == '1'" color="#FF0000"
  142. >点位异常</a-tag
  143. >
  144. <a-tag v-if="column.dataIndex === 'midGateOpen' && record.midGateOpen == '0' && record.midGateClose == '0'" color="red"
  145. >正在运行</a-tag
  146. >
  147. <a-tag v-else-if="column.dataIndex === 'midGateOpen' && record.midGateOpen == '0' && record.midGateClose == 1" color="default"
  148. >关闭</a-tag
  149. >
  150. <a-tag v-else-if="column.dataIndex === 'midGateOpen' && record.midGateOpen == '1' && record.midGateClose == '0'" color="#46C66F"
  151. >打开</a-tag
  152. >
  153. <a-tag v-else-if="column.dataIndex === 'midGateOpen' && record.midGateOpen == '1' && record.midGateClose == '1'" color="#FF0000"
  154. >点位异常</a-tag
  155. >
  156. <template v-if="column.dataIndex === 'ndoortype'">
  157. <span v-if="record.ndoortype == '0'">气动风门</span>
  158. <span v-else color="default">液压风门</span>
  159. </template>
  160. <template v-if="column.dataIndex === 'doorUse'">
  161. <span v-if="record.doorUse == 1" color="default">行车风门</span>
  162. <span v-else-if="record.doorUse == 2">行人风门</span>
  163. <span v-else-if="record.doorUse == 3">短路风门</span>
  164. <span v-else-if="record.doorUse == 4">行车/短路风门</span>
  165. </template>
  166. <template v-else-if="column.dataIndex === 'warnLevel'">
  167. <a-tag v-if="record.warnLevel == '101'" color="green">低风险</a-tag>
  168. <a-tag v-else-if="record.warnLevel == '102'" color="#FF5812">一般风险</a-tag>
  169. <a-tag v-else-if="record.warnLevel == '103'" color="#FF5812">较大风险</a-tag>
  170. <a-tag v-else-if="record.warnLevel == '104'" color="#FF5812">重大风险</a-tag>
  171. <a-tag v-else-if="record.warnLevel == '201'" color="#FF0000">报警</a-tag>
  172. <a-tag v-else-if="record.warnLevel == '10000'" color="#FF5812">数据超限</a-tag>
  173. <a-tag v-else-if="record.warnLevel == '1001'" color="default">网络中断</a-tag>
  174. <a-tag v-else color="green">正常</a-tag>
  175. </template>
  176. <a-tag v-else-if="column.dataIndex === 'warnFlag'" :color="record.warnFlag == '0' ? 'green' : 'red'">{{
  177. record.warnFlag == '0' ? '正常' : '报警'
  178. }}</a-tag>
  179. <a-tag v-if="column.dataIndex === 'netStatus'" :color="record.netStatus == '0' ? '#f00' : 'green'">{{
  180. record.netStatus == '0' ? '断开' : '连接'
  181. }}</a-tag>
  182. </template>
  183. <template #action="{ record }">
  184. <a v-if="globalConfig?.showReport" class="table-action-link" @click="deviceEdit($event, 'reportInfo', record)">报表录入</a>
  185. <a class="table-action-link" @click="deviceEdit($event, 'deviceInfo', record)">设备编辑</a>
  186. </template>
  187. </MonitorTable>
  188. </a-tab-pane>
  189. <!-- <a-tab-pane key="2" tab="实时曲线图" force-render>
  190. <div class="tab-item" v-if="activeKey === '2'">
  191. <DeviceEcharts chartsColumnsType="gate_chart" xAxisPropType="strname" :dataSource="dataSource" height="100%"
  192. :chartsColumns="chartsColumns" :device-list-api="list" device-type="gate" />
  193. </div>
  194. </a-tab-pane> -->
  195. <a-tab-pane key="3" tab="历史数据">
  196. <div class="tab-item" v-if="activeKey === '3'">
  197. <HistoryTable :columnsType="deviceType" :device-type="deviceType" designScope="gate-history" :scroll="scroll">
  198. <template #filterCell="{ column, record }">
  199. <a-tag v-if="column.dataIndex === 'frontGateOpen' && record.frontGateOpen == '0' && record.frontGateClose == '0'" color="red"
  200. >正在运行</a-tag
  201. >
  202. <a-tag v-else-if="column.dataIndex === 'frontGateOpen' && record.frontGateOpen == '0' && record.frontGateClose == 1" color="default"
  203. >关闭</a-tag
  204. >
  205. <a-tag
  206. v-else-if="column.dataIndex === 'frontGateOpen' && record.frontGateOpen == '1' && record.frontGateClose == '0'"
  207. color="#46C66F"
  208. >打开</a-tag
  209. >
  210. <a-tag
  211. v-else-if="column.dataIndex === 'frontGateOpen' && record.frontGateOpen == '1' && record.frontGateClose == '1'"
  212. color="#FF0000"
  213. >点位异常</a-tag
  214. >
  215. <a-tag v-if="column.dataIndex === 'rearGateOpen' && record.rearGateOpen == '0' && record.rearGateClose == '0'" color="red"
  216. >正在运行</a-tag
  217. >
  218. <a-tag v-else-if="column.dataIndex === 'rearGateOpen' && record.rearGateOpen == '0' && record.rearGateClose == '1'" color="default"
  219. >关闭</a-tag
  220. >
  221. <a-tag v-else-if="column.dataIndex === 'rearGateOpen' && record.rearGateOpen == '1' && record.rearGateClose == '0'" color="#46C66F"
  222. >打开</a-tag
  223. >
  224. <a-tag v-else-if="column.dataIndex === 'rearGateOpen' && record.rearGateOpen == '1' && record.rearGateClose == '1'" color="#FF0000"
  225. >点位异常</a-tag
  226. >
  227. <a-tag v-if="column.dataIndex === 'midGateOpen' && record.midGateOpen == '0' && record.midGateClose == '0'" color="red"
  228. >正在运行</a-tag
  229. >
  230. <a-tag v-else-if="column.dataIndex === 'midGateOpen' && record.midGateOpen == '0' && record.midGateClose == 1" color="default"
  231. >关闭</a-tag
  232. >
  233. <a-tag v-else-if="column.dataIndex === 'midGateOpen' && record.midGateOpen == '1' && record.midGateClose == '0'" color="#46C66F"
  234. >打开</a-tag
  235. >
  236. <a-tag v-else-if="column.dataIndex === 'midGateOpen' && record.midGateOpen == '1' && record.midGateClose == '1'" color="#FF0000"
  237. >点位异常</a-tag
  238. >
  239. <template v-if="column.dataIndex === 'ndoortype'">
  240. <span v-if="record.ndoortype == '0'">气动风门</span>
  241. <span v-else color="default">液压风门</span>
  242. </template>
  243. <template v-if="column.dataIndex === 'doorUse'">
  244. <span v-if="record.doorUse == 1" color="default">行车风门</span>
  245. <span v-else-if="record.doorUse == 2">行人风门</span>
  246. <span v-else-if="record.doorUse == 3">短路风门</span>
  247. <span v-else-if="record.doorUse == 4">行车/短路风门</span>
  248. </template>
  249. <template v-else-if="column.dataIndex === 'warnLevel'">
  250. <a-tag v-if="record.warnLevel == '101'" color="green">低风险</a-tag>
  251. <a-tag v-else-if="record.warnLevel == '102'" color="#FF5812">一般风险</a-tag>
  252. <a-tag v-else-if="record.warnLevel == '103'" color="#FF5812">较大风险</a-tag>
  253. <a-tag v-else-if="record.warnLevel == '104'" color="#FF5812">重大风险</a-tag>
  254. <a-tag v-else-if="record.warnLevel == '201'" color="#FF0000">报警</a-tag>
  255. <a-tag v-else-if="record.warnLevel == '10000'" color="#FF5812">数据超限</a-tag>
  256. <a-tag v-else-if="record.warnLevel == '1001'" color="default">网络中断</a-tag>
  257. <a-tag v-else color="green">正常</a-tag>
  258. </template>
  259. </template>
  260. </HistoryTable>
  261. </div>
  262. </a-tab-pane>
  263. <a-tab-pane key="4" tab="报警历史">
  264. <div class="tab-item" v-if="activeKey === '4'">
  265. <AlarmHistoryTable
  266. columns-type="alarm"
  267. :device-type="deviceType"
  268. :device-list-api="getTableList"
  269. designScope="alarm-history"
  270. :scroll="scroll"
  271. >
  272. <template #filterCell="{ column, record }">
  273. <a-tag v-if="column.dataIndex === 'warnFlag'" :color="record.warnFlag == '0' ? 'green' : record.warnFlag == 1 ? '#FF5812' : 'gray'">
  274. {{ record.warnFlag == '0' ? '正常' : record.warnFlag == 1 ? '报警' : record.warnFlag == 2 ? '断开' : '未监测' }}</a-tag
  275. >
  276. <a-tag v-if="column.dataIndex === 'netStatus'" :color="record.netStatus == '0' ? '#f00' : 'green'">{{
  277. record.netStatus == '0' ? '断开' : '连接'
  278. }}</a-tag>
  279. </template>
  280. </AlarmHistoryTable>
  281. </div>
  282. </a-tab-pane>
  283. <a-tab-pane key="5" tab="操作历史">
  284. <div class="tab-item" v-if="activeKey === '5'">
  285. <HandlerHistoryTable
  286. columns-type="operator_history"
  287. :device-type="deviceType"
  288. :device-list-api="getTableList"
  289. designScope="operator_history"
  290. :scroll="scroll"
  291. />
  292. </div>
  293. </a-tab-pane>
  294. </a-tabs>
  295. </dv-border-box8>
  296. </div>
  297. </div>
  298. <div ref="playerRef" style="z-index: 999; position: absolute; top: 100px; right: 15px; width: 300px; height: 280px; margin: auto"> </div>
  299. <LivePlayer
  300. id="fm-player1"
  301. style="height: 220px; width: 300px; position: absolute; top: 0px; z-index: -1"
  302. ref="player1"
  303. :videoUrl="flvURL1()"
  304. muted
  305. live
  306. loading
  307. controls
  308. />
  309. <HandleModal
  310. v-if="!globalConfig?.simulatedPassword"
  311. :modal-is-show="modalIsShow"
  312. :modal-title="modalTitle"
  313. :modal-type="modalType"
  314. @handle-ok="handleOK"
  315. @handle-cancel="handleCancel"
  316. />
  317. <DeviceBaseInfo @register="registerModal" :device-type="selectData['deviceType']" />
  318. </template>
  319. <script setup lang="ts">
  320. import { onBeforeUnmount, onUnmounted, onMounted, ref, reactive, nextTick, inject, unref } from 'vue';
  321. import MonitorTable from '../comment/MonitorTable.vue';
  322. import HistoryTable from '../comment/HistoryTable.vue';
  323. import AlarmHistoryTable from '../comment/AlarmHistoryTable.vue';
  324. import HandlerHistoryTable from '../comment/HandlerHistoryTable.vue';
  325. import HandleModal from './modal.vue';
  326. import DeviceBaseInfo from '../comment/components/DeviceBaseInfo.vue';
  327. import { mountedThree, addMonitorText, play, destroy, setModelType, computePlay, playWindow } from './gate.threejs';
  328. import { deviceControlApi } from '/@/api/vent/index';
  329. import { message } from 'ant-design-vue';
  330. import { list, getTableList, cameraList, cameraAddrList } from './gate.api';
  331. import lodash from 'lodash';
  332. import { setDivHeight } from '/@/utils/event';
  333. import { BorderBox8 as DvBorderBox8 } from '@kjgl77/datav-vue3';
  334. import { useRouter } from 'vue-router';
  335. import LivePlayer from '@liveqing/liveplayer-v3';
  336. import { useModal } from '/@/components/Modal';
  337. import { useCamera } from '/@/hooks/system/useCamera';
  338. import { usePermission } from '/@/hooks/web/usePermission';
  339. import { getDictItems } from '/@/api/common/api';
  340. const { hasPermission } = usePermission();
  341. const globalConfig = inject('globalConfig');
  342. const { currentRoute } = useRouter();
  343. const MonitorDataTable = ref();
  344. let contrlValue = '';
  345. const playerRef = ref();
  346. const deviceType = ref('gate');
  347. const activeKey = ref('1'); // tab
  348. const loading = ref(false);
  349. const scroll = reactive({
  350. y: 230,
  351. });
  352. const modelList = ref<{ text: string; value: string }[]>([]);
  353. const frontDoorIsOpen = ref(false); //前门是否开启
  354. const backDoorIsOpen = ref(false); //后门是否开启
  355. const midDoorIsOpen = ref(false); //中间门是否开启
  356. const modalIsShow = ref<boolean>(false); // 是否显示模态框
  357. const modalTitle = ref(''); // 模态框标题显示内容,根据设备操作类型决定
  358. const modalType = ref(''); // 模态框内容显示类型,设备操作类型
  359. const selectRowIndex = ref(-1); // 选中行
  360. const dataSource = ref([]);
  361. const deviceBaseList = ref([]); // 设备基本信息
  362. const [registerModal, { openModal, closeModal }] = useModal();
  363. const { getCamera, removeCamera } = useCamera();
  364. const tabChange = (activeKeyVal) => {
  365. activeKey.value = activeKeyVal;
  366. if (activeKeyVal == 1) {
  367. nextTick(() => {
  368. if (MonitorDataTable.value) MonitorDataTable.value.setSelectedRowKeys([selectData.deviceID]);
  369. });
  370. }
  371. };
  372. const initData = {
  373. deviceID: '',
  374. deviceType: '',
  375. strname: '',
  376. frontRearDP: '-', //压差
  377. // sourcePressure: '-', //气源压力
  378. runRoRecondition: null,
  379. autoRoManual: null,
  380. netStatus: '0', //通信状态
  381. frontGateOpen: '0',
  382. frontGateClose: '1',
  383. rearGateOpen: '0',
  384. rearGateClose: '1',
  385. midGateOpen: '0',
  386. midGateClose: '1',
  387. fault: '气源压力超限',
  388. masterComputer: 0,
  389. frontGateOpenCtrl: false,
  390. rearGateOpenCtrl: false,
  391. cameras: [],
  392. };
  393. // 监测数据
  394. const selectData = reactive(lodash.cloneDeep(initData));
  395. const flvURL1 = () => {
  396. // return ''
  397. return `/video/gate.mp4`;
  398. };
  399. function deviceEdit(e: Event, type: string, record) {
  400. e.stopPropagation();
  401. openModal(true, {
  402. type,
  403. deviceId: record['deviceID'],
  404. });
  405. }
  406. // 获取设备基本信息列表
  407. function getDeviceBaseList() {
  408. getTableList({ pageSize: 1000 }).then((res) => {
  409. deviceBaseList.value = res.records;
  410. });
  411. }
  412. // https获取监测数据
  413. let timer: null | NodeJS.Timeout = null;
  414. async function getMonitor(flag?) {
  415. if (Object.prototype.toString.call(timer) === '[object Null]') {
  416. timer = await setTimeout(
  417. async () => {
  418. const res = await list({ devicetype: deviceType.value, pagetype: 'normal' });
  419. if (res.msgTxt && res.msgTxt[0]) {
  420. dataSource.value = res.msgTxt[0].datalist || [];
  421. dataSource.value.forEach((data: any) => {
  422. const readData = data.readData;
  423. data = Object.assign(data, readData);
  424. });
  425. if (dataSource.value.length > 0 && selectRowIndex.value == -1 && MonitorDataTable.value) {
  426. // 初始打开页面
  427. if (currentRoute.value && currentRoute.value['query'] && currentRoute.value['query']['id']) {
  428. MonitorDataTable.value.setSelectedRowKeys([currentRoute.value['query']['id']]);
  429. } else {
  430. MonitorDataTable.value.setSelectedRowKeys([dataSource.value[0]['deviceID']]);
  431. }
  432. }
  433. Object.assign(selectData, dataSource.value[selectRowIndex.value]);
  434. addMonitorText(selectData);
  435. monitorAnimation(selectData);
  436. if (timer) {
  437. timer = null;
  438. }
  439. getMonitor();
  440. }
  441. },
  442. flag ? 0 : 1000
  443. );
  444. }
  445. }
  446. // 切换检测数据
  447. async function getSelectRow(selectRow, index) {
  448. if (!selectRow) return;
  449. loading.value = true;
  450. selectRowIndex.value = index;
  451. const baseData: any = deviceBaseList.value.find((baseData: any) => baseData.id === selectRow.deviceID);
  452. Object.assign(selectData, initData, selectRow, baseData);
  453. isFrontOpenRunning = false; //开关门动作是否在进行
  454. isRearOpenRunning = false; //开关门动作是否在进行
  455. isMidOpenRunning = false; //开关门动作是否在进行
  456. frontDeviceState = 0; //记录设备状态,为了与下一次监测数据做比较
  457. rearDeviceState = 0; //记录设备状态,为了与下一次监测数据做比较
  458. midDeviceState = 0; //记录设备状态,为了与下一次监测数据做比较
  459. // const type = selectData.nwindownum == 1 ? 'singleWindow' : 'doubleWindow';
  460. let type;
  461. if (selectData['doorUse'] == 2) {
  462. type = 'fmXr';
  463. } else {
  464. if (selectData.deviceType == 'gate_ss') {
  465. type = 'fm2';
  466. // type = 'fmWindow';
  467. } else if (selectData.deviceType == 'gate_qd' || selectData.deviceType == 'gate_normal') {
  468. type = 'fm3';
  469. } else if (selectData.deviceType == 'gate_ss_two' || selectData.deviceType == 'gate_ss_two1') {
  470. type = 'fmTwoSs';
  471. } else if (selectData.deviceType == 'gate_nomal3') {
  472. type = 'fmThreeTl';
  473. } else if (selectData.deviceType == 'gate_tj') {
  474. type = 'fmWindow';
  475. } else {
  476. type = 'fm1'; // 液压
  477. }
  478. }
  479. setModelType(type).then(async () => {
  480. addMonitorText(selectData);
  481. loading.value = false;
  482. });
  483. await getCamera(selectRow.deviceID, playerRef.value);
  484. }
  485. // 播放动画
  486. function playAnimation(handlerState, data: any = null) {
  487. const value = data;
  488. switch (handlerState) {
  489. case 1: // 打开前门
  490. if (selectData.frontGateOpen == '0' && selectData.frontGateClose == '1') {
  491. modalTitle.value = '打开前门';
  492. modalType.value = '1';
  493. modalIsShow.value = true;
  494. } else {
  495. // message.warning('前门已经打开或正在打开,请勿重新操作');
  496. message.warning('没有监测到前门关到位,无法进行指令下发操作');
  497. }
  498. break;
  499. case 2: // 关闭前门
  500. if (selectData.frontGateOpen == '1' && selectData.frontGateClose == '0') {
  501. modalTitle.value = '关闭前门';
  502. modalType.value = '2';
  503. modalIsShow.value = true;
  504. } else {
  505. // message.warning('前门已经关闭或正在关闭,请勿重新操作');
  506. message.warning('没有监测到前门开到位,无法进行指令下发操作');
  507. }
  508. break;
  509. case 3: // 打开后门
  510. if (selectData.rearGateOpen == '0' && selectData.rearGateClose == '1') {
  511. modalTitle.value = '打开后门';
  512. modalType.value = '3';
  513. modalIsShow.value = true;
  514. } else {
  515. // message.warning('后门已经打开或正在打开,请勿重新操作');
  516. message.warning('没有监测到后门关到位,无法进行指令下发操作');
  517. }
  518. break;
  519. case 4: // 关闭后门
  520. if (selectData.rearGateOpen == '1' && selectData.rearGateClose == '0') {
  521. modalTitle.value = '关闭后门';
  522. modalType.value = '4';
  523. modalIsShow.value = true;
  524. } else {
  525. // message.warning('后门已经关闭或正在关闭,请勿重新操作');
  526. message.warning('没有监测到后门开到位,无法进行指令下发操作');
  527. }
  528. break;
  529. case 8: // 打开中间门
  530. if (selectData.midGateOpen == '0' && selectData.midGateClose == '1') {
  531. modalTitle.value = '打开中间门';
  532. modalType.value = '8';
  533. modalIsShow.value = true;
  534. } else {
  535. // message.warning('后门已经打开或正在打开,请勿重新操作');
  536. message.warning('没有监测到中间门关到位,无法进行指令下发操作');
  537. }
  538. break;
  539. case 9: // 关闭中间门
  540. if (selectData.midGateOpen == '1' && selectData.midGateClose == '0') {
  541. modalTitle.value = '关闭中间门';
  542. modalType.value = '9';
  543. modalIsShow.value = true;
  544. } else {
  545. // message.warning('后门已经关闭或正在关闭,请勿重新操作');
  546. message.warning('没有监测到中间门开到位,无法进行指令下发操作');
  547. }
  548. break;
  549. case 5: // 打开前后门
  550. if (
  551. selectData.frontGateOpen == '0' &&
  552. selectData.frontGateClose == '1' &&
  553. selectData.rearGateOpen == '0' &&
  554. selectData.rearGateClose == '1'
  555. ) {
  556. modalTitle.value = '打开前后门';
  557. modalType.value = '5';
  558. modalIsShow.value = true;
  559. } else {
  560. // message.warning('前后门已经打开或正在打开,请勿重新操作');
  561. message.warning('没有监测到前门、后门关到位,无法进行指令下发操作');
  562. }
  563. break;
  564. case 6: // 关闭前后门
  565. if (
  566. selectData.frontGateOpen == '1' &&
  567. selectData.frontGateClose == '0' &&
  568. selectData.rearGateOpen == '1' &&
  569. selectData.rearGateClose == '0'
  570. ) {
  571. modalTitle.value = '关闭前后门';
  572. modalType.value = '6';
  573. modalIsShow.value = true;
  574. } else {
  575. // message.warning('前后门已经关闭或正在关闭,请勿重新操作');
  576. message.warning('没有监测到前门、后门开到位,无法进行指令下发操作');
  577. }
  578. break;
  579. case 7: // 控制模式切换
  580. modalTitle.value = '控制模式切换';
  581. modalType.value = '7';
  582. modalIsShow.value = true;
  583. break;
  584. case 10: // 风窗控制
  585. modalTitle.value = 'A窗控制';
  586. modalType.value = '10';
  587. modalIsShow.value = true;
  588. break;
  589. case 11: // 风窗控制
  590. modalTitle.value = 'B窗控制';
  591. modalType.value = '11';
  592. modalIsShow.value = true;
  593. break;
  594. }
  595. if (globalConfig?.simulatedPassword) {
  596. handleOK('', handlerState + '');
  597. }
  598. contrlValue = value;
  599. }
  600. // 保德缺打开状态
  601. // function playAnimation(handlerState, data: any = null) {
  602. // const value = data;
  603. // switch (handlerState) {
  604. // case 1: // 打开前门
  605. // modalTitle.value = '打开前门';
  606. // modalType.value = '1';
  607. // modalIsShow.value = true;
  608. // break;
  609. // case 2: // 关闭前门
  610. // modalTitle.value = '关闭前门';
  611. // modalType.value = '2';
  612. // modalIsShow.value = true;
  613. // break;
  614. // case 3: // 打开后门
  615. // modalTitle.value = '打开后门';
  616. // modalType.value = '3';
  617. // modalIsShow.value = true;
  618. // break;
  619. // case 4: // 关闭后门
  620. // modalTitle.value = '关闭后门';
  621. // modalType.value = '4';
  622. // modalIsShow.value = true;
  623. // break;
  624. // case 8: // 打开中间门
  625. // modalTitle.value = '打开中间门';
  626. // modalType.value = '8';
  627. // modalIsShow.value = true;
  628. // break;
  629. // case 9: // 关闭中间门
  630. // modalTitle.value = '关闭中间门';
  631. // modalType.value = '9';
  632. // modalIsShow.value = true;
  633. // break;
  634. // case 5: // 打开前后门
  635. // modalTitle.value = '打开前后门';
  636. // modalType.value = '5';
  637. // modalIsShow.value = true;
  638. // break;
  639. // case 6: // 关闭前后门
  640. // modalTitle.value = '关闭前后门';
  641. // modalType.value = '6';
  642. // modalIsShow.value = true;
  643. // break;
  644. // case 7: // 控制模式切换
  645. // modalTitle.value = '控制模式切换';
  646. // modalType.value = '7';
  647. // modalIsShow.value = true;
  648. // break;
  649. // case 10: // 风窗控制
  650. // modalTitle.value = '风窗控制';
  651. // modalType.value = '10';
  652. // modalIsShow.value = true;
  653. // break;
  654. // }
  655. // if (globalConfig?.simulatedPassword) {
  656. // handleOK('', handlerState + '');
  657. // }
  658. // contrlValue = value;
  659. // }
  660. function handleOK(passWord, handlerState, value?) {
  661. if (!passWord && !globalConfig?.simulatedPassword) {
  662. message.warning('请输入密码');
  663. return;
  664. }
  665. if (isOpenRunning) {
  666. message.warning('风门正在运行。。。');
  667. modalIsShow.value = false;
  668. return;
  669. }
  670. const data = {
  671. deviceid: selectData.deviceID,
  672. devicetype: selectData.deviceType,
  673. paramcode: '',
  674. value: contrlValue,
  675. password: passWord || globalConfig?.simulatedPassword,
  676. masterComputer: selectData.masterComputer,
  677. };
  678. let handler = () => {};
  679. switch (handlerState) {
  680. case '1': // 打开前门
  681. if (selectData.frontGateOpen == '0' && selectData.frontGateClose == '1') {
  682. handler = () => {
  683. frontDoorIsOpen.value = true;
  684. };
  685. data.paramcode = 'frontGateOpen_S';
  686. } else {
  687. message.warning('前门已打开。。。');
  688. modalIsShow.value = false;
  689. }
  690. break;
  691. case '2': // 关闭前门
  692. if (selectData.frontGateOpen == '1' && selectData.frontGateClose == '0') {
  693. handler = () => {
  694. frontDoorIsOpen.value = false;
  695. };
  696. data.paramcode = 'frontGateClose_S';
  697. } else {
  698. message.warning('前门已关闭。。。');
  699. modalIsShow.value = false;
  700. }
  701. break;
  702. case '3': // 打开后门
  703. if (selectData.rearGateOpen == '0' && selectData.rearGateClose == '1') {
  704. handler = () => {
  705. backDoorIsOpen.value = true;
  706. };
  707. data.paramcode = 'rearGateOpen_S';
  708. } else {
  709. message.warning('后门已打开。。。');
  710. modalIsShow.value = false;
  711. }
  712. break;
  713. case '4': // 关闭后门
  714. if (selectData.rearGateOpen == '1' && selectData.rearGateClose == '0') {
  715. handler = () => {
  716. backDoorIsOpen.value = false;
  717. };
  718. data.paramcode = 'rearGateClose_S';
  719. } else {
  720. message.warning('后门已关闭。。。');
  721. modalIsShow.value = false;
  722. }
  723. break;
  724. case '8': // 打开中间门
  725. if (selectData.midGateOpen == '0' && selectData.midGateClose == '1') {
  726. handler = () => {
  727. midDoorIsOpen.value = true;
  728. };
  729. data.paramcode = 'midGateOpen_S';
  730. } else {
  731. message.warning('中间风门已打开。。。');
  732. modalIsShow.value = false;
  733. }
  734. break;
  735. case '9': // 关闭中间门
  736. if (selectData.midGateOpen == '1' && selectData.midGateClose == '0') {
  737. handler = () => {
  738. midDoorIsOpen.value = false;
  739. };
  740. data.paramcode = 'midGateClose_S';
  741. } else {
  742. message.warning('中间风门已关闭。。。');
  743. modalIsShow.value = false;
  744. }
  745. break;
  746. case '5': // 打开前后门
  747. if (
  748. selectData.frontGateOpen == '0' &&
  749. selectData.frontGateClose == '1' &&
  750. selectData.rearGateOpen == '0' &&
  751. selectData.rearGateClose == '1'
  752. ) {
  753. handler = () => {
  754. frontDoorIsOpen.value = true;
  755. backDoorIsOpen.value = true;
  756. };
  757. data.paramcode = 'sameTimeOpen';
  758. }
  759. break;
  760. case '6': // 关闭前后门
  761. if (
  762. selectData.frontGateOpen == '1' &&
  763. selectData.frontGateClose == '0' &&
  764. selectData.rearGateOpen == '1' &&
  765. selectData.rearGateClose == '0'
  766. ) {
  767. handler = () => {
  768. frontDoorIsOpen.value = false;
  769. backDoorIsOpen.value = false;
  770. };
  771. data.paramcode = 'sameTimeClose';
  772. }
  773. break;
  774. case '7': // 远程与就地
  775. if (selectData.contrlMod == 'codeCtrl') {
  776. if (contrlValue == '1') {
  777. data.paramcode = 'autoRoManualControl1';
  778. } else if (contrlValue == '0') {
  779. data.paramcode = 'autoRoManualControl2';
  780. } else {
  781. data.paramcode = 'autoRoManualControl0';
  782. }
  783. data.value = '';
  784. selectData.autoRoManual = null;
  785. } else if (selectData.contrlMod == 'loopCtrl' || selectData.contrlMod == 'jnjhCtrl') {
  786. data.paramcode = 'autoRoManualControl';
  787. data.value = '';
  788. selectData.autoRoManual = null;
  789. } else {
  790. data.paramcode = 'autoRoManualControl';
  791. data.value = contrlValue;
  792. selectData.autoRoManual = null;
  793. }
  794. break;
  795. case '10': // 前(A)窗控制
  796. data.paramcode = 'frontSetValue';
  797. data.value = value;
  798. break;
  799. case '11': // 后(B)窗控制
  800. data.paramcode = 'rearSetValue';
  801. data.value = value;
  802. break;
  803. }
  804. if (data.paramcode) {
  805. deviceControlApi(data).then((res) => {
  806. // 模拟时开启
  807. if (res.success) {
  808. modalIsShow.value = false;
  809. if (globalConfig.History_Type == 'remote') {
  810. message.success('指令已下发至生产管控平台成功!');
  811. } else {
  812. message.success('指令已下发成功!');
  813. }
  814. } else {
  815. message.error(res.message);
  816. }
  817. });
  818. }
  819. }
  820. let isOpenRunning = false; //开关门动作是否在进行
  821. /** 开关门动画调用 */
  822. let isFrontOpenRunning = false; //开关门动作是否在进行
  823. // let isFrontCloseRunning = false; //开关门动作是否在进行
  824. let isRearOpenRunning = false; //开关门动作是否在进行
  825. // let isRearCloseRunning = false; //开关门动作是否在进行
  826. let isMidOpenRunning = false; //中间门动作是否在进行
  827. // let isMidCloseRunning = false; //中间门动作是否在进行
  828. // 0 关闭 1 正在打开 2 打开 3正在关闭
  829. let frontDeviceState = 0; //记录设备状态,为了与下一次监测数据做比较
  830. let rearDeviceState = 0; //记录设备状态,为了与下一次监测数据做比较
  831. let midDeviceState = 0; //记录设备状态,为了与下一次监测数据做比较
  832. function monitorAnimation(selectData) {
  833. const timeScale = 0.005;
  834. // 带风窗 风窗动画
  835. playWindowAnimation(selectData);
  836. if (selectData.frontGateOpen == '1' && selectData.frontGateClose == '0' && !isFrontOpenRunning) {
  837. isFrontOpenRunning = true;
  838. if (frontDeviceState != 1) {
  839. // import.meta.env.VITE_GLOB_IS_SIMULATE ? play(1, timeScale) : play(1);
  840. play(1, timeScale);
  841. frontDeviceState = 1;
  842. frontDoorIsOpen.value = false;
  843. backDoorIsOpen.value = true;
  844. }
  845. }
  846. if (selectData.frontGateOpen == '0' && selectData.frontGateClose == '0' && !isFrontOpenRunning) {
  847. isFrontOpenRunning = true;
  848. if (frontDeviceState != 1) {
  849. // import.meta.env.VITE_GLOB_IS_SIMULATE ? play(1, timeScale) : play(1);
  850. play(1, timeScale);
  851. frontDeviceState = 1;
  852. frontDoorIsOpen.value = false;
  853. backDoorIsOpen.value = true;
  854. }
  855. }
  856. if (selectData.frontGateClose == '1' && selectData.frontGateOpen == '0' && isFrontOpenRunning) {
  857. isFrontOpenRunning = false;
  858. if (frontDeviceState != 0) {
  859. // import.meta.env.VITE_GLOB_IS_SIMULATE ? play(2, timeScale) : play(2);
  860. play(2, timeScale);
  861. frontDeviceState = 0;
  862. frontDoorIsOpen.value = false;
  863. // backDoorIsOpen.value = false
  864. }
  865. }
  866. if (selectData.rearGateOpen == '1' && selectData.rearGateClose == '0' && !isRearOpenRunning) {
  867. isRearOpenRunning = true;
  868. if (rearDeviceState != 1) {
  869. rearDeviceState = 1;
  870. // import.meta.env.VITE_GLOB_IS_SIMULATE ? play(3, timeScale) : play(3);
  871. play(3, timeScale);
  872. backDoorIsOpen.value = false;
  873. frontDoorIsOpen.value = true;
  874. }
  875. }
  876. if (selectData.rearGateOpen == '0' && selectData.rearGateClose == '0' && !isRearOpenRunning) {
  877. isRearOpenRunning = true;
  878. if (rearDeviceState != 1) {
  879. rearDeviceState = 1;
  880. // import.meta.env.VITE_GLOB_IS_SIMULATE ? play(3, timeScale) : play(3);
  881. play(3, timeScale);
  882. backDoorIsOpen.value = false;
  883. frontDoorIsOpen.value = true;
  884. }
  885. }
  886. if (selectData.rearGateClose == '1' && selectData.rearGateOpen == '0' && isRearOpenRunning) {
  887. isRearOpenRunning = false;
  888. if (rearDeviceState != 0) {
  889. rearDeviceState = 0;
  890. // import.meta.env.VITE_GLOB_IS_SIMULATE ? play(4, timeScale) : play(4);
  891. play(4, timeScale);
  892. backDoorIsOpen.value = false;
  893. }
  894. }
  895. if (selectData.midGateOpen == '1' && selectData.midGateClose == '0' && !isMidOpenRunning) {
  896. isMidOpenRunning = true;
  897. if (midDeviceState != 1) {
  898. midDeviceState = 1;
  899. // import.meta.env.VITE_GLOB_IS_SIMULATE ? play(3, timeScale) : play(3);
  900. play(8, timeScale);
  901. backDoorIsOpen.value = false;
  902. frontDoorIsOpen.value = true;
  903. }
  904. }
  905. if (selectData.midGateOpen == '0' && selectData.midGateClose == '0' && !isMidOpenRunning) {
  906. isMidOpenRunning = true;
  907. if (midDeviceState != 1) {
  908. midDeviceState = 1;
  909. // import.meta.env.VITE_GLOB_IS_SIMULATE ? play(3, timeScale) : play(3);
  910. play(8, timeScale);
  911. backDoorIsOpen.value = false;
  912. frontDoorIsOpen.value = true;
  913. }
  914. }
  915. if (selectData.midGateClose == '1' && selectData.midGateOpen == '0' && isMidOpenRunning) {
  916. isMidOpenRunning = false;
  917. if (midDeviceState != 0) {
  918. midDeviceState = 0;
  919. // import.meta.env.VITE_GLOB_IS_SIMULATE ? play(4, timeScale) : play(4);
  920. play(9, timeScale);
  921. backDoorIsOpen.value = false;
  922. }
  923. }
  924. }
  925. function playWindowAnimation(data, maxarea = 90, isFirst = false) {
  926. computePlay(data, maxarea, isFirst);
  927. }
  928. function handleCancel() {
  929. modalIsShow.value = false;
  930. modalTitle.value = '';
  931. modalType.value = '';
  932. }
  933. // // 远程、就地切换
  934. // function changeType() {
  935. // const data = {
  936. // deviceid: selectData.deviceID,
  937. // devicetype: selectData.deviceType,
  938. // paramcode: 'autoRoManualControl',
  939. // value: selectData.autoRoManual,
  940. // };
  941. // deviceControlApi(data).then(() => {
  942. // if (globalConfig.History_Type == 'remote') {
  943. // message.success('指令已下发至生产管控平台成功!');
  944. // } else {
  945. // message.success('指令已下发成功!');
  946. // }
  947. // });
  948. // }
  949. onMounted(async () => {
  950. const { query } = unref(currentRoute);
  951. if (query['deviceType']) deviceType.value = query['deviceType'] as string;
  952. modelList.value = await getDictItems('gateModel');
  953. loading.value = true;
  954. const playerDom = document.getElementById('fm-player1')?.getElementsByClassName('vjs-tech')[0];
  955. mountedThree(playerDom).then(async () => {
  956. await getMonitor(true);
  957. loading.value = false;
  958. });
  959. });
  960. onBeforeUnmount(() => {
  961. getDeviceBaseList();
  962. });
  963. onUnmounted(() => {
  964. removeCamera();
  965. if (timer) {
  966. clearTimeout(timer);
  967. timer = undefined;
  968. }
  969. destroy();
  970. });
  971. </script>
  972. ,
  973. <style lang="less" scoped>
  974. @import '/@/design/theme.less';
  975. @import '/@/design/vent/modal.less';
  976. .scene-box {
  977. .bottom-tabs-box {
  978. height: 350px;
  979. }
  980. }
  981. .button-box {
  982. border: none !important;
  983. height: 34px !important;
  984. &:hover {
  985. background: var(--vent-device-manager-control-btn-hover) !important;
  986. }
  987. &::before {
  988. height: 27px !important;
  989. background: var(--vent-device-manager-control-btn) !important;
  990. }
  991. &::after {
  992. top: 35px !important;
  993. }
  994. }
  995. :deep(.@{ventSpace}-tabs-tabpane-active) {
  996. height: 100%;
  997. }
  998. ::-webkit-scrollbar-thumb {
  999. -webkit-box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
  1000. background: #4288a444;
  1001. }
  1002. :deep(.zxm-radio-disabled + span) {
  1003. color: var(--vent-font-color) !important;
  1004. }
  1005. :deep(.zxm-radio-disabled .zxm-radio-inner::after) {
  1006. background-color: #127cb5 !important;
  1007. }
  1008. </style>