index.vue 32 KB

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