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