index.vue 43 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064
  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" @click="playAnimation(7)">模式切换</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. if (selectData.contrlMod == 'jnjhCtrl') {
  435. selectData['autoRoManual'] = selectData['autoRoManual'] == 1 ? true : false;
  436. selectData['autoRoManual1'] = selectData['autoRoManual1'] == 1 ? true : false;
  437. selectData['autoRoManual2'] = selectData['autoRoManual2'] == 1 ? true : false;
  438. }
  439. addMonitorText(selectData);
  440. monitorAnimation(selectData);
  441. if (timer) {
  442. timer = null;
  443. }
  444. getMonitor();
  445. }
  446. },
  447. flag ? 0 : 1000
  448. );
  449. }
  450. }
  451. // 切换检测数据
  452. async function getSelectRow(selectRow, index) {
  453. if (!selectRow) return;
  454. loading.value = true;
  455. selectRowIndex.value = index;
  456. const baseData: any = deviceBaseList.value.find((baseData: any) => baseData.id === selectRow.deviceID);
  457. Object.assign(selectData, initData, selectRow, baseData);
  458. isFrontOpenRunning = false; //开关门动作是否在进行
  459. isRearOpenRunning = false; //开关门动作是否在进行
  460. isMidOpenRunning = false; //开关门动作是否在进行
  461. frontDeviceState = 0; //记录设备状态,为了与下一次监测数据做比较
  462. rearDeviceState = 0; //记录设备状态,为了与下一次监测数据做比较
  463. midDeviceState = 0; //记录设备状态,为了与下一次监测数据做比较
  464. // const type = selectData.nwindownum == 1 ? 'singleWindow' : 'doubleWindow';
  465. let type;
  466. if (selectData['doorUse'] == 2) {
  467. type = 'fmXr';
  468. } else {
  469. if (selectData.deviceType == 'gate_ss') {
  470. type = 'fm2';
  471. // type = 'fmWindow';
  472. } else if (selectData.deviceType == 'gate_qd' || selectData.deviceType == 'gate_normal') {
  473. type = 'fm3';
  474. } else if (selectData.deviceType == 'gate_ss_two' || selectData.deviceType == 'gate_ss_two1') {
  475. type = 'fmTwoSs';
  476. } else if (selectData.deviceType == 'gate_nomal3') {
  477. type = 'fmThreeTl';
  478. } else if (selectData.deviceType == 'gate_tj') {
  479. type = 'fmWindow';
  480. } else {
  481. type = 'fm1'; // 液压
  482. }
  483. }
  484. setModelType(type).then(async () => {
  485. addMonitorText(selectData);
  486. loading.value = false;
  487. });
  488. await getCamera(selectRow.deviceID, playerRef.value);
  489. }
  490. // 播放动画
  491. function playAnimation(handlerState, data: any = null) {
  492. const value = data;
  493. switch (handlerState) {
  494. case 1: // 打开前门
  495. if (selectData.frontGateOpen == '0' && selectData.frontGateClose == '1') {
  496. modalTitle.value = '打开前门';
  497. modalType.value = '1';
  498. modalIsShow.value = true;
  499. } else {
  500. // message.warning('前门已经打开或正在打开,请勿重新操作');
  501. message.warning('没有监测到前门关到位,无法进行指令下发操作');
  502. }
  503. break;
  504. case 2: // 关闭前门
  505. if (selectData.frontGateOpen == '1' && selectData.frontGateClose == '0') {
  506. modalTitle.value = '关闭前门';
  507. modalType.value = '2';
  508. modalIsShow.value = true;
  509. } else {
  510. // message.warning('前门已经关闭或正在关闭,请勿重新操作');
  511. message.warning('没有监测到前门开到位,无法进行指令下发操作');
  512. }
  513. break;
  514. case 3: // 打开后门
  515. if (selectData.rearGateOpen == '0' && selectData.rearGateClose == '1') {
  516. modalTitle.value = '打开后门';
  517. modalType.value = '3';
  518. modalIsShow.value = true;
  519. } else {
  520. // message.warning('后门已经打开或正在打开,请勿重新操作');
  521. message.warning('没有监测到后门关到位,无法进行指令下发操作');
  522. }
  523. break;
  524. case 4: // 关闭后门
  525. if (selectData.rearGateOpen == '1' && selectData.rearGateClose == '0') {
  526. modalTitle.value = '关闭后门';
  527. modalType.value = '4';
  528. modalIsShow.value = true;
  529. } else {
  530. // message.warning('后门已经关闭或正在关闭,请勿重新操作');
  531. message.warning('没有监测到后门开到位,无法进行指令下发操作');
  532. }
  533. break;
  534. case 8: // 打开中间门
  535. if (selectData.midGateOpen == '0' && selectData.midGateClose == '1') {
  536. modalTitle.value = '打开中间门';
  537. modalType.value = '8';
  538. modalIsShow.value = true;
  539. } else {
  540. // message.warning('后门已经打开或正在打开,请勿重新操作');
  541. message.warning('没有监测到中间门关到位,无法进行指令下发操作');
  542. }
  543. break;
  544. case 9: // 关闭中间门
  545. if (selectData.midGateOpen == '1' && selectData.midGateClose == '0') {
  546. modalTitle.value = '关闭中间门';
  547. modalType.value = '9';
  548. modalIsShow.value = true;
  549. } else {
  550. // message.warning('后门已经关闭或正在关闭,请勿重新操作');
  551. message.warning('没有监测到中间门开到位,无法进行指令下发操作');
  552. }
  553. break;
  554. case 5: // 打开前后门
  555. if (
  556. selectData.frontGateOpen == '0' &&
  557. selectData.frontGateClose == '1' &&
  558. selectData.rearGateOpen == '0' &&
  559. selectData.rearGateClose == '1'
  560. ) {
  561. modalTitle.value = '打开前后门';
  562. modalType.value = '5';
  563. modalIsShow.value = true;
  564. } else {
  565. // message.warning('前后门已经打开或正在打开,请勿重新操作');
  566. message.warning('没有监测到前门、后门关到位,无法进行指令下发操作');
  567. }
  568. break;
  569. case 6: // 关闭前后门
  570. if (
  571. selectData.frontGateOpen == '1' &&
  572. selectData.frontGateClose == '0' &&
  573. selectData.rearGateOpen == '1' &&
  574. selectData.rearGateClose == '0'
  575. ) {
  576. modalTitle.value = '关闭前后门';
  577. modalType.value = '6';
  578. modalIsShow.value = true;
  579. } else {
  580. // message.warning('前后门已经关闭或正在关闭,请勿重新操作');
  581. message.warning('没有监测到前门、后门开到位,无法进行指令下发操作');
  582. }
  583. break;
  584. case 7: // 控制模式切换
  585. modalTitle.value = '控制模式切换';
  586. modalType.value = '7';
  587. modalIsShow.value = true;
  588. break;
  589. case 10: // 风窗控制
  590. modalTitle.value = 'A窗控制';
  591. modalType.value = '10';
  592. modalIsShow.value = true;
  593. break;
  594. case 11: // 风窗控制
  595. modalTitle.value = 'B窗控制';
  596. modalType.value = '11';
  597. modalIsShow.value = true;
  598. break;
  599. }
  600. if (globalConfig?.simulatedPassword) {
  601. handleOK('', handlerState + '');
  602. }
  603. contrlValue = value;
  604. }
  605. // 保德缺打开状态
  606. // function playAnimation(handlerState, data: any = null) {
  607. // const value = data;
  608. // switch (handlerState) {
  609. // case 1: // 打开前门
  610. // modalTitle.value = '打开前门';
  611. // modalType.value = '1';
  612. // modalIsShow.value = true;
  613. // break;
  614. // case 2: // 关闭前门
  615. // modalTitle.value = '关闭前门';
  616. // modalType.value = '2';
  617. // modalIsShow.value = true;
  618. // break;
  619. // case 3: // 打开后门
  620. // modalTitle.value = '打开后门';
  621. // modalType.value = '3';
  622. // modalIsShow.value = true;
  623. // break;
  624. // case 4: // 关闭后门
  625. // modalTitle.value = '关闭后门';
  626. // modalType.value = '4';
  627. // modalIsShow.value = true;
  628. // break;
  629. // case 8: // 打开中间门
  630. // modalTitle.value = '打开中间门';
  631. // modalType.value = '8';
  632. // modalIsShow.value = true;
  633. // break;
  634. // case 9: // 关闭中间门
  635. // modalTitle.value = '关闭中间门';
  636. // modalType.value = '9';
  637. // modalIsShow.value = true;
  638. // break;
  639. // case 5: // 打开前后门
  640. // modalTitle.value = '打开前后门';
  641. // modalType.value = '5';
  642. // modalIsShow.value = true;
  643. // break;
  644. // case 6: // 关闭前后门
  645. // modalTitle.value = '关闭前后门';
  646. // modalType.value = '6';
  647. // modalIsShow.value = true;
  648. // break;
  649. // case 7: // 控制模式切换
  650. // modalTitle.value = '控制模式切换';
  651. // modalType.value = '7';
  652. // modalIsShow.value = true;
  653. // break;
  654. // case 10: // 风窗控制
  655. // modalTitle.value = '风窗控制';
  656. // modalType.value = '10';
  657. // modalIsShow.value = true;
  658. // break;
  659. // }
  660. // if (globalConfig?.simulatedPassword) {
  661. // handleOK('', handlerState + '');
  662. // }
  663. // contrlValue = value;
  664. // }
  665. function handleOK(passWord, handlerState, value?) {
  666. if (!passWord && !globalConfig?.simulatedPassword) {
  667. message.warning('请输入密码');
  668. return;
  669. }
  670. if (isOpenRunning) {
  671. message.warning('风门正在运行。。。');
  672. modalIsShow.value = false;
  673. return;
  674. }
  675. const data = {
  676. deviceid: selectData.deviceID,
  677. devicetype: selectData.deviceType,
  678. paramcode: '',
  679. value: contrlValue,
  680. password: passWord || globalConfig?.simulatedPassword,
  681. masterComputer: selectData.masterComputer,
  682. };
  683. let handler = () => {};
  684. switch (handlerState) {
  685. case '1': // 打开前门
  686. if (selectData.frontGateOpen == '0' && selectData.frontGateClose == '1') {
  687. handler = () => {
  688. frontDoorIsOpen.value = true;
  689. };
  690. data.paramcode = 'frontGateOpen_S';
  691. } else {
  692. message.warning('前门已打开。。。');
  693. modalIsShow.value = false;
  694. }
  695. break;
  696. case '2': // 关闭前门
  697. if (selectData.frontGateOpen == '1' && selectData.frontGateClose == '0') {
  698. handler = () => {
  699. frontDoorIsOpen.value = false;
  700. };
  701. data.paramcode = 'frontGateClose_S';
  702. } else {
  703. message.warning('前门已关闭。。。');
  704. modalIsShow.value = false;
  705. }
  706. break;
  707. case '3': // 打开后门
  708. if (selectData.rearGateOpen == '0' && selectData.rearGateClose == '1') {
  709. handler = () => {
  710. backDoorIsOpen.value = true;
  711. };
  712. data.paramcode = 'rearGateOpen_S';
  713. } else {
  714. message.warning('后门已打开。。。');
  715. modalIsShow.value = false;
  716. }
  717. break;
  718. case '4': // 关闭后门
  719. if (selectData.rearGateOpen == '1' && selectData.rearGateClose == '0') {
  720. handler = () => {
  721. backDoorIsOpen.value = false;
  722. };
  723. data.paramcode = 'rearGateClose_S';
  724. } else {
  725. message.warning('后门已关闭。。。');
  726. modalIsShow.value = false;
  727. }
  728. break;
  729. case '8': // 打开中间门
  730. if (selectData.midGateOpen == '0' && selectData.midGateClose == '1') {
  731. handler = () => {
  732. midDoorIsOpen.value = true;
  733. };
  734. data.paramcode = 'midGateOpen_S';
  735. } else {
  736. message.warning('中间风门已打开。。。');
  737. modalIsShow.value = false;
  738. }
  739. break;
  740. case '9': // 关闭中间门
  741. if (selectData.midGateOpen == '1' && selectData.midGateClose == '0') {
  742. handler = () => {
  743. midDoorIsOpen.value = false;
  744. };
  745. data.paramcode = 'midGateClose_S';
  746. } else {
  747. message.warning('中间风门已关闭。。。');
  748. modalIsShow.value = false;
  749. }
  750. break;
  751. case '5': // 打开前后门
  752. if (
  753. selectData.frontGateOpen == '0' &&
  754. selectData.frontGateClose == '1' &&
  755. selectData.rearGateOpen == '0' &&
  756. selectData.rearGateClose == '1'
  757. ) {
  758. handler = () => {
  759. frontDoorIsOpen.value = true;
  760. backDoorIsOpen.value = true;
  761. };
  762. data.paramcode = 'sameTimeOpen';
  763. }
  764. break;
  765. case '6': // 关闭前后门
  766. if (
  767. selectData.frontGateOpen == '1' &&
  768. selectData.frontGateClose == '0' &&
  769. selectData.rearGateOpen == '1' &&
  770. selectData.rearGateClose == '0'
  771. ) {
  772. handler = () => {
  773. frontDoorIsOpen.value = false;
  774. backDoorIsOpen.value = false;
  775. };
  776. data.paramcode = 'sameTimeClose';
  777. }
  778. break;
  779. case '7': // 远程与就地
  780. if (selectData.contrlMod == 'codeCtrl') {
  781. if (contrlValue == '1') {
  782. data.paramcode = 'autoRoManualControl1';
  783. } else if (contrlValue == '0') {
  784. data.paramcode = 'autoRoManualControl2';
  785. } else {
  786. data.paramcode = 'autoRoManualControl0';
  787. }
  788. data.value = '';
  789. selectData.autoRoManual = null;
  790. } else if (selectData.contrlMod == 'loopCtrl' || selectData.contrlMod == 'jnjhCtrl') {
  791. data.paramcode = 'autoRoManualControl';
  792. data.value = '';
  793. selectData.autoRoManual = null;
  794. } else {
  795. data.paramcode = 'autoRoManualControl';
  796. data.value = contrlValue;
  797. selectData.autoRoManual = null;
  798. }
  799. break;
  800. case '10': // 前(A)窗控制
  801. data.paramcode = 'frontSetValue';
  802. data.value = value;
  803. break;
  804. case '11': // 后(B)窗控制
  805. data.paramcode = 'rearSetValue';
  806. data.value = value;
  807. break;
  808. }
  809. if (data.paramcode) {
  810. deviceControlApi(data).then((res) => {
  811. // 模拟时开启
  812. if (res.success) {
  813. modalIsShow.value = false;
  814. if (globalConfig.History_Type == 'remote') {
  815. message.success('指令已下发至生产管控平台成功!');
  816. } else {
  817. message.success('指令已下发成功!');
  818. }
  819. } else {
  820. message.error(res.message);
  821. }
  822. });
  823. }
  824. }
  825. let isOpenRunning = false; //开关门动作是否在进行
  826. /** 开关门动画调用 */
  827. let isFrontOpenRunning = false; //开关门动作是否在进行
  828. // let isFrontCloseRunning = false; //开关门动作是否在进行
  829. let isRearOpenRunning = false; //开关门动作是否在进行
  830. // let isRearCloseRunning = false; //开关门动作是否在进行
  831. let isMidOpenRunning = false; //中间门动作是否在进行
  832. // let isMidCloseRunning = false; //中间门动作是否在进行
  833. // 0 关闭 1 正在打开 2 打开 3正在关闭
  834. let frontDeviceState = 0; //记录设备状态,为了与下一次监测数据做比较
  835. let rearDeviceState = 0; //记录设备状态,为了与下一次监测数据做比较
  836. let midDeviceState = 0; //记录设备状态,为了与下一次监测数据做比较
  837. function monitorAnimation(selectData) {
  838. const timeScale = 0.005;
  839. // 带风窗 风窗动画
  840. playWindowAnimation(selectData);
  841. if (selectData.frontGateOpen == '1' && selectData.frontGateClose == '0' && !isFrontOpenRunning) {
  842. isFrontOpenRunning = true;
  843. if (frontDeviceState != 1) {
  844. // import.meta.env.VITE_GLOB_IS_SIMULATE ? play(1, timeScale) : play(1);
  845. play(1, timeScale);
  846. frontDeviceState = 1;
  847. frontDoorIsOpen.value = false;
  848. backDoorIsOpen.value = true;
  849. }
  850. }
  851. if (selectData.frontGateOpen == '0' && selectData.frontGateClose == '0' && !isFrontOpenRunning) {
  852. isFrontOpenRunning = true;
  853. if (frontDeviceState != 1) {
  854. // import.meta.env.VITE_GLOB_IS_SIMULATE ? play(1, timeScale) : play(1);
  855. play(1, timeScale);
  856. frontDeviceState = 1;
  857. frontDoorIsOpen.value = false;
  858. backDoorIsOpen.value = true;
  859. }
  860. }
  861. if (selectData.frontGateClose == '1' && selectData.frontGateOpen == '0' && isFrontOpenRunning) {
  862. isFrontOpenRunning = false;
  863. if (frontDeviceState != 0) {
  864. // import.meta.env.VITE_GLOB_IS_SIMULATE ? play(2, timeScale) : play(2);
  865. play(2, timeScale);
  866. frontDeviceState = 0;
  867. frontDoorIsOpen.value = false;
  868. // backDoorIsOpen.value = false
  869. }
  870. }
  871. if (selectData.rearGateOpen == '1' && selectData.rearGateClose == '0' && !isRearOpenRunning) {
  872. isRearOpenRunning = true;
  873. if (rearDeviceState != 1) {
  874. rearDeviceState = 1;
  875. // import.meta.env.VITE_GLOB_IS_SIMULATE ? play(3, timeScale) : play(3);
  876. play(3, timeScale);
  877. backDoorIsOpen.value = false;
  878. frontDoorIsOpen.value = true;
  879. }
  880. }
  881. if (selectData.rearGateOpen == '0' && selectData.rearGateClose == '0' && !isRearOpenRunning) {
  882. isRearOpenRunning = true;
  883. if (rearDeviceState != 1) {
  884. rearDeviceState = 1;
  885. // import.meta.env.VITE_GLOB_IS_SIMULATE ? play(3, timeScale) : play(3);
  886. play(3, timeScale);
  887. backDoorIsOpen.value = false;
  888. frontDoorIsOpen.value = true;
  889. }
  890. }
  891. if (selectData.rearGateClose == '1' && selectData.rearGateOpen == '0' && isRearOpenRunning) {
  892. isRearOpenRunning = false;
  893. if (rearDeviceState != 0) {
  894. rearDeviceState = 0;
  895. // import.meta.env.VITE_GLOB_IS_SIMULATE ? play(4, timeScale) : play(4);
  896. play(4, timeScale);
  897. backDoorIsOpen.value = false;
  898. }
  899. }
  900. if (selectData.midGateOpen == '1' && selectData.midGateClose == '0' && !isMidOpenRunning) {
  901. isMidOpenRunning = true;
  902. if (midDeviceState != 1) {
  903. midDeviceState = 1;
  904. // import.meta.env.VITE_GLOB_IS_SIMULATE ? play(3, timeScale) : play(3);
  905. play(8, timeScale);
  906. backDoorIsOpen.value = false;
  907. frontDoorIsOpen.value = true;
  908. }
  909. }
  910. if (selectData.midGateOpen == '0' && selectData.midGateClose == '0' && !isMidOpenRunning) {
  911. isMidOpenRunning = true;
  912. if (midDeviceState != 1) {
  913. midDeviceState = 1;
  914. // import.meta.env.VITE_GLOB_IS_SIMULATE ? play(3, timeScale) : play(3);
  915. play(8, timeScale);
  916. backDoorIsOpen.value = false;
  917. frontDoorIsOpen.value = true;
  918. }
  919. }
  920. if (selectData.midGateClose == '1' && selectData.midGateOpen == '0' && isMidOpenRunning) {
  921. isMidOpenRunning = false;
  922. if (midDeviceState != 0) {
  923. midDeviceState = 0;
  924. // import.meta.env.VITE_GLOB_IS_SIMULATE ? play(4, timeScale) : play(4);
  925. play(9, timeScale);
  926. backDoorIsOpen.value = false;
  927. }
  928. }
  929. }
  930. function playWindowAnimation(data, maxarea = 90, isFirst = false) {
  931. computePlay(data, maxarea, isFirst);
  932. }
  933. function handleCancel() {
  934. modalIsShow.value = false;
  935. modalTitle.value = '';
  936. modalType.value = '';
  937. }
  938. // // 远程、就地切换
  939. // function changeType() {
  940. // const data = {
  941. // deviceid: selectData.deviceID,
  942. // devicetype: selectData.deviceType,
  943. // paramcode: 'autoRoManualControl',
  944. // value: selectData.autoRoManual,
  945. // };
  946. // deviceControlApi(data).then(() => {
  947. // if (globalConfig.History_Type == 'remote') {
  948. // message.success('指令已下发至生产管控平台成功!');
  949. // } else {
  950. // message.success('指令已下发成功!');
  951. // }
  952. // });
  953. // }
  954. onMounted(async () => {
  955. const { query } = unref(currentRoute);
  956. if (query['deviceType']) deviceType.value = query['deviceType'] as string;
  957. modelList.value = await getDictItems('gateModel');
  958. loading.value = true;
  959. const playerDom = document.getElementById('fm-player1')?.getElementsByClassName('vjs-tech')[0];
  960. mountedThree(playerDom).then(async () => {
  961. await getMonitor(true);
  962. loading.value = false;
  963. });
  964. });
  965. onBeforeUnmount(() => {
  966. getDeviceBaseList();
  967. });
  968. onUnmounted(() => {
  969. removeCamera();
  970. if (timer) {
  971. clearTimeout(timer);
  972. timer = undefined;
  973. }
  974. destroy();
  975. });
  976. </script>
  977. ,
  978. <style lang="less" scoped>
  979. @import '/@/design/theme.less';
  980. @import '/@/design/vent/modal.less';
  981. .scene-box {
  982. .bottom-tabs-box {
  983. height: 350px;
  984. }
  985. }
  986. .button-box {
  987. border: none !important;
  988. height: 34px !important;
  989. &:hover {
  990. background: var(--vent-device-manager-control-btn-hover) !important;
  991. }
  992. &::before {
  993. height: 27px !important;
  994. background: var(--vent-device-manager-control-btn) !important;
  995. }
  996. &::after {
  997. top: 35px !important;
  998. }
  999. }
  1000. :deep(.@{ventSpace}-tabs-tabpane-active) {
  1001. height: 100%;
  1002. }
  1003. ::-webkit-scrollbar-thumb {
  1004. -webkit-box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
  1005. background: #4288a444;
  1006. }
  1007. :deep(.zxm-radio-disabled + span) {
  1008. color: var(--vent-font-color) !important;
  1009. }
  1010. :deep(.zxm-radio-disabled .zxm-radio-inner::after) {
  1011. background-color: #127cb5 !important;
  1012. }
  1013. </style>