index.vue 41 KB

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