index.vue 32 KB

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