index.vue 37 KB

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