index.vue 42 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142
  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. </a-spin>
  5. <div id="fanLocal3D" style="width: 100%; height: 100%; position: absolute; overflow: hidden"> </div>
  6. <div v-if="globalConfig?.simulatedPassword" id="fanLocal3DCSS" class="threejs-Object-CSS" style="width: 100%; height: 100%; position: absolute; overflow: hidden; pointer-events: none;">
  7. <div style="z-index: -1; position: relative">
  8. <div class="elementTag" id="inputBox">
  9. <div class="elementContent">
  10. <p>风筒入口风速:{{ selectData.windSpeed1 ? selectData.windSpeed1 : '-' }}</p>
  11. <p>风筒入口瓦斯浓度 {{ selectData.gas2 ? selectData.gas2 : '-' }}</p>
  12. </div>
  13. </div>
  14. <div class="elementTag" id="outBox">
  15. <div class="elementContent elementContent-r">
  16. <p>迎头供风量:{{ selectData.windQuantity1 ? selectData.windQuantity2 : '-' }}</p>
  17. <p>迎头瓦斯浓度:{{ selectData.gas1 ? selectData.gas1 : '-' }}</p>
  18. </div>
  19. </div>
  20. <div class="elementTag" id="returnBox">
  21. <div class="elementContent">
  22. <p>回风流瓦斯浓度:{{ selectData.gas3 ? selectData.gas3 : '-' }}</p>
  23. </div>
  24. </div>
  25. <!-- <div class="elementTag" id="gateBox">
  26. <div class="elementContent">
  27. <p>风门状态:关</p>
  28. <p>风门过风面积:{{ selectData.gas1 ? selectData.gas1 : '-' }}</p>
  29. </div>
  30. </div>
  31. <div class="elementTag" id="windownBox">
  32. <div class="elementContent">
  33. <p>风窗全风压回风流:0</p>
  34. </div>
  35. </div> -->
  36. </div>
  37. </div>
  38. </div>
  39. <div class="scene-box">
  40. <div class="top-box" v-if="!loading">
  41. <div class="top-center row">
  42. <div class="vent-flex-row" id="fanLocalSelectDom" v-if="getDictItemsByCode('fanlocaltype') && !globalConfig?.simulatedPassword">
  43. <span style="color: #00f5fe; margin-left: 5px;">风机类型:</span>
  44. <JDictSelectTag v-model:value="devicekide" dictCode="fanlocaltype" :showChooseOption="false" :getPopupContainer="getPopupContainer" @change="changeDeviceKind" />
  45. </div>
  46. <!-- fanlocal_systeml_zj 模拟局部风机,不显示操作按钮 -->
  47. <div v-if="selectData.deviceType != 'fanlocal_systeml_zj'" class="button-box" v-for="(item, index) in modalTypeArr.leftBtnArr" :key="index" @click="showModal(item)">{{ item.value }}</div>
  48. </div>
  49. <div class="top-right row">
  50. <div class="button-box" v-for="(item, index) in modalTypeArr.rightBtnArr" :key="index" @click="showModal(item)">{{ item.value }}</div>
  51. </div>
  52. </div>
  53. <div class="title-text">
  54. {{ selectData.supplyAirAddr||selectData.stationname }}
  55. </div>
  56. <div class="data-show-box" v-if="!loading">
  57. <div class="data-item">
  58. <div class="item-header">环境监测</div>
  59. <div class="item-container">
  60. <div class="tab">
  61. <div class="tab-item" :class="{ 'tab-item-active-r': warningMonitorRowIndex === 0 }" @click="selectDevice('warningMonitorRowIndex', 0)"
  62. >主机</div
  63. >
  64. <div class="tab-item" :class="{ 'tab-item-active-r': warningMonitorRowIndex === 1 }" @click="selectDevice('warningMonitorRowIndex', 1)"
  65. >备机</div
  66. >
  67. </div>
  68. <div class="container-group">
  69. <div class="warning-header">
  70. <div class="header-item">
  71. <div class="header-title">报警总数</div>
  72. <div class="header-value">0</div>
  73. </div>
  74. <div class="header-item">
  75. <div class="header-title"> 未处理数</div>
  76. <div class="header-value">0</div>
  77. </div>
  78. </div>
  79. <div class="warning-group">
  80. <template v-if="selectData.deviceType">
  81. <!-- <div class="warning-item" v-for="(state, index) in leftColumns" :key="index">
  82. <div class="item-name"><div class="icon"></div> {{ state.title }}</div>
  83. <div v-if="state.dataIndex.startsWith('Fan')">
  84. <div class="signal-item" v-if="warningMonitorRowIndex == 0">
  85. <div
  86. class="signal-round"
  87. :class="{
  88. 'signal-round-run': selectData[state.dataIndex.replace('Fan', 'Fan1')],
  89. 'signal-round-warning':
  90. selectData[state.dataIndex.replace('Fan', 'Fan1')] !== undefined && !selectData[state.dataIndex.replace('Fan', 'Fan1')],
  91. 'signal-round-gry': selectData[state.dataIndex.replace('Fan', 'Fan1')] === undefined,
  92. }"
  93. ></div>
  94. <div class="vent-margin-l-8">{{
  95. selectData[state.dataIndex.replace('Fan', 'Fan1')] === undefined
  96. ? '无状态'
  97. : selectData[state.dataIndex.replace('Fan', 'Fan1')]
  98. ? '正常'
  99. : '异常'
  100. }}</div>
  101. </div>
  102. <div class="signal-item" v-if="warningMonitorRowIndex == 1">
  103. <div
  104. class="signal-round"
  105. :class="{
  106. 'signal-round-run': selectData[state.dataIndex.replace('Fan', 'Fan2')],
  107. 'signal-round-warning':
  108. selectData[state.dataIndex.replace('Fan', 'Fan2')] !== undefined && !selectData[state.dataIndex.replace('Fan', 'Fan2')],
  109. 'signal-round-gry': selectData[state.dataIndex.replace('Fan', 'Fan2')] === undefined,
  110. }"
  111. ></div>
  112. <div class="vent-margin-l-8">{{
  113. selectData[state.dataIndex.replace('Fan', 'Fan2')] === undefined
  114. ? '无状态'
  115. : selectData[state.dataIndex.replace('Fan', 'Fan2')]
  116. ? '正常'
  117. : '异常'
  118. }}</div>
  119. </div>
  120. </div>
  121. <div v-else>
  122. <div class="signal-item">
  123. <div
  124. class="signal-round vent-margin-l-8"
  125. :class="{
  126. 'signal-round-run': selectData[state.dataIndex],
  127. 'signal-round-warning': selectData[state.dataIndex] !== undefined && !selectData[state.dataIndex],
  128. 'signal-round-gry': selectData[state.dataIndex] === undefined,
  129. }"
  130. ></div>
  131. <div class="vent-margin-l-8">{{ selectData[state.dataIndex] === undefined ? '无状态' : selectData[state.dataIndex] ? '正常' : '异常' }}</div>
  132. </div>
  133. </div>
  134. </div> -->
  135. <div class="container-item" v-for="(data, index) in leftColumns" :key="index">
  136. <div class="item-icon">
  137. <!-- <SvgIcon class="icon-style" size="18" name="temperature" /> -->
  138. <CaretRightOutlined class="icon-style" />
  139. </div>
  140. <div class="item-name">{{ data.title }}</div>
  141. <div v-if="data.dataIndex.startsWith('Fan')">
  142. <div class="item-value" v-if="dataMonitorRowIndex == 0">{{
  143. selectData[data.dataIndex.replace('Fan', 'Fan1')] ? selectData[data.dataIndex.replace('Fan', 'Fan1')] : '-'
  144. }}</div>
  145. <div class="item-value" v-if="dataMonitorRowIndex == 1">{{
  146. selectData[data.dataIndex.replace('Fan', 'Fan2')] ? selectData[data.dataIndex.replace('Fan', 'Fan2')] : '-'
  147. }}</div>
  148. </div>
  149. <div v-else>
  150. <div class="item-value">{{ selectData[data.dataIndex] ? selectData[data.dataIndex] : '-' }}</div>
  151. </div>
  152. </div>
  153. </template>
  154. </div>
  155. </div>
  156. </div>
  157. </div>
  158. <div class="data-item">
  159. <div class="item-header">设备监测</div>
  160. <div class="item-container">
  161. <div class="tab">
  162. <div class="tab-item" :class="{ 'tab-item-active-r': dataMonitorRowIndex == 0 }" @click="selectDevice('dataMonitorRowIndex', 0)"
  163. >主机</div
  164. >
  165. <div class="tab-item" :class="{ 'tab-item-active-r': dataMonitorRowIndex == 1 }" @click="selectDevice('dataMonitorRowIndex', 1)"
  166. >备机</div
  167. >
  168. </div>
  169. <div class="container-group container-group-l" >
  170. <template v-if="!loading">
  171. <div class="container-item" v-for="(data, index) in rightColumns" :key="index">
  172. <div class="item-icon">
  173. <!-- <SvgIcon class="icon-style" size="18" name="temperature" /> -->
  174. <!-- <StarOutlined /> -->
  175. <CaretRightOutlined class="icon-style" />
  176. </div>
  177. <div class="item-name">{{ data.title }}</div>
  178. <div v-if="data.dataIndex.startsWith('Fan')">
  179. <div class="item-value" v-if="dataMonitorRowIndex == 0">{{
  180. selectData[data.dataIndex.replace('Fan', 'Fan1')] ? selectData[data.dataIndex.replace('Fan', 'Fan1')] : '-'
  181. }}</div>
  182. <div class="item-value" v-if="dataMonitorRowIndex == 1">{{
  183. selectData[data.dataIndex.replace('Fan', 'Fan2')] ? selectData[data.dataIndex.replace('Fan', 'Fan2')] : '-'
  184. }}</div>
  185. </div>
  186. <div v-else>
  187. <div class="item-value">{{ selectData[data.dataIndex] ? selectData[data.dataIndex] : '-' }}</div>
  188. </div>
  189. </div>
  190. </template>
  191. </div>
  192. </div>
  193. </div>
  194. </div>
  195. <div class="bottom-tabs-box" @mousedown="setDivHeight($event, 170, scroll, 180)">
  196. <dv-border-box8 :dur="5" class="dv_border_8" :style="`bottom: 20px; padding: 5px; height: ${scroll.y + 140}px`" >
  197. <!-- <div class="enter-detail" @click="goDetail()">
  198. <send-outlined class=""/>风机运行详情
  199. </div> -->
  200. <a-tabs class="tabs-box" v-model:activeKey="activeKey" @change="tabChange">
  201. <a-tab-pane key="1" tab="实时监测">
  202. <GroupMonitorTable v-if="activeKey === '1'" ref="MonitorDataTable" :dataSource="dataSource" :columnsType="`${selectData.deviceType}_monitor`" @selectRow="getSelectRow" :scroll="scroll" :is-action="true">
  203. <template #action="{ record }">
  204. <a class="table-action-link" @click="deviceEdit($event, 'reportInfo', record)">报表录入</a>
  205. <a class="table-action-link" @click="deviceEdit($event, 'deviceInfo', record)">设备编辑</a>
  206. </template>
  207. </GroupMonitorTable>
  208. </a-tab-pane>
  209. <a-tab-pane key="2" tab="实时曲线图" force-render>
  210. <div class="tab-item" v-if="activeKey === '2'">
  211. <div class="vent-flex-row-between" style="height: 100%">
  212. <BarSingle
  213. :xAxisData="xAxisDataGas"
  214. :dataSource="dataSource[selectRowIndex]"
  215. height="100%"
  216. :chartsColumns="chartsColumns"
  217. style="flex: 3"
  218. />
  219. <BarSingle
  220. v-if="globalConfig?.simulatedPassword"
  221. :xAxisData="[
  222. { key: 'F1', valueKey: 'windQuantity1' },
  223. { key: 'F2', valueKey: 'windQuantity2' },
  224. ]"
  225. :dataSource="dataSource[selectRowIndex]"
  226. height="100%"
  227. :chartsColumns="chartsColumns1"
  228. style="flex: 2"
  229. />
  230. </div>
  231. </div>
  232. </a-tab-pane>
  233. <a-tab-pane key="3" tab="历史数据">
  234. <div class="tab-item" v-if="activeKey === '3'">
  235. <HistoryTable :columns-type="`${selectData.deviceType}`" :device-type="`${devicekide}`" :device-list-api="baseList" designScope="fanlocal-history" :scroll="scroll" />
  236. </div>
  237. </a-tab-pane>
  238. <a-tab-pane key="4" tab="报警历史">
  239. <div class="tab-item" v-if="activeKey === '4'">
  240. <AlarmHistoryTable columns-type="alarm" :device-type="`${devicekide}`" :device-list-api="baseList" designScope="alarm-history" :scroll="scroll" />
  241. </div>
  242. </a-tab-pane>
  243. <a-tab-pane key="5" tab="操作历史">
  244. <div class="tab-item" v-if="activeKey === '5'">
  245. <HandlerHistoryTable columns-type="operator_history" :device-type="`${devicekide}`" :device-list-api="baseList" designScope="alarm-history" :scroll="scroll" />
  246. </div>
  247. </a-tab-pane>
  248. </a-tabs>
  249. </dv-border-box8>
  250. </div>
  251. </div>
  252. <!-- <div style="z-index: -1; position: absolute; top: 50px; right: 10px; width: 300px; height: 280px; margin: auto" class="player1">
  253. <LivePlayer id="jb-player1" ref="player1" :videoUrl="flvURL1()" muted live loading controls />
  254. </div> -->
  255. <div ref="playerRef" style="z-index: 999; position: absolute; top: 100px; right: 15px; width: 100%; height: 100%; margin: auto; pointer-events: none;">
  256. </div>
  257. <a-modal v-model:visible="modalIsShow" :title="modalTitle" @ok="handleOk">
  258. <div class="modal-container">
  259. <div class="vent-flex-row">
  260. <ExclamationCircleFilled style="color: #ffb700; font-size: 30px" />
  261. <div class="warning-text">您是否要进行{{ modalTitle }}操作?</div>
  262. </div>
  263. <div class="" v-if="modalType == 'startSmoke'">
  264. <div class="startSmoke-select">
  265. <div class="label">主机:</div>
  266. <a-radio-group v-model:value="mainWindIsShow1" @change="changeMotor" name="localWind1">
  267. <a-radio value="open">开启</a-radio>
  268. <a-radio value="stop">停止</a-radio>
  269. </a-radio-group>
  270. </div>
  271. <div class="startSmoke-select">
  272. <div class="label">备机:</div>
  273. <a-radio-group v-model:value="mainWindIsShow2" @change="changeMotor" name="localWind2">
  274. <a-radio value="open">开启</a-radio>
  275. <a-radio value="stop">停止</a-radio>
  276. </a-radio-group>
  277. </div>
  278. </div>
  279. <!-- 调频 -->
  280. <!-- <div class="vent-flex-row input-box" v-if="modalType == 'Fan1Frequency'">
  281. <div class="label">主风机运行频率(Hz):</div>
  282. <a-input-number size="small" v-model:value="fan1FrequencyVal" :min="30" :max="50" :step="0.1" />
  283. </div>
  284. <div class="vent-flex-row input-box" v-if="modalType == 'Fan2Frequency'">
  285. <div class="label">备风机运行频率(Hz):</div>
  286. <a-input-number size="small" v-model:value="fan2FrequencyVal" :min="30" :max="50" :step="0.1" />
  287. </div> -->
  288. <!-- <div class="vent-flex-row input-box" v-if="modalType == 'needAir'">
  289. <div class="label">需风量(单位):</div>
  290. <a-input-number size="small" v-model:value="frequencyVal" :min="30" :max="50" :step="0.1" />
  291. </div>
  292. <div class="vent-flex-row input-box" v-if="modalType == 'disAirAlarm'">
  293. <div class="label">漏风率(%):</div>
  294. <a-input-number size="small" v-model:value="frequencyVal" :min="0" :max="50" :step="0.1" />
  295. </div>
  296. <div class="vent-flex-row input-box" v-if="modalType == 'diameter'">
  297. <div class="label">风筒直径(m):</div>
  298. <a-input-number size="small" v-model:value="frequencyVal" :min="0" :max="50" :step="0.1" />
  299. </div>
  300. <div class="vent-flex-row input-box" v-if="modalType == 'len'">
  301. <div class="label">风筒长度(m):</div>
  302. <a-input-number size="small" v-model:value="frequencyVal" :min="0" :max="50" :step="0.1" />
  303. </div>
  304. <div class="vent-flex-row input-box" v-if="modalType == 'windPowerLimit'">
  305. <div class="label">风电闭锁限值(m³/min):</div>
  306. <a-input-number size="small" v-model:value="frequencyVal" :min="0" :max="50" :step="0.1" />
  307. </div>
  308. <div class="vent-flex-row input-box" v-if="modalType == 'gasPowerLimit'">
  309. <div class="label">瓦斯电闭锁限值(m³/min):</div>
  310. <a-input-number size="small" v-model:value="frequencyVal" :min="0" :max="50" :step="0.1" />
  311. </div>
  312. <div v-if="modalType == 'gasAlarm'">
  313. <div class="vent-flex-row input-box">
  314. <div class="label">传感器名称:</div>
  315. <a-select placeholder="传感器" @change="handleChangeSensor" :options="sensorList" v-model:value="modalSensor" />
  316. </div>
  317. <div class="vent-flex-row input-box">
  318. <div class="label">传感器值:</div>
  319. <a-input-number size="small" v-model:value="frequencyVal" :min="0" :max="50" :step="0.1" />
  320. </div>
  321. </div>
  322. <div v-if="modalType == 'airVolumeAlarm'">
  323. <div class="vent-flex-row input-box">
  324. <div class="label">风量上限(m³/min):</div>
  325. <a-input-number size="small" v-model:value="modalTypeArr.rightBtnArr[3].min" :min="0" :max="50" :step="0.1" />
  326. </div>
  327. <div class="vent-flex-row input-box">
  328. <div class="label">风量下限(m³/min):</div>
  329. <a-input-number size="small" v-model:value="modalTypeArr.rightBtnArr[3].max" :min="0" :max="50" :step="0.1" />
  330. </div>
  331. </div> -->
  332. <!-- 启动或停止 -->
  333. <div class="" v-if="modalType == 'startSmoke'"> </div>
  334. <div v-if="!globalConfig?.simulatedPassword" class="vent-flex-row input-box">
  335. <div class="label">操作密码:</div>
  336. <a-input size="small" type="password" v-model:value="passWord" />
  337. </div>
  338. </div>
  339. </a-modal>
  340. <DeviceBaseInfo @register="registerModal" :device-type="selectData['deviceType']"/>
  341. </template>
  342. <script setup lang="ts">
  343. import { ExclamationCircleFilled } from '@ant-design/icons-vue';
  344. import { onBeforeMount, ref, watch, onMounted, nextTick, toRaw, reactive, onUnmounted, inject, unref } from 'vue';
  345. import BarSingle from '../../../../components/chart/BarSingle.vue';
  346. import GroupMonitorTable from '../comment/GroupMonitorTable.vue';
  347. import HistoryTable from '../comment/HistoryTable.vue';
  348. import AlarmHistoryTable from '../comment/AlarmHistoryTable.vue';
  349. import HandlerHistoryTable from '../comment/HandlerHistoryTable.vue';
  350. import DeviceBaseInfo from '../comment/components/DeviceBaseInfo.vue';
  351. import { mountedThree, setModelType, destroy, addCssText, addText, playSmoke } from './fanLocal.three';
  352. import lodash from 'lodash';
  353. import { getTableList, list } from '/@/views/vent/monitorManager/fanLocalMonitor/fanLocal.api';
  354. import { list as baseList } from '../../deviceManager/fanTabel/fan.api';
  355. import { chartsColumns, chartsColumns1 } from './fanLocal.data';
  356. import { deviceControlApi } from '/@/api/vent/index';
  357. import LivePlayer from '@liveqing/liveplayer-v3';
  358. import { setDivHeight } from '/@/utils/event';
  359. import { BorderBox8 as DvBorderBox8 } from '@kjgl77/datav-vue3';
  360. import { getTableHeaderColumns } from '/@/hooks/web/useWebColumns';
  361. import { SvgIcon } from '/@/components/Icon';
  362. import { useRouter } from 'vue-router';
  363. import { useModal } from '/@/components/Modal';
  364. import type { BasicColumn } from '/@/components/Table/src/types/table';
  365. import JDictSelectTag from '/@/components/Form/src/jeecg/components/JDictSelectTag.vue';
  366. import { getPopupContainer } from '/@/utils';
  367. import { getDictItemsByCode } from '/@/utils/dict';
  368. import { message } from 'ant-design-vue';
  369. import { useCamera } from '/@/hooks/system/useCamera';
  370. import { CaretRightOutlined } from '@ant-design/icons-vue';
  371. const globalConfig = inject('globalConfig');
  372. const [registerModal, { openModal, closeModal }] = useModal();
  373. const { currentRoute } = useRouter();
  374. const modalTypeArr = reactive(
  375. VENT_PARAM['simulatedPassword'] ?
  376. {
  377. leftBtnArr: [
  378. {
  379. key: 'startSmoke',
  380. value: '启动风机',
  381. },
  382. {
  383. key: 'changeSmoke',
  384. value: '一键倒机',
  385. },
  386. // {
  387. // key: 'Fan1Frequency',
  388. // value: '主机调频',
  389. // },
  390. // {
  391. // key: 'Fan2Frequency',
  392. // value: '备机调频',
  393. // },
  394. {
  395. key: 'windPower',
  396. value: '风电闭锁',
  397. },
  398. {
  399. key: 'gasPower',
  400. value: '瓦斯电闭锁',
  401. },
  402. {
  403. key: 'needAir',
  404. value: '需风量',
  405. },
  406. {
  407. key: 'diameter',
  408. value: '风筒直径',
  409. },
  410. {
  411. key: 'len',
  412. value: '风筒长度',
  413. },
  414. ],
  415. rightBtnArr: [
  416. // {
  417. // key: 'fanlocal',
  418. // value: '变频风机',
  419. // },
  420. // {
  421. // key: 'fanlocaldp',
  422. // value: '定频风机',
  423. // },
  424. {
  425. key: 'frequency',
  426. value: '调频',
  427. },
  428. {
  429. key: 'windPowerLimit',
  430. value: '风电闭锁限值',
  431. },
  432. {
  433. key: 'gasPowerLimit',
  434. value: '瓦斯电闭锁限值',
  435. },
  436. {
  437. key: 'airVolumeAlarm',
  438. value: '风量报警',
  439. min: 0,
  440. max: 100,
  441. },
  442. {
  443. key: 'disAirAlarm',
  444. value: '漏风率报警',
  445. },
  446. {
  447. key: 'gasAlarm',
  448. value: '瓦斯报警',
  449. },
  450. ],
  451. }: {
  452. leftBtnArr: [
  453. {
  454. key: 'startSmoke',
  455. value: '启动风机',
  456. },
  457. {
  458. key: 'changeSmoke',
  459. value: '一键倒机',
  460. },
  461. ],
  462. rightBtnArr: [
  463. ],
  464. });
  465. const sensorList = ref<any[]>([
  466. {
  467. value: '1',
  468. label: 'T1',
  469. },
  470. {
  471. value: '2',
  472. label: 'T2',
  473. },
  474. {
  475. value: '3',
  476. label: 'T3',
  477. },
  478. ]);
  479. const scroll = reactive({
  480. y: 180
  481. })
  482. const playerRef = ref()
  483. const MonitorDataTable = ref()
  484. const modalSensor = ref(null);
  485. const loading = ref(false);
  486. const activeKey = ref('1');
  487. const player1 = ref();
  488. const modalIsShow = ref<boolean>(false); // 是否显示模态框
  489. const modalTitle = ref(''); // 模态框标题显示内容,根据设备操作类型决定
  490. const fan1FrequencyVal = ref(40); //主机频率
  491. const fan2FrequencyVal = ref(40); //备机频率
  492. const mainWindIsShow1 = ref('open'); // 主机默认启动leftColumns
  493. const mainWindIsShow2 = ref('stop'); // 备机默认不启动
  494. const passWord = ref('');
  495. // 默认初始是第一行
  496. const selectRowIndex = ref(-1);
  497. const dataMonitorRowIndex = ref(0);
  498. // 默认数据右边监测的是主机
  499. const warningMonitorRowIndex = ref(0);
  500. const xAxisDataGas = ref([])
  501. // 设备数据
  502. const controlType = ref(1);
  503. const modalType = ref('fm');
  504. // 监测数据
  505. const initData = {
  506. deviceID: '',
  507. deviceType: '',
  508. strname: '',
  509. dataDh: '-', //压差
  510. dataDtestq: '-', //测试风量
  511. sourcePressure: '-', //气源压力
  512. dataDequivalarea: '-',
  513. netStatus: '0', //通信状态
  514. warnLevel_str: '',
  515. stationname: ''
  516. };
  517. const dataSource = ref([]);
  518. // 监测数据
  519. let selectData = reactive(lodash.cloneDeep(initData));
  520. const rightColumns = ref<BasicColumn[]>([])
  521. const leftColumns = ref<BasicColumn[]>([])
  522. const devicekide = ref('fanlocal')
  523. const deviceType = ref(selectData.deviceType)
  524. const headElHeight = ref(0)
  525. const {getCamera, webRtcServer} = useCamera()
  526. watch(deviceType , (type) => {
  527. rightColumns.value = getTableHeaderColumns(type + '_monitor_right') as []
  528. if(rightColumns.value && rightColumns.value.length < 1){
  529. rightColumns.value = getTableHeaderColumns(type.split('_')[0] + '_monitor_right') as []
  530. }
  531. leftColumns.value = getTableHeaderColumns(type + '_monitor_left') as []
  532. if (leftColumns.value && leftColumns.value.length < 1) {
  533. leftColumns.value = getTableHeaderColumns(type.split('_')[0] + '_monitor_left') as []
  534. }
  535. })
  536. const flvURL1 = () => {
  537. // return `https://sf1-hscdn-tos.pstatp.com/obj/media-fe/xgplayer_doc_video/flv/xgplayer-demo-360p.flv`;
  538. return ''
  539. };
  540. const changeDeviceKind = (e) => {
  541. devicekide.value = e
  542. loading.value = true
  543. selectRowIndex.value = -1
  544. nextTick( () => {
  545. // selectRowIndex.value = 0
  546. selectData = lodash.cloneDeep(initData)
  547. loading.value = false
  548. if(selectData.deviceID)MonitorDataTable.value.setSelectedRowKeys([selectData.deviceID])
  549. const headEl = document.querySelector(`.zxm-table-thead`);
  550. if (headEl) {
  551. headElHeight.value = headEl.clientHeight
  552. }
  553. })
  554. }
  555. const tabChange = (activeKeyVal) => {
  556. activeKey.value = activeKeyVal;
  557. if (activeKeyVal == 1) {
  558. nextTick(() => {
  559. MonitorDataTable.value.setSelectedRowKeys([selectData.deviceID])
  560. })
  561. }
  562. };
  563. const selectDevice = (key, val) => {
  564. if (key === 'dataMonitorRowIndex') {
  565. dataMonitorRowIndex.value = val;
  566. } else {
  567. warningMonitorRowIndex.value = val;
  568. }
  569. };
  570. //详情
  571. function goDetail() {
  572. openModal()
  573. }
  574. //
  575. async function getDataSource(){
  576. if(devicekide.value){
  577. const res = await list({ devicetype: devicekide.value, pagetype: 'normal' });
  578. if (res.msgTxt && res.msgTxt[0] && res.msgTxt[0].datalist && res.msgTxt[0].datalist.length > 0) {
  579. const dataArr = res.msgTxt[0].datalist || [];
  580. dataSource.value = [];
  581. dataArr.forEach((data) => {
  582. const readData = data.readData;
  583. data = Object.assign(data, readData);
  584. dataSource.value.push(data);
  585. });
  586. if (MonitorDataTable.value && selectRowIndex.value == -1) {
  587. MonitorDataTable.value.setSelectedRowKeys([dataSource.value[0]['deviceID']])
  588. }
  589. const data: any = toRaw(dataSource.value[selectRowIndex.value]); //maxarea
  590. return data;
  591. } else {
  592. return dataSource.value = []
  593. }
  594. }else{
  595. dataSource.value = [];
  596. }
  597. };
  598. // https获取监测数据
  599. let timer: null | NodeJS.Timeout = null;
  600. async function getMonitor(flag?) {
  601. if (Object.prototype.toString.call(timer) === '[object Null]') {
  602. timer = await setTimeout(async () => {
  603. await getDataSource();
  604. if (dataSource.value.length > 0 && selectRowIndex.value == -1 && MonitorDataTable.value) {
  605. // 初始打开页面
  606. if (currentRoute.value && currentRoute.value['query'] && currentRoute.value['query']['id']) {
  607. MonitorDataTable.value.setSelectedRowKeys(currentRoute.value['query']['id'])
  608. }else{
  609. MonitorDataTable.value.setSelectedRowKeys(dataSource.value[0]['deviceID'])
  610. }
  611. }
  612. for (const key in selectData) {
  613. selectData[key] = ''
  614. }
  615. if(dataSource.value.length > 0 && dataSource.value[selectRowIndex.value]){
  616. deviceType.value = dataSource.value[selectRowIndex.value]['deviceType']
  617. if (dataSource.value.length > 0 && dataSource.value[selectRowIndex.value]) {
  618. Object.assign(selectData, dataSource.value[selectRowIndex.value])
  619. }
  620. playSmoke(selectData)
  621. addText(selectData);
  622. if (timer) {
  623. timer = null;
  624. }
  625. }
  626. getMonitor();
  627. }, flag ? 0 :1000);
  628. }
  629. };
  630. // 获取设备基本信息列表
  631. const deviceBaseList = ref([]);
  632. function getDeviceBaseList() {
  633. getTableList({ pageSize: 1000 }).then((res) => {
  634. deviceBaseList.value = res.records;
  635. });
  636. };
  637. // 切换检测数据
  638. async function getSelectRow(id) {
  639. console.log('选中的设备id------->', id)
  640. if (!id || id == selectData['deviceID']) return;
  641. // loading.value = true;
  642. const selectIndex: any = dataSource.value.findIndex((baseData: any) => baseData.deviceID == id);
  643. selectRowIndex.value = selectIndex;
  644. modalType.value = selectIndex > 0 ? 'fm' : 'fc';
  645. nextTick(() => {
  646. const headEl = document.querySelector(`.zxm-table-thead`);
  647. if (headEl) {
  648. headElHeight.value = headEl.clientHeight
  649. }
  650. setModelType(modalType.value).then(() => {
  651. // loading.value = false;
  652. });
  653. const data = dataSource.value[selectIndex];
  654. if(data){
  655. if (data['Fan1StartStatus'] == 1) {
  656. mainWindIsShow1.value = 'open';
  657. mainWindIsShow2.value = 'stop';
  658. selectDevice('warningMonitorRowIndex', 0)
  659. selectDevice('dataMonitorRowIndex', 0)
  660. } else if (data['Fan2StartStatus'] == 1) {
  661. mainWindIsShow2.value = 'open';
  662. mainWindIsShow1.value = 'stop';
  663. selectDevice('warningMonitorRowIndex', 1)
  664. selectDevice('dataMonitorRowIndex', 1)
  665. }
  666. const xAxisDataGasArr = []
  667. for (const key in selectData) {
  668. if (key.startsWith('gas') && key.length < 5) {
  669. xAxisDataGasArr.push({ key: 'T' + key.substring(3), valueKey: key })
  670. }
  671. }
  672. xAxisDataGas.value = xAxisDataGasArr
  673. }
  674. })
  675. await getCamera(id, playerRef.value)
  676. return;
  677. };
  678. // 打开并设置modal的标题
  679. function showModal(obj) {
  680. modalType.value = obj.key;
  681. modalTitle.value = obj.value;
  682. passWord.value = '';
  683. modalIsShow.value = true;
  684. };
  685. function changeMotor(e){
  686. const target = e.target;
  687. if (target.name === 'localWind1') {
  688. if (target.value === 'open') {
  689. mainWindIsShow2.value = 'stop';
  690. }
  691. } else if (target.name === 'localWind2') {
  692. if (target.value === 'open') {
  693. mainWindIsShow1.value = 'stop';
  694. }
  695. }
  696. };
  697. function handleOk(e: MouseEvent) {
  698. const handType = modalType.value;
  699. const data = {
  700. deviceid: selectData.deviceID,
  701. devicetype: selectData.deviceType,
  702. paramcode: '',
  703. password: passWord.value,
  704. value: null,
  705. };
  706. if (handType === 'startSmoke') {
  707. // 启动风机
  708. if (mainWindIsShow1.value === 'open' && mainWindIsShow2.value === 'stop') {
  709. // playSmoke(handType, 'top', frequency, 'open');
  710. data.paramcode = 'CtrlFan1Start';
  711. deviceControlApi(data).then(() => {
  712. if (globalConfig.History_Type == 'remote') {
  713. message.success('指令已下发至生产管控平台成功!')
  714. } else {
  715. message.success('指令已下发成功!')
  716. }
  717. modalTitle.value = '';
  718. modalIsShow.value = false;
  719. }).catch((err) => {
  720. });
  721. } else if (mainWindIsShow2.value === 'open' && mainWindIsShow1.value === 'stop') {
  722. // playSmoke(handType, 'down', frequency, 'open');
  723. data.paramcode = 'CtrlFan2Start';
  724. deviceControlApi(data).then(() => {
  725. if (globalConfig.History_Type == 'remote') {
  726. message.success('指令已下发至生产管控平台成功!')
  727. } else {
  728. message.success('指令已下发成功!')
  729. }
  730. modalTitle.value = '';
  731. modalIsShow.value = false;
  732. }).catch((err) => {
  733. });
  734. } else if (mainWindIsShow1.value === 'stop' && mainWindIsShow2.value === 'stop') {
  735. // playSmoke(handType, '', frequency, 'stop');
  736. }
  737. } else if (handType === 'Fan1Frequency' || handType === 'Fan2Frequency') {
  738. // 调频
  739. if (handType === 'Fan1Frequency') {
  740. data.paramcode = 'Fan1FreqHz';
  741. data.value = fan1FrequencyVal.value;
  742. } else if (handType === 'Fan2Frequency') {
  743. data.paramcode = 'Fan2FreqHz';
  744. data.value = fan2FrequencyVal.value;
  745. }
  746. deviceControlApi(data).then((res) => {
  747. if (globalConfig.History_Type == 'remote') {
  748. message.success('指令已下发至生产管控平台成功!')
  749. } else {
  750. message.success('指令已下发成功!')
  751. }
  752. modalTitle.value = '';
  753. modalIsShow.value = false;
  754. }).catch((err) => {
  755. });
  756. } else if (handType === 'changeSmoke') {
  757. if(selectData['Fan1StartStatus'] == 0 || !selectData['Fan1StartStatus']){
  758. data.paramcode = 'CtrlFan1Start';
  759. deviceControlApi(data).then((res) => {
  760. if (globalConfig.History_Type == 'remote') {
  761. message.success('指令已下发至生产管控平台成功!')
  762. } else {
  763. message.success('指令已下发成功!')
  764. }
  765. modalTitle.value = '';
  766. modalIsShow.value = false;
  767. mainWindIsShow1.value = 'stop';
  768. mainWindIsShow2.value = 'open';
  769. }).catch((err) => {
  770. });
  771. }else if(selectData['Fan2StartStatus'] == 0 || !selectData['Fan2StartStatus']){
  772. data.paramcode = 'CtrlFan2Start';
  773. deviceControlApi(data).then((res) => {
  774. if (globalConfig.History_Type == 'remote') {
  775. message.success('指令已下发至生产管控平台成功!')
  776. } else {
  777. message.success('指令已下发成功!')
  778. }
  779. modalTitle.value = '';
  780. modalIsShow.value = false;
  781. mainWindIsShow1.value = 'open';
  782. mainWindIsShow2.value = 'stop';
  783. }).catch((err) => {
  784. });
  785. }
  786. // // 一键倒机
  787. // if (mainWindIsShow1.value === 'open' && mainWindIsShow2.value === 'stop') {
  788. // // playSmoke('startSmoke', 'down', frequency, 'open');
  789. // data.paramcode = 'CtrlFan2Start';
  790. // deviceControlApi(data).then((res) => {
  791. // console.log('设备操作结果', res);
  792. // modalTitle.value = '';
  793. // modalIsShow.value = false;
  794. // }).catch((err) => {
  795. // });
  796. // mainWindIsShow1.value = 'stop';
  797. // mainWindIsShow2.value = 'open';
  798. // } else if (mainWindIsShow2.value === 'open' && mainWindIsShow1.value === 'stop') {
  799. // // playSmoke('startSmoke', 'top', frequency, 'open');
  800. // data.paramcode = 'CtrlFan1Start';
  801. // deviceControlApi(data).then((res) => {
  802. // console.log('设备操作结果', res);
  803. // modalTitle.value = '';
  804. // modalIsShow.value = false;
  805. // }).catch((err) => {
  806. // });
  807. // mainWindIsShow1.value = 'open';
  808. // mainWindIsShow2.value = 'stop';
  809. // } else if (mainWindIsShow1.value === 'stop' && mainWindIsShow2.value === 'stop') {
  810. // // playSmoke(handType, '', frequency, 'stop');
  811. // }
  812. }
  813. };
  814. function handleChangeSensor(value: string){
  815. console.log(value);
  816. };
  817. function addPlayVideo() {
  818. if (player1.value && player1.value.play) {
  819. if (!player1.value.paused()) player1.value.play();
  820. document.body.removeEventListener('mousedown', addPlayVideo);
  821. }
  822. };
  823. function deviceEdit(e:Event, type:string, record) {
  824. e.stopPropagation()
  825. openModal(true, {
  826. type,
  827. deviceId: record['deviceID']
  828. })
  829. }
  830. onBeforeMount(() => {
  831. getDeviceBaseList();
  832. });
  833. onMounted(() => {
  834. const { query } = unref(currentRoute);
  835. if(query['deviceType']) devicekide.value = query['deviceType'] as string
  836. mountedThree(player1.value).then(async () => {
  837. await getMonitor(true);
  838. nextTick(async() => {
  839. addCssText();
  840. });
  841. });
  842. document.body.addEventListener('mousedown', addPlayVideo, false);
  843. });
  844. onUnmounted(() => {
  845. destroy();
  846. if (timer) {
  847. clearTimeout(timer);
  848. timer = undefined;
  849. }
  850. if (webRtcServer.length > 0) {
  851. webRtcServer.forEach(item => {
  852. item.disconnect()
  853. })
  854. }
  855. });
  856. </script>
  857. <style scoped lang="less">
  858. @import '/@/design/vent/modal.less';
  859. :deep(.@{ventSpace}-tabs-tabpane-active) {
  860. height: 100%;
  861. }
  862. .scene-box {
  863. .title-text{
  864. height: 32px;
  865. }
  866. .bottom-tabs-box{
  867. height: 280px;
  868. .tabs-box{
  869. position: relative !important;
  870. }
  871. }
  872. }
  873. .data-show-box {
  874. position: relative;
  875. display: flex;
  876. flex-direction: row;
  877. justify-content: space-between;
  878. padding: 10px 5px;
  879. color: #ffffff;
  880. z-index: 999;
  881. top: 60px;
  882. .data-item {
  883. pointer-events: auto;
  884. .item-header {
  885. width: 374px;
  886. background: url('/@/assets/images/vent/lr-top-bg.png') no-repeat;
  887. background-size: auto;
  888. height: 32px;
  889. text-align: center;
  890. line-height: 34px;
  891. font-size: 15px;
  892. font-weight: 600;
  893. color: #fafafa;
  894. }
  895. .item-container {
  896. width: 346px;
  897. margin: 0 14px;
  898. padding: 10px;
  899. background: #00377c33;
  900. backdrop-filter: blur(2px);
  901. .tab {
  902. width: 323px;
  903. background: url('/@/assets/images/vent/lr-tab-bg.png') no-repeat;
  904. display: flex;
  905. .tab-item {
  906. flex: 1;
  907. text-align: center;
  908. padding-top: 2px;
  909. color: #ffffff99;
  910. cursor: pointer;
  911. &:hover {
  912. color: #ffffff;
  913. }
  914. }
  915. .tab-item-active-l {
  916. color: #ffffff;
  917. background-image: url('/@/assets/images/vent/l-tab-active.png');
  918. background-repeat: no-repeat;
  919. background-size: auto;
  920. background-position: 6px 3px;
  921. }
  922. .tab-item-active-r {
  923. color: #ffffff;
  924. background-image: url('/@/assets/images/vent/r-tab-active.png');
  925. background-repeat: no-repeat;
  926. background-position: 0 3px;
  927. }
  928. }
  929. .container-group {
  930. width: 314px;
  931. margin: 0px 4px;
  932. padding: 10px 0;
  933. min-height: 432px;
  934. background: linear-gradient(to right, #00deff22, #2081ff05);
  935. max-height: 440px;
  936. overflow-y: auto;
  937. }
  938. .container-item {
  939. width: 100%;
  940. height: 60px;
  941. display: flex;
  942. padding: 10px 0 0 20px;
  943. margin-bottom: 5px;
  944. position: relative;
  945. background: url('/@/assets/images/vent/plane-bottom.png') no-repeat;
  946. background-size: auto;
  947. background-position: bottom;
  948. &::before {
  949. content: '';
  950. display: block;
  951. width: 100%;
  952. height: 5px;
  953. position: absolute;
  954. top: 62px;
  955. left: 0;
  956. background-color: #73f4ff66;
  957. backdrop-filter: blur(5px);
  958. }
  959. .item-icon {
  960. width: 54px;
  961. height: 45px;
  962. background: url('/@/assets/images/vent/plane-icon-bg.png') no-repeat;
  963. background-size: cover;
  964. .icon-style {
  965. font-size: 18px;
  966. margin: 10px 0 0 20px;
  967. color: #ffc800;
  968. }
  969. }
  970. .item-name {
  971. width: 180px;
  972. line-height: 60px;
  973. }
  974. .item-value {
  975. position: relative;
  976. height: 26px;
  977. line-height: 24px;
  978. margin: 15px 0;
  979. text-align: center;
  980. width: 80px;
  981. border: 1px solid #00f5fe;
  982. border-radius: 13px;
  983. background: linear-gradient(to right, #00f5fe44, #0090ff44);
  984. &::before {
  985. width: 6px;
  986. height: 6px;
  987. content: '';
  988. position: absolute;
  989. left: -3px;
  990. top: 8px;
  991. background: #ffa500;
  992. border-radius: 3px;
  993. }
  994. }
  995. }
  996. .warning-header {
  997. display: flex;
  998. font-size: 14px;
  999. .header-item {
  1000. flex: 1;
  1001. display: flex;
  1002. flex-direction: column;
  1003. margin: 5px 10px;
  1004. justify-content: center;
  1005. align-items: center;
  1006. .header-title {
  1007. color: #39e7fe;
  1008. }
  1009. .header-value {
  1010. width: 133px;
  1011. height: 56px;
  1012. font-weight: 600;
  1013. font-family: 'douyuFont';
  1014. font-size: 16px;
  1015. color: #ffa500;
  1016. display: flex;
  1017. justify-content: center;
  1018. align-items: center;
  1019. background: url('/@/assets/images/vent/count-header-bg.png') no-repeat;
  1020. }
  1021. }
  1022. }
  1023. .warning-group {
  1024. padding: 0 10px;
  1025. position: relative;
  1026. // &::before {
  1027. // content: '';
  1028. // display: block;
  1029. // width: 1px;
  1030. // height: 100%;
  1031. // position: absolute;
  1032. // left: 12px;
  1033. // background-color: #00f5fe;
  1034. // }
  1035. .warning-item {
  1036. display: flex;
  1037. flex-direction: row;
  1038. justify-content: space-between;
  1039. align-items: center;
  1040. height: 38px;
  1041. .item-name {
  1042. .icon {
  1043. width: 6px;
  1044. height: 6px;
  1045. display: inline-block;
  1046. background-color: #1cd5ff;
  1047. border-radius: 3px;
  1048. position: relative;
  1049. margin-right: 5px;
  1050. &::before {
  1051. content: '';
  1052. width: 10px;
  1053. height: 10px;
  1054. display: block;
  1055. border: 1px solid #34edff99;
  1056. border-radius: 5px;
  1057. position: absolute;
  1058. top: -2px;
  1059. left: -2px;
  1060. }
  1061. }
  1062. }
  1063. }
  1064. }
  1065. }
  1066. }
  1067. }
  1068. .input-box {
  1069. display: flex;
  1070. align-items: center;
  1071. .input-title {
  1072. color: #73e8fe;
  1073. width: auto;
  1074. }
  1075. margin-right: 10px;
  1076. }
  1077. .label {
  1078. max-width: 220px;
  1079. }
  1080. #fanLocalSelectDom{
  1081. :deep(.@{ventSpace}-select-dropdown){
  1082. left: 0px !important;
  1083. top: 35px !important;
  1084. }
  1085. }
  1086. .@{ventSpace}-input {
  1087. width: 150px;
  1088. }
  1089. :deep(#LivePlayerBox){
  1090. display: flex;
  1091. justify-content: end;
  1092. padding-right: 380px;
  1093. }
  1094. </style>