index.vue 41 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129
  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: 300px; height: 280px; margin: auto">
  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 } 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 { TableAction } from '/@/components/Table';
  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. watch(deviceType , (type) => {
  526. rightColumns.value = getTableHeaderColumns(type + '_monitor_right') as []
  527. if(rightColumns.value && rightColumns.value.length < 1){
  528. rightColumns.value = getTableHeaderColumns(type.split('_')[0] + '_monitor_right') as []
  529. }
  530. leftColumns.value = getTableHeaderColumns(type + '_monitor_left') as []
  531. if (leftColumns.value && leftColumns.value.length < 1) {
  532. leftColumns.value = getTableHeaderColumns(type.split('_')[0] + '_monitor_left') as []
  533. }
  534. })
  535. const flvURL1 = () => {
  536. // return `https://sf1-hscdn-tos.pstatp.com/obj/media-fe/xgplayer_doc_video/flv/xgplayer-demo-360p.flv`;
  537. return ''
  538. };
  539. const changeDeviceKind = (e) => {
  540. devicekide.value = e
  541. loading.value = true
  542. selectRowIndex.value = -1
  543. nextTick( () => {
  544. // selectRowIndex.value = 0
  545. selectData = lodash.cloneDeep(initData)
  546. loading.value = false
  547. if(selectData.deviceID)MonitorDataTable.value.setSelectedRowKeys([selectData.deviceID])
  548. const headEl = document.querySelector(`.zxm-table-thead`);
  549. if (headEl) {
  550. headElHeight.value = headEl.clientHeight
  551. }
  552. })
  553. }
  554. const tabChange = (activeKeyVal) => {
  555. activeKey.value = activeKeyVal;
  556. if (activeKeyVal == 1) {
  557. nextTick(() => {
  558. MonitorDataTable.value.setSelectedRowKeys([selectData.deviceID])
  559. })
  560. }
  561. };
  562. const selectDevice = (key, val) => {
  563. if (key === 'dataMonitorRowIndex') {
  564. dataMonitorRowIndex.value = val;
  565. } else {
  566. warningMonitorRowIndex.value = val;
  567. }
  568. };
  569. //详情
  570. function goDetail() {
  571. openModal()
  572. }
  573. //
  574. async function getDataSource(){
  575. if(devicekide.value){
  576. const res = await list({ devicetype: devicekide.value, pagetype: 'normal' });
  577. if (res.msgTxt && res.msgTxt[0] && res.msgTxt[0].datalist && res.msgTxt[0].datalist.length > 0) {
  578. const dataArr = res.msgTxt[0].datalist || [];
  579. dataSource.value = [];
  580. dataArr.forEach((data) => {
  581. const readData = data.readData;
  582. data = Object.assign(data, readData);
  583. dataSource.value.push(data);
  584. });
  585. if (MonitorDataTable.value && selectRowIndex.value == -1) {
  586. MonitorDataTable.value.setSelectedRowKeys([dataSource.value[0]['deviceID']])
  587. }
  588. const data: any = toRaw(dataSource.value[selectRowIndex.value]); //maxarea
  589. return data;
  590. } else {
  591. return dataSource.value = []
  592. }
  593. }else{
  594. dataSource.value = [];
  595. }
  596. };
  597. // https获取监测数据
  598. let timer: null | NodeJS.Timeout = null;
  599. async function getMonitor(flag?) {
  600. if (Object.prototype.toString.call(timer) === '[object Null]') {
  601. timer = await setTimeout(async () => {
  602. await getDataSource();
  603. if (dataSource.value.length > 0 && selectRowIndex.value == -1 && MonitorDataTable.value) {
  604. // 初始打开页面
  605. if (currentRoute.value && currentRoute.value['query'] && currentRoute.value['query']['id']) {
  606. MonitorDataTable.value.setSelectedRowKeys(currentRoute.value['query']['id'])
  607. }else{
  608. MonitorDataTable.value.setSelectedRowKeys(dataSource.value[0]['deviceID'])
  609. }
  610. }
  611. for (const key in selectData) {
  612. selectData[key] = ''
  613. }
  614. if(dataSource.value.length > 0 && dataSource.value[selectRowIndex.value]){
  615. deviceType.value = dataSource.value[selectRowIndex.value]['deviceType']
  616. if (dataSource.value.length > 0 && dataSource.value[selectRowIndex.value]) {
  617. Object.assign(selectData, dataSource.value[selectRowIndex.value])
  618. }
  619. playSmoke(selectData)
  620. addText(selectData);
  621. if (timer) {
  622. timer = null;
  623. }
  624. }
  625. getMonitor();
  626. }, flag ? 0 :1000);
  627. }
  628. };
  629. // 获取设备基本信息列表
  630. const deviceBaseList = ref([]);
  631. function getDeviceBaseList() {
  632. getTableList({ pageSize: 1000 }).then((res) => {
  633. deviceBaseList.value = res.records;
  634. });
  635. };
  636. // 切换检测数据
  637. function getSelectRow(id) {
  638. console.log('选中的设备id------->', id)
  639. if (!id || id == selectData['deviceID']) return;
  640. // loading.value = true;
  641. const selectIndex: any = dataSource.value.findIndex((baseData: any) => baseData.deviceID == id);
  642. selectRowIndex.value = selectIndex;
  643. modalType.value = selectIndex > 0 ? 'fm' : 'fc';
  644. nextTick(() => {
  645. const headEl = document.querySelector(`.zxm-table-thead`);
  646. if (headEl) {
  647. headElHeight.value = headEl.clientHeight
  648. }
  649. setModelType(modalType.value).then(() => {
  650. // loading.value = false;
  651. });
  652. const data = dataSource.value[selectIndex];
  653. if(data){
  654. if (data['Fan1StartStatus'] == 1) {
  655. mainWindIsShow1.value = 'open';
  656. mainWindIsShow2.value = 'stop';
  657. selectDevice('warningMonitorRowIndex', 0)
  658. selectDevice('dataMonitorRowIndex', 0)
  659. } else if (data['Fan2StartStatus'] == 1) {
  660. mainWindIsShow2.value = 'open';
  661. mainWindIsShow1.value = 'stop';
  662. selectDevice('warningMonitorRowIndex', 1)
  663. selectDevice('dataMonitorRowIndex', 1)
  664. }
  665. const xAxisDataGasArr = []
  666. for (const key in selectData) {
  667. if (key.startsWith('gas') && key.length < 5) {
  668. xAxisDataGasArr.push({ key: 'T' + key.substring(3), valueKey: key })
  669. }
  670. }
  671. xAxisDataGas.value = xAxisDataGasArr
  672. }
  673. })
  674. return;
  675. };
  676. // 打开并设置modal的标题
  677. function showModal(obj) {
  678. modalType.value = obj.key;
  679. modalTitle.value = obj.value;
  680. passWord.value = '';
  681. modalIsShow.value = true;
  682. };
  683. function changeMotor(e){
  684. const target = e.target;
  685. if (target.name === 'localWind1') {
  686. if (target.value === 'open') {
  687. mainWindIsShow2.value = 'stop';
  688. }
  689. } else if (target.name === 'localWind2') {
  690. if (target.value === 'open') {
  691. mainWindIsShow1.value = 'stop';
  692. }
  693. }
  694. };
  695. function handleOk(e: MouseEvent) {
  696. const handType = modalType.value;
  697. const data = {
  698. deviceid: selectData.deviceID,
  699. devicetype: selectData.deviceType,
  700. paramcode: '',
  701. password: passWord.value,
  702. value: null,
  703. };
  704. if (handType === 'startSmoke') {
  705. // 启动风机
  706. if (mainWindIsShow1.value === 'open' && mainWindIsShow2.value === 'stop') {
  707. // playSmoke(handType, 'top', frequency, 'open');
  708. data.paramcode = 'CtrlFan1Start';
  709. deviceControlApi(data).then(() => {
  710. if (globalConfig.History_Type == 'remote') {
  711. message.success('指令已下发至生产管控平台成功!')
  712. } else {
  713. message.success('指令已下发成功!')
  714. }
  715. modalTitle.value = '';
  716. modalIsShow.value = false;
  717. }).catch((err) => {
  718. });
  719. } else if (mainWindIsShow2.value === 'open' && mainWindIsShow1.value === 'stop') {
  720. // playSmoke(handType, 'down', frequency, 'open');
  721. data.paramcode = 'CtrlFan2Start';
  722. deviceControlApi(data).then(() => {
  723. if (globalConfig.History_Type == 'remote') {
  724. message.success('指令已下发至生产管控平台成功!')
  725. } else {
  726. message.success('指令已下发成功!')
  727. }
  728. modalTitle.value = '';
  729. modalIsShow.value = false;
  730. }).catch((err) => {
  731. });
  732. } else if (mainWindIsShow1.value === 'stop' && mainWindIsShow2.value === 'stop') {
  733. // playSmoke(handType, '', frequency, 'stop');
  734. }
  735. } else if (handType === 'Fan1Frequency' || handType === 'Fan2Frequency') {
  736. // 调频
  737. if (handType === 'Fan1Frequency') {
  738. data.paramcode = 'Fan1FreqHz';
  739. data.value = fan1FrequencyVal.value;
  740. } else if (handType === 'Fan2Frequency') {
  741. data.paramcode = 'Fan2FreqHz';
  742. data.value = fan2FrequencyVal.value;
  743. }
  744. deviceControlApi(data).then((res) => {
  745. if (globalConfig.History_Type == 'remote') {
  746. message.success('指令已下发至生产管控平台成功!')
  747. } else {
  748. message.success('指令已下发成功!')
  749. }
  750. modalTitle.value = '';
  751. modalIsShow.value = false;
  752. }).catch((err) => {
  753. });
  754. } else if (handType === 'changeSmoke') {
  755. if(selectData['Fan1StartStatus'] == 0 || !selectData['Fan1StartStatus']){
  756. data.paramcode = 'CtrlFan1Start';
  757. deviceControlApi(data).then((res) => {
  758. if (globalConfig.History_Type == 'remote') {
  759. message.success('指令已下发至生产管控平台成功!')
  760. } else {
  761. message.success('指令已下发成功!')
  762. }
  763. modalTitle.value = '';
  764. modalIsShow.value = false;
  765. mainWindIsShow1.value = 'stop';
  766. mainWindIsShow2.value = 'open';
  767. }).catch((err) => {
  768. });
  769. }else if(selectData['Fan2StartStatus'] == 0 || !selectData['Fan2StartStatus']){
  770. data.paramcode = 'CtrlFan2Start';
  771. deviceControlApi(data).then((res) => {
  772. if (globalConfig.History_Type == 'remote') {
  773. message.success('指令已下发至生产管控平台成功!')
  774. } else {
  775. message.success('指令已下发成功!')
  776. }
  777. modalTitle.value = '';
  778. modalIsShow.value = false;
  779. mainWindIsShow1.value = 'open';
  780. mainWindIsShow2.value = 'stop';
  781. }).catch((err) => {
  782. });
  783. }
  784. // // 一键倒机
  785. // if (mainWindIsShow1.value === 'open' && mainWindIsShow2.value === 'stop') {
  786. // // playSmoke('startSmoke', 'down', frequency, 'open');
  787. // data.paramcode = 'CtrlFan2Start';
  788. // deviceControlApi(data).then((res) => {
  789. // console.log('设备操作结果', res);
  790. // modalTitle.value = '';
  791. // modalIsShow.value = false;
  792. // }).catch((err) => {
  793. // });
  794. // mainWindIsShow1.value = 'stop';
  795. // mainWindIsShow2.value = 'open';
  796. // } else if (mainWindIsShow2.value === 'open' && mainWindIsShow1.value === 'stop') {
  797. // // playSmoke('startSmoke', 'top', frequency, 'open');
  798. // data.paramcode = 'CtrlFan1Start';
  799. // deviceControlApi(data).then((res) => {
  800. // console.log('设备操作结果', res);
  801. // modalTitle.value = '';
  802. // modalIsShow.value = false;
  803. // }).catch((err) => {
  804. // });
  805. // mainWindIsShow1.value = 'open';
  806. // mainWindIsShow2.value = 'stop';
  807. // } else if (mainWindIsShow1.value === 'stop' && mainWindIsShow2.value === 'stop') {
  808. // // playSmoke(handType, '', frequency, 'stop');
  809. // }
  810. }
  811. };
  812. function handleChangeSensor(value: string){
  813. console.log(value);
  814. };
  815. function addPlayVideo() {
  816. if (player1.value && player1.value.play) {
  817. if (!player1.value.paused()) player1.value.play();
  818. document.body.removeEventListener('mousedown', addPlayVideo);
  819. }
  820. };
  821. function deviceEdit(e:Event, type:string, record) {
  822. e.stopPropagation()
  823. openModal(true, {
  824. type,
  825. deviceId: record['deviceID']
  826. })
  827. }
  828. onBeforeMount(() => {
  829. getDeviceBaseList();
  830. });
  831. onMounted(() => {
  832. mountedThree(player1.value).then(async () => {
  833. await getMonitor(true);
  834. nextTick(async() => {
  835. addCssText();
  836. });
  837. });
  838. document.body.addEventListener('mousedown', addPlayVideo, false);
  839. });
  840. onUnmounted(() => {
  841. destroy();
  842. if (timer) {
  843. clearTimeout(timer);
  844. timer = undefined;
  845. }
  846. });
  847. </script>
  848. <style scoped lang="less">
  849. @import '/@/design/vent/modal.less';
  850. :deep(.@{ventSpace}-tabs-tabpane-active) {
  851. height: 100%;
  852. }
  853. .scene-box {
  854. .title-text{
  855. height: 32px;
  856. }
  857. .bottom-tabs-box{
  858. height: 280px;
  859. .tabs-box{
  860. position: relative !important;
  861. }
  862. }
  863. }
  864. .data-show-box {
  865. position: relative;
  866. display: flex;
  867. flex-direction: row;
  868. justify-content: space-between;
  869. padding: 10px 5px;
  870. color: #ffffff;
  871. z-index: 999;
  872. top: 60px;
  873. .data-item {
  874. pointer-events: auto;
  875. .item-header {
  876. width: 374px;
  877. background: url('/@/assets/images/vent/lr-top-bg.png') no-repeat;
  878. background-size: auto;
  879. height: 32px;
  880. text-align: center;
  881. line-height: 34px;
  882. font-size: 15px;
  883. font-weight: 600;
  884. color: #fafafa;
  885. }
  886. .item-container {
  887. width: 346px;
  888. margin: 0 14px;
  889. padding: 10px;
  890. background: #00377c33;
  891. backdrop-filter: blur(2px);
  892. .tab {
  893. width: 323px;
  894. background: url('/@/assets/images/vent/lr-tab-bg.png') no-repeat;
  895. display: flex;
  896. .tab-item {
  897. flex: 1;
  898. text-align: center;
  899. padding-top: 2px;
  900. color: #ffffff99;
  901. cursor: pointer;
  902. &:hover {
  903. color: #ffffff;
  904. }
  905. }
  906. .tab-item-active-l {
  907. color: #ffffff;
  908. background-image: url('/@/assets/images/vent/l-tab-active.png');
  909. background-repeat: no-repeat;
  910. background-size: auto;
  911. background-position: 6px 3px;
  912. }
  913. .tab-item-active-r {
  914. color: #ffffff;
  915. background-image: url('/@/assets/images/vent/r-tab-active.png');
  916. background-repeat: no-repeat;
  917. background-position: 0 3px;
  918. }
  919. }
  920. .container-group {
  921. width: 314px;
  922. margin: 0px 4px;
  923. padding: 10px 0;
  924. min-height: 432px;
  925. background: linear-gradient(to right, #00deff22, #2081ff05);
  926. max-height: 440px;
  927. overflow-y: auto;
  928. }
  929. .container-item {
  930. width: 100%;
  931. height: 60px;
  932. display: flex;
  933. padding: 10px 0 0 20px;
  934. margin-bottom: 5px;
  935. position: relative;
  936. background: url('/@/assets/images/vent/plane-bottom.png') no-repeat;
  937. background-size: auto;
  938. background-position: bottom;
  939. &::before {
  940. content: '';
  941. display: block;
  942. width: 100%;
  943. height: 5px;
  944. position: absolute;
  945. top: 62px;
  946. left: 0;
  947. background-color: #73f4ff66;
  948. backdrop-filter: blur(5px);
  949. }
  950. .item-icon {
  951. width: 54px;
  952. height: 45px;
  953. background: url('/@/assets/images/vent/plane-icon-bg.png') no-repeat;
  954. background-size: cover;
  955. .icon-style {
  956. font-size: 18px;
  957. margin: 10px 0 0 20px;
  958. color: #ffc800;
  959. }
  960. }
  961. .item-name {
  962. width: 180px;
  963. line-height: 60px;
  964. }
  965. .item-value {
  966. position: relative;
  967. height: 26px;
  968. line-height: 24px;
  969. margin: 15px 0;
  970. text-align: center;
  971. width: 80px;
  972. border: 1px solid #00f5fe;
  973. border-radius: 13px;
  974. background: linear-gradient(to right, #00f5fe44, #0090ff44);
  975. &::before {
  976. width: 6px;
  977. height: 6px;
  978. content: '';
  979. position: absolute;
  980. left: -3px;
  981. top: 8px;
  982. background: #ffa500;
  983. border-radius: 3px;
  984. }
  985. }
  986. }
  987. .warning-header {
  988. display: flex;
  989. font-size: 14px;
  990. .header-item {
  991. flex: 1;
  992. display: flex;
  993. flex-direction: column;
  994. margin: 5px 10px;
  995. justify-content: center;
  996. align-items: center;
  997. .header-title {
  998. color: #39e7fe;
  999. }
  1000. .header-value {
  1001. width: 133px;
  1002. height: 56px;
  1003. font-weight: 600;
  1004. font-family: 'douyuFont';
  1005. font-size: 16px;
  1006. color: #ffa500;
  1007. display: flex;
  1008. justify-content: center;
  1009. align-items: center;
  1010. background: url('/@/assets/images/vent/count-header-bg.png') no-repeat;
  1011. }
  1012. }
  1013. }
  1014. .warning-group {
  1015. padding: 0 10px;
  1016. position: relative;
  1017. // &::before {
  1018. // content: '';
  1019. // display: block;
  1020. // width: 1px;
  1021. // height: 100%;
  1022. // position: absolute;
  1023. // left: 12px;
  1024. // background-color: #00f5fe;
  1025. // }
  1026. .warning-item {
  1027. display: flex;
  1028. flex-direction: row;
  1029. justify-content: space-between;
  1030. align-items: center;
  1031. height: 38px;
  1032. .item-name {
  1033. .icon {
  1034. width: 6px;
  1035. height: 6px;
  1036. display: inline-block;
  1037. background-color: #1cd5ff;
  1038. border-radius: 3px;
  1039. position: relative;
  1040. margin-right: 5px;
  1041. &::before {
  1042. content: '';
  1043. width: 10px;
  1044. height: 10px;
  1045. display: block;
  1046. border: 1px solid #34edff99;
  1047. border-radius: 5px;
  1048. position: absolute;
  1049. top: -2px;
  1050. left: -2px;
  1051. }
  1052. }
  1053. }
  1054. }
  1055. }
  1056. }
  1057. }
  1058. }
  1059. .input-box {
  1060. display: flex;
  1061. align-items: center;
  1062. .input-title {
  1063. color: #73e8fe;
  1064. width: auto;
  1065. }
  1066. margin-right: 10px;
  1067. }
  1068. .label {
  1069. max-width: 220px;
  1070. }
  1071. #fanLocalSelectDom{
  1072. :deep(.@{ventSpace}-select-dropdown){
  1073. left: 0px !important;
  1074. top: 35px !important;
  1075. }
  1076. }
  1077. .@{ventSpace}-input {
  1078. width: 150px;
  1079. }
  1080. </style>