index.vue 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769
  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="window3D" style="width: 100%; height: 100%; position: absolute; overflow: hidden"> </div>
  5. </div>
  6. <div class="scene-box">
  7. <div class="top-box">
  8. <div class="top-center row">
  9. <!-- <div class="button-box" @click="start(0)">复位</div> -->
  10. <div class="button-box" @click="testPlay('')">模拟动画</div>
  11. <div class="button-box" @click="clearPlay()">自动清洁</div>
  12. <div class="button-box" @click="startRun()">启动测风</div>
  13. <!-- <div class="button-box" @click="testPlay('up')">上</div>
  14. <div class="button-box" @click="testPlay('center')">中</div>
  15. <div class="button-box" @click="testPlay('down')">下</div>
  16. <div class="button-box" @click="testPlay('reset')">复位</div> -->
  17. </div>
  18. <!-- <div class="top-right row">
  19. <div class="control-type row">
  20. <div class="control-title">控制模式:</div>
  21. <a-radio-group v-model:value="controlType">
  22. <a-radio :value="1">就地</a-radio>
  23. <a-radio :value="2">远程</a-radio>
  24. </a-radio-group>
  25. </div>
  26. <div class="run-type row">
  27. <div class="control-title">运行状态:</div>
  28. <a-radio-group v-model:value="controlType">
  29. <a-radio :value="1">检修</a-radio>
  30. </a-radio-group>
  31. </div>
  32. <div class="run-state row">
  33. <div class="control-title">网络状态:</div>
  34. <a-radio-group v-model:value="controlType">
  35. <a-radio :value="1">运行</a-radio>
  36. </a-radio-group>
  37. </div>
  38. </div> -->
  39. </div>
  40. <div class="title-text">
  41. {{ selectData.strname }}
  42. </div>
  43. <div class="bottom-tabs-box" @mousedown="setDivHeight($event, 250, scroll)">
  44. <dv-border-box8 :dur="5" :style="`padding: 5px; height: ${scroll.y + 100}px`" >
  45. <div class="tabs-button-group">
  46. <a-button class="tabs-button" type="primary" @click="openModel">一键测风</a-button>
  47. <!-- <a-button class="tabs-button" type="primary" @click="exportExcel()">导出报表</a-button> -->
  48. </div>
  49. <a-tabs class="tabs-box" v-model:activeKey="activeKey" @change="tabChange">
  50. <a-tab-pane key="1" tab="实时监测">
  51. <MonitorTable
  52. v-if="activeKey === '1'"
  53. ref="MonitorDataTable"
  54. columnsType="windrect_monitor"
  55. :dataSource="dataSource"
  56. design-scope="windrect-monitor"
  57. @selectRow="getSelectRow"
  58. :scroll="scroll"
  59. title="测风装置监测"
  60. :isShowPagination="false"
  61. >
  62. <template #filterCell="{ column, record }">
  63. <a-tag v-if="column.dataIndex === 'netStatus'" :color="record.netStatus == 0 ? '#FF5812' : 'green'">{{
  64. record.netStatus == 0 ? '断开' : '连接'
  65. }}</a-tag>
  66. <a-tag v-if="column.dataIndex === 'warnFlag'" :color="record.warnFlag == 0 ? 'green' : record.warnFlag == 1 ? '#FF5812' : 'gray' "> {{
  67. record.warnFlag == 0 ? '正常' : record.warnFlag == 1 ? '报警' : record.warnFlag == 2 ? '断开' : '未监测'
  68. }}</a-tag>
  69. <a-tag v-if="column.dataIndex === 'sign'" :color="record.sign == 0 ? '#95CF65' : record.sign == 1 ? '#4590EA' : '#9876AA'"> {{
  70. record.sign == 0 ? '高位' : record.sign == 1 ? '中位' : '低位'
  71. }}</a-tag>
  72. <template v-if="record && column && column.dataIndex === 'isRun' && record.isRun">
  73. <a-tag v-if="record.isRun == -2 || record.isRun == -1" :color="record.isRun == -2 ? '#95CF65' : '#ED5700'">{{
  74. record.isRun == -2 ? '空闲' : '等待'
  75. }}</a-tag>
  76. <a-tag v-else-if="record.isRun == 100" color="#4693FF">完成</a-tag>
  77. <Progress v-else :percent="Number(record.isRun)" size="small" status="active" />
  78. </template>
  79. </template>
  80. </MonitorTable>
  81. </a-tab-pane>
  82. <a-tab-pane key="2" tab="监测曲线图" force-render>
  83. <div class="tab-item" v-if="activeKey === '2'">
  84. <DeviceEcharts
  85. chartsColumnsType="windrect_chart"
  86. xAxisPropType="strname"
  87. :dataSource="dataSource"
  88. height="100%"
  89. :chartsColumns="chartsColumns"
  90. :device-list-api="baseList"
  91. device-type="windrect"
  92. />
  93. </div>
  94. </a-tab-pane>
  95. <a-tab-pane key="3" tab="历史数据">
  96. <div class="tab-item">
  97. <HistoryTable columns-type="windrect" device-type="windrect" :device-list-api="baseList" designScope="windrect-history" :scroll="scroll">
  98. <template #filterCell="{ column, record }">
  99. <a-tag v-if="column.dataIndex === 'warnFlag'" :color="record.warnFlag == 0 ? 'green' : record.warnFlag == 1 ? '#FF5812' : 'gray'"> {{
  100. record.warnFlag == 0 ? '正常' : record.warnFlag == 1 ? '报警' : record.warnFlag == 2 ? '断开' : '未监测'
  101. }}</a-tag>
  102. </template>
  103. </HistoryTable>
  104. </div>
  105. </a-tab-pane>
  106. <a-tab-pane key="4" tab="报警历史">
  107. <div class="tab-item" v-if="activeKey === '4'">
  108. <AlarmHistoryTable columns-type="alarm" device-type="windrect" :device-list-api="baseList" designScope="alarm-history" :scroll="scroll"/>
  109. </div>
  110. </a-tab-pane>
  111. <a-tab-pane key="5" tab="操作历史">
  112. <div class="tab-item" v-if="activeKey === '5'">
  113. <HandlerHistoryTable columns-type="operator_history" device-type="windrect" :device-list-api="baseList" designScope="operator_history" :scroll="scroll"/>
  114. </div>
  115. </a-tab-pane>
  116. <a-tab-pane key="6" tab="测风结果" v-if="activeKey === '6'">
  117. <ResultTable v-if="activeKey == 6" deviceType="windrect_list" :scroll="scroll"/>
  118. </a-tab-pane>
  119. </a-tabs>
  120. </dv-border-box8>
  121. </div>
  122. </div>
  123. <div ref="playerRef" style="z-index: 999; position: absolute; top: 100px; right: 10px; width: 300px; height: 280px; margin: auto"></div>
  124. <BasicModal v-bind="$attrs" @register="registerModal" title="一键测风" width="900px" @ok="handleOk" @cancel="handleCancel">
  125. <div class="head-line">
  126. <div class="vent-flex-row">
  127. <span>同时运行数量:</span>
  128. <a-input-number v-model:value="runNum" :min="1" :max="10" />
  129. </div>
  130. <div class="vent-flex-row">
  131. <div v-for="(criticalPath, index) in criticalPathList" :key="index" class="button-box" @click="selectCriticalPath(criticalPath.id)">{{
  132. criticalPath.systemname
  133. }}</div>
  134. </div>
  135. </div>
  136. <div>
  137. <ModalTable ref="modalTable" deviceType="windrect_list" />
  138. </div>
  139. </BasicModal>
  140. <HandleModal :modal-is-show="modalIsShow" modal-title="启动测风" :modal-type="modalType" @handle-ok="controlDevice"
  141. @handle-cancel="handleCancelControl" />
  142. </template>
  143. <script setup lang="ts">
  144. import DeviceEcharts from '../comment/DeviceEcharts.vue';
  145. import { onBeforeMount,ref, onMounted, onUnmounted, reactive, toRaw, nextTick, watch } from 'vue';
  146. import { BasicModal, useModalInner } from '/@/components/Modal';
  147. import MonitorTable from '../comment/MonitorTable.vue';
  148. import ModalTable from './components/modalTable.vue';
  149. import HandleModal from './components/modal.vue';
  150. import ResultTable from './components/resultTable.vue';
  151. import HistoryTable from '../comment/HistoryTable.vue';
  152. import AlarmHistoryTable from '../comment/AlarmHistoryTable.vue';
  153. import HandlerHistoryTable from '../comment/HandlerHistoryTable.vue';
  154. import { deviceControlApi } from '/@/api/vent/index';
  155. import { mountedThree, destroy, addMonitorText, play, setModelType, playCamera, initCameraCanvas } from './windrect.threejs';
  156. import { list, pathList, deviceList, testWind, cameraAddrList, cameraList } from './windrect.api';
  157. import { list as baseList } from '../../deviceManager/windfindingTabel/windfinding.api';
  158. import { message, Progress } from 'ant-design-vue';
  159. import { chartsColumns } from './windrect.data';
  160. import { setDivHeight } from '/@/utils/event';
  161. import { BorderBox8 as DvBorderBox8 } from '@kjgl77/datav-vue3';
  162. import { useRouter } from 'vue-router';
  163. import { deviceCameraInit } from '/@/utils/ventutil.ts'
  164. const { currentRoute } = useRouter();
  165. const MonitorDataTable = ref()
  166. let webRtcServer: any[] = []
  167. const scroll = reactive({
  168. y: 240
  169. })
  170. const modalType = ref('')
  171. const modalIsShow = ref(false)
  172. const modalTable = ref();
  173. const runNum = ref(5); //设备运行数量
  174. const criticalPathList = ref([]);
  175. const playerRef = ref();
  176. const activeKey = ref('1');
  177. const loading = ref(false);
  178. // 默认初始是第一行
  179. const selectRowIndex = ref(-1);
  180. // 监测数据
  181. const selectData = reactive({
  182. deviceID: '',
  183. deviceType: '',
  184. strname: '',
  185. dataDh: '-', //压差
  186. dataDtestq: '-', //测试风量
  187. sourcePressure: '-', //气源压力
  188. dataDequivalarea: '-',
  189. netStatus: '0', //通信状态
  190. fault: '气源压力超限',
  191. sign: -1,
  192. sensorRight: 0,
  193. sensorMiddle: 1,
  194. sensorLeft: 0
  195. });
  196. // const dataSource = computed(() => {
  197. // const data = [...getRecordList()] || [];
  198. // Object.assign(selectData, toRaw(data[selectRowIndex.value]));
  199. // addMonitorText(selectData);
  200. // return data;
  201. // });
  202. const dataSource = ref([]);
  203. const tabChange = (activeKeyVal) => {
  204. activeKey.value = activeKeyVal;
  205. if (activeKeyVal == 1) {
  206. nextTick(() => {
  207. MonitorDataTable.value.setSelectedRowKeys([selectData.deviceID])
  208. })
  209. }
  210. };
  211. // 设备数据
  212. const controlType = ref(1);
  213. //表单赋值
  214. const [registerModal, { setModalProps, closeModal }] = useModalInner();
  215. // https获取监测数据
  216. let timer: null | NodeJS.Timeout = null;
  217. function getMonitor(flag?) {
  218. if (Object.prototype.toString.call(timer) === '[object Null]') {
  219. timer = setTimeout(() => {
  220. list({ devicetype: 'windrect', pagetype: 'normal' }).then((res) => {
  221. dataSource.value = res.msgTxt[0].datalist || [];
  222. if(dataSource.value.length > 0){
  223. dataSource.value.forEach((data: any) => {
  224. const readData = data.readData;
  225. data = Object.assign(data, readData);
  226. });
  227. if (dataSource.value.length > 0 && selectRowIndex.value == -1) {
  228. // 初始打开页面
  229. if (currentRoute.value['query'] && currentRoute.value['query']['id']) {
  230. MonitorDataTable.value.setSelectedRowKeys([currentRoute.value['query']['id']])
  231. } else {
  232. MonitorDataTable.value.setSelectedRowKeys([dataSource.value[0]['deviceID']])
  233. }
  234. }
  235. const data: any = toRaw(dataSource.value[selectRowIndex.value]); //maxarea
  236. Object.assign(selectData, data);
  237. addMonitorText(selectData);
  238. palyAnimation(selectData)
  239. }
  240. if (timer) {
  241. timer = null;
  242. }
  243. getMonitor();
  244. });
  245. }, flag ? 0 : 1000);
  246. }
  247. };
  248. let deviceRunState = '', tanTouRunState= '';
  249. // 根据3个点位分别执行动画
  250. function palyAnimation(selectData) {
  251. if (selectData.deviceType == "windrect_fold") {
  252. if (selectData['apparatusRun'] == 1) {
  253. const flag = selectData.sign == 0 ? 'up' : selectData.sign == 1 ? 'center' : selectData.sign == 2 ? 'down' : null
  254. if (flag) play(flag);
  255. } else {
  256. const flag = selectData.sign == 1 ? 'center' : selectData.sign == 2 ? 'down' : null
  257. if (flag) play(flag, true);
  258. }
  259. }
  260. // 运行中是0,运行到达是1
  261. if (selectData.deviceType == "windrect_rect_single") {
  262. if(selectData['apparatusRun'] == 1){
  263. // 镜头指向横杆
  264. // if(!deviceRunState && !tanTouRunState)playCamera('start')
  265. // 正在执行或是开始执行
  266. //开始执行时,
  267. // selectData['poleIncipient'] == 1 selectData.sensorMiddle == 1 代表可是执行 或是 执行结束
  268. // 1. selectData['poleIncipient'] == 1 selectData.sensorMiddle == 1, 执行 play('up', true),play('middle', true)
  269. // 2. 探头左移play('left')
  270. // 3. 探头右移play('right')
  271. // 4. 横杆向中位移动,探头在右边
  272. // 5. 探头移到中间play('middle')
  273. // 6. 探头移到左边play('left')
  274. // 7. 横杆向低位移动,探头在左边
  275. // 8. 探头移到中间play('middle')
  276. // 9. 探头右移play('right')
  277. // 10. 测风结束,探头移到中间play('middle'),横杆向高位移动
  278. if(selectData['poleIncipient'] == 1){
  279. // 横杆在高位,开始执行 或是 执行结束
  280. if(selectData.sensorMiddle == 1 && !deviceRunState && !tanTouRunState){
  281. // 1. 开始执行
  282. deviceRunState = 'up'
  283. tanTouRunState= 'middle'
  284. play('up', true)
  285. play('middle', true)
  286. }
  287. if (deviceRunState == 'up-m') {
  288. play('up', true)
  289. play('middle', true)
  290. deviceRunState = ''
  291. tanTouRunState = ''
  292. playCamera('end')
  293. }
  294. // 初始已经在运行
  295. if(selectData.sensorLeft == 0 && selectData.sensorMiddle == 0 && selectData.sensorRight == 0) {
  296. //2.探头左移play('left')
  297. if(tanTouRunState == 'middle'){
  298. tanTouRunState = 'left-m'
  299. play('left')
  300. }
  301. //3. 探头右移play('right')
  302. if (tanTouRunState == 'left') {
  303. tanTouRunState = 'right-m'
  304. play('right')
  305. }
  306. }
  307. if(selectData.sensorLeft == 1){
  308. tanTouRunState = 'left'
  309. if (!tanTouRunState || tanTouRunState == 'left-m') {
  310. play('left', true)
  311. }
  312. }
  313. if (selectData.sensorRight == 1) {
  314. tanTouRunState = 'right'
  315. if (!tanTouRunState || tanTouRunState == 'right-m') {
  316. play('right', true)
  317. }
  318. }
  319. }else if (selectData['poleMiddle'] == 1) {
  320. if(deviceRunState == 'center-m'){
  321. play('center', true)
  322. deviceRunState = 'center'
  323. tanTouRunState = 'right'
  324. play('right', true)
  325. }
  326. if (!deviceRunState) {
  327. deviceRunState = 'center'
  328. play('center', true)
  329. }
  330. if (!tanTouRunState) {
  331. play('right', true)
  332. }
  333. // 横杆在中位
  334. if (selectData.sensorLeft == 0 && selectData.sensorMiddle == 0 && selectData.sensorRight == 0) {
  335. //5. 探头移到中间play('middle')
  336. if (tanTouRunState == 'right') {
  337. tanTouRunState = 'middle-m'
  338. play('middle')
  339. }
  340. //6. 探头移到左边play('left')
  341. if (tanTouRunState == 'middle') {
  342. tanTouRunState = 'left-m'
  343. play('left')
  344. }
  345. }
  346. if (selectData.sensorMiddle == 1) {
  347. tanTouRunState = 'middle'
  348. if (!tanTouRunState || tanTouRunState == 'middle-m') {
  349. play('middle', true)
  350. }
  351. }
  352. if (selectData.sensorLeft == 1) {
  353. tanTouRunState = 'left'
  354. if (!tanTouRunState || tanTouRunState == 'left-m') {
  355. play('left', true)
  356. }
  357. }
  358. }else if (selectData['poleNether'] == 1) {
  359. if (deviceRunState == 'down-m') {
  360. play('down', true)
  361. deviceRunState = 'down'
  362. tanTouRunState = 'left'
  363. play('left', true)
  364. }
  365. if(!deviceRunState) {
  366. play('down', true)
  367. deviceRunState = 'down'
  368. }
  369. if (!tanTouRunState) {
  370. play('left', true)
  371. }
  372. // 横杆在低位
  373. if (selectData.sensorLeft == 0 && selectData.sensorMiddle == 0 && selectData.sensorRight == 0) {
  374. //8. 探头移到中间play('middle')
  375. if (tanTouRunState == 'left') {
  376. tanTouRunState = 'left-middle-m'
  377. play('middle')
  378. }
  379. //9. 探头右移play('right')
  380. if (tanTouRunState == 'middle1') {
  381. tanTouRunState = 'right-m'
  382. play('right')
  383. }
  384. // 10. 测风结束,探头移到中间play('middle'),横杆向高位移动
  385. if (tanTouRunState == 'right') {
  386. tanTouRunState = 'right-middle-m'
  387. play('middle')
  388. }
  389. }
  390. if (selectData.sensorMiddle == 1) {
  391. if(tanTouRunState == 'left-middle-m')tanTouRunState = 'middle1'
  392. if (tanTouRunState == 'right-middle-m') tanTouRunState = 'middle2'
  393. if (!tanTouRunState || tanTouRunState == 'left-middle-m' || tanTouRunState == 'right-middle-m') {
  394. play('middle', true)
  395. }
  396. }
  397. if (selectData.sensorRight == 1) {
  398. tanTouRunState = 'right'
  399. if (!tanTouRunState || tanTouRunState == 'right-m') {
  400. play('right', true)
  401. }
  402. }
  403. }else {
  404. // 横杆正在运行
  405. if(deviceRunState == 'up'){
  406. deviceRunState = 'center-m'
  407. play('center')
  408. }
  409. if (deviceRunState == 'center') {
  410. deviceRunState = 'down-m'
  411. play('down')
  412. }
  413. if (deviceRunState == 'down') {
  414. deviceRunState = 'up-m'
  415. play('up')
  416. }
  417. }
  418. // //正在执行时
  419. // // 判断上中下是否都为0
  420. // if(selectData['poleIncipient'] == 0 && selectData['poleMiddle'] == 0 && selectData['poleNether'] == 0) {
  421. // // 判断是否有前一个状态值,有的话执行
  422. // //没有前一个状态
  423. // //有前一个状态
  424. // // 横杆前状态在上位时,横杆中位移动,探头在右边
  425. // // 横杆前状态在中位时,横杆下位移动,探头在左边
  426. // // 横杆前状态在下位时,横杆上位移动,探头在中间
  427. // }else{
  428. // // 判断当前动画停在固定位置
  429. // if(selectData['poleIncipient'] == 1) {
  430. // // 滑杆停在上面,探头在中间
  431. // }else if (selectData['poleMiddle'] == 1) {
  432. // // 滑杆停在中间面,初始探头在右边
  433. // } else if (selectData['poleNether'] == 1) {
  434. // // 滑杆停在下面,初始探头在左边
  435. // }
  436. // }
  437. }else {
  438. // if(selectData['poleIncipient'] == 1){
  439. // deviceRunState = ''
  440. // tanTouRunState = ''
  441. // }
  442. }
  443. }
  444. if (selectData.deviceType == "windrect_rect") {
  445. if (selectData['apparatusRun'] == 1) {
  446. const flag = selectData.sign == 0 ? 'center' : selectData.sign == 1 ? 'down' : selectData.sign == 2 ? 'up' : null
  447. if (flag) play(flag);
  448. } else {
  449. const flag = selectData.sign == 1 ? 'center' : selectData.sign == 2 ? 'down' : selectData.sign == 0 ? 'up' : null
  450. if (flag) play(flag, true);
  451. }
  452. }
  453. if (selectData.deviceType == "windrect_ds") {
  454. if (selectData['apparatusRun'] == 1) {
  455. if(!deviceRunState) {
  456. deviceRunState = 'start'
  457. play('start')
  458. }
  459. } else {
  460. deviceRunState = ''
  461. play('start', true)
  462. }
  463. }
  464. }
  465. // 自测动画方法
  466. function testPlay(flag) {
  467. if (selectData.deviceType == 'windrect_rect') {
  468. setTimeout(() => {
  469. play('center')
  470. }, 0)
  471. setTimeout(() => {
  472. play('down')
  473. }, 4000)
  474. setTimeout(() => {
  475. play('up')
  476. }, 10000)
  477. }
  478. if(selectData.deviceType == 'windrect_fold') {
  479. setTimeout(() => {
  480. play('up')
  481. }, 0)
  482. setTimeout(() => {
  483. play('center')
  484. }, 10000)
  485. setTimeout(() => {
  486. play('down')
  487. }, 18000)
  488. setTimeout(() => {
  489. play('up')
  490. }, 21000)
  491. }
  492. if(selectData.deviceType == 'windrect_ds') {
  493. play('moni')
  494. }
  495. };
  496. function clearPlay() {
  497. modalType.value = 'autoClear'
  498. modalIsShow.value = true
  499. }
  500. function startRun() {
  501. modalType.value = 'sing'
  502. modalIsShow.value = true
  503. }
  504. async function getCamera() {
  505. const res = await cameraList({ deviceid: selectData['deviceID'] })
  506. const cameras: [] = res.records || []
  507. let cameraAddrs: any[] = [], cameraNames: string[] = [];
  508. if (cameras.length > 0) {
  509. cameras.forEach(item => {
  510. if (item['devicekind'] == 'toRtsp' || item['devicekind'] == 'toHLS') {
  511. cameraNames.push(item['name'])
  512. } else {
  513. cameraAddrs.push({ name: item['name'], addr: item['addr'] })
  514. }
  515. })
  516. }
  517. if (cameraNames.length > 0) {
  518. // 请求接口从装备院拿数据
  519. const addrs: string[] = await cameraAddrList({ cameraNameList: cameraNames })
  520. for (let i = 0; i < addrs.length; i++) {
  521. cameraAddrs.push({ name: '摄像头' + i, addr: addrs[i] })
  522. }
  523. }
  524. const obj = await deviceCameraInit(cameraAddrs, playerRef.value, webRtcServer)
  525. webRtcServer = obj.webRtcServerList
  526. const playerDoms = obj.playerDoms
  527. // 注意前后门适应需要对应 //[0] 后门 [1]前门
  528. await initCameraCanvas(...playerDoms)
  529. }
  530. // 切换检测数据
  531. async function getSelectRow(selectRow, index) {
  532. if(selectRow){
  533. loading.value = true;
  534. selectRowIndex.value = index;
  535. Object.assign(selectData, selectRow);
  536. let type = ''
  537. if(selectRow.deviceType == 'windrect_rect') {
  538. type = 'lmWindRect'
  539. }
  540. if (selectRow.deviceType == 'windrect_normal') {
  541. type = 'zdWindRect'
  542. }
  543. if (selectRow.deviceType == 'windrect_rect_single') {
  544. type = 'lmWindSide'
  545. }
  546. if (selectRow.deviceType == 'windrect_ds') {
  547. type = 'dsWindRect_move'
  548. }
  549. if (selectRow.deviceType == 'windrect_ds_four') {
  550. type = 'dsWindRect_four'
  551. }
  552. if (selectRow.deviceType == 'windrect_ds_two') {
  553. type = 'dsWindRect_two'
  554. }
  555. if (selectRow.deviceType == 'windrect_dd') {
  556. type = 'ddWindSide'
  557. }
  558. // const type = selectRowIndex.value >= 1 ? 'lmWindRect' : selectRowIndex.value <= 3 ? 'zdWindRect' : 'dsWindRect';
  559. await setModelType(type);
  560. loading.value = false;
  561. deviceRunState = ''
  562. tanTouRunState = ''
  563. getCamera()
  564. }
  565. };
  566. /* 一键测风 */
  567. function handleOk() {
  568. modalType.value = 'multiple'
  569. modalIsShow.value = true
  570. };
  571. /* 打开一键测风弹窗 */
  572. function openModel() {
  573. setModalProps({ visible: true });
  574. };
  575. function exportExcel(id) {
  576. // exportXls({ testid: id })
  577. }
  578. /* 关闭一键测风弹窗 */
  579. function handleCancel() {
  580. setModalProps({ visible: false });
  581. modalTable.value.clearSelectedRowKeys();
  582. };
  583. /* 关闭一键测风控制*/
  584. function handleCancelControl() {
  585. modalIsShow.value = false
  586. };
  587. function controlDevice(passWord, type) {
  588. if(type == 'sing'){
  589. testWind({ ids: [selectData.deviceID], maxnum: runNum.value, password: passWord }).then((res) => {
  590. message.success('开始测风。。。');
  591. });
  592. }else if(type == 'multiple'){
  593. const ids = toRaw(modalTable.value.selectedRowKeys);
  594. testWind({ ids: ids, maxnum: runNum.value, password: passWord }).then((res) => {
  595. message.success(res);
  596. setModalProps({ visible: false });
  597. modalTable.value.clearSelectedRowKeys();
  598. });
  599. }else if(type == 'autoClear') {
  600. const data = {
  601. deviceid: selectData.deviceID,
  602. devicetype: selectData.deviceType,
  603. paramcode: 'autoClear',
  604. value: null,
  605. password: passWord,
  606. masterComputer: selectData.masterComputer,
  607. };
  608. deviceControlApi(data)
  609. .then((res) => {
  610. // 模拟时开启
  611. if (res.success) {
  612. message.success('自清洁功能启动成功!')
  613. }
  614. })
  615. }
  616. }
  617. /** 避灾路线上的测风装置 */
  618. async function getPathList() {
  619. const pathArr = await pathList({});
  620. criticalPathList.value = pathArr.records.filter((item) => {
  621. return item.strsystype == 3;
  622. });
  623. };
  624. /* 根据路线选择测风装置 */
  625. function selectCriticalPath(pathId) {
  626. deviceList({ deviceType: 'wind', sysId: pathId }).then((res) => {
  627. const ids: string[] = [];
  628. res.records.forEach((item) => {
  629. ids.push(item.id);
  630. });
  631. if (modalTable.value) modalTable.value.setSelectedRowKeys(ids);
  632. });
  633. };
  634. onBeforeMount(() => {
  635. getPathList();
  636. });
  637. onMounted(() => {
  638. loading.value = true;
  639. mountedThree().then(async () => {
  640. getMonitor(true);
  641. // loading.value = false;
  642. });
  643. });
  644. onUnmounted(() => {
  645. destroy();
  646. if (timer) {
  647. clearTimeout(timer);
  648. timer = undefined;
  649. }
  650. if (webRtcServer.length > 0) {
  651. webRtcServer.forEach(item => {
  652. item.disconnect()
  653. })
  654. }
  655. });
  656. </script>
  657. <style scoped lang="less">
  658. @import '/@/design/vent/modal.less';
  659. @ventSpace: zxm;
  660. :deep(.@{ventSpace}-tabs-tabpane-active) {
  661. height: 100%;
  662. }
  663. .head-line {
  664. display: flex;
  665. flex-direction: row;
  666. justify-content: space-between;
  667. .button-box {
  668. position: relative;
  669. padding: 5px;
  670. border: 1px transparent solid;
  671. border-radius: 5px;
  672. margin-left: 8px;
  673. margin-right: 8px;
  674. width: auto;
  675. height: 34px;
  676. border: 1px solid #65dbea;
  677. display: flex;
  678. align-items: center;
  679. justify-content: center;
  680. color: #fff;
  681. padding: 0 15px;
  682. cursor: pointer;
  683. pointer-events: auto;
  684. &:hover {
  685. background: linear-gradient(#3eb2ff55, #00c3ff55);
  686. }
  687. &::before {
  688. width: calc(100% - 6px);
  689. height: 26px;
  690. content: '';
  691. position: absolute;
  692. top: 3px;
  693. right: 0;
  694. left: 3px;
  695. bottom: 0;
  696. z-index: -1;
  697. border-radius: inherit; /*important*/
  698. background: linear-gradient(#014978, #3bf3fc);
  699. }
  700. }
  701. }
  702. </style>