index.vue 27 KB

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