index.vue 49 KB

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