index.vue 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794
  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="实时监测111">
  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 v-if="globalConfig?.simulatedPassword" 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 loading autoplay controls loop fluent/>
  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 ''
  207. return `/video/wind.mp4`;
  208. };
  209. const tabChange = (activeKeyVal) => {
  210. activeKey.value = activeKeyVal;
  211. if (activeKeyVal == 1) {
  212. nextTick(() => {
  213. MonitorDataTable.value.setSelectedRowKeys([selectData.deviceID])
  214. })
  215. }
  216. };
  217. // 设备数据
  218. const controlType = ref(1);
  219. //表单赋值
  220. const [registerModal, { setModalProps, closeModal }] = useModalInner();
  221. // https获取监测数据
  222. let timer: null | NodeJS.Timeout = null;
  223. function getMonitor(flag?) {
  224. if (timer == null) {
  225. timer = setTimeout(() => {
  226. list({ devicetype: 'windrect', pagetype: 'normal' }).then((res) => {
  227. if(res && res.msgTxt[0]){
  228. dataSource.value = res.msgTxt[0].datalist || [];
  229. if (dataSource.value.length > 0) {
  230. dataSource.value.forEach((data: any) => {
  231. const readData = data.readData;
  232. data = Object.assign(data, readData);
  233. });
  234. if (dataSource.value.length > 0 && selectRowIndex.value == -1) {
  235. // 初始打开页面
  236. if (currentRoute.value && currentRoute.value['query'] && currentRoute.value['query']['id']) {
  237. MonitorDataTable.value.setSelectedRowKeys([currentRoute.value['query']['id']])
  238. } else {
  239. MonitorDataTable.value.setSelectedRowKeys([dataSource.value[0]['deviceID']])
  240. }
  241. }
  242. const data: any = toRaw(dataSource.value[selectRowIndex.value]); //maxarea
  243. Object.assign(selectData, data);
  244. addMonitorText(selectData);
  245. palyAnimation(selectData)
  246. }
  247. }
  248. if (timer) {
  249. timer = null;
  250. }
  251. getMonitor();
  252. });
  253. }, flag ? 0 : 1000);
  254. }
  255. };
  256. let deviceRunState = '', tanTouRunState= '';
  257. // 根据3个点位分别执行动画
  258. function palyAnimation(selectData) {
  259. if (selectData.deviceType == "windrect_normal") {
  260. if (selectData['apparatusRun'] == 1) {
  261. const flag = selectData.sign == 0 ? 'up' : selectData.sign == 1 ? 'center' : selectData.sign == 2 ? 'down' : null
  262. if (flag) play(flag);
  263. } else {
  264. const flag = selectData.sign == 1 ? 'center' : selectData.sign == 2 ? 'down' : null
  265. if (flag) play(flag, true);
  266. }
  267. }
  268. // 运行中是0,运行到达是1
  269. if (selectData.deviceType == "windrect_rect_single") {
  270. if(selectData['apparatusRun'] == 1){
  271. // 镜头指向横杆
  272. // if(!deviceRunState && !tanTouRunState)playCamera('start')
  273. // 正在执行或是开始执行
  274. //开始执行时,
  275. // selectData['poleIncipient'] == 1 selectData.sensorMiddle == 1 代表可是执行 或是 执行结束
  276. // 1. selectData['poleIncipient'] == 1 selectData.sensorMiddle == 1, 执行 play('up', true),play('middle', true)
  277. // 2. 探头左移play('left')
  278. // 3. 探头右移play('right')
  279. // 4. 横杆向中位移动,探头在右边
  280. // 5. 探头移到中间play('middle')
  281. // 6. 探头移到左边play('left')
  282. // 7. 横杆向低位移动,探头在左边
  283. // 8. 探头移到中间play('middle')
  284. // 9. 探头右移play('right')
  285. // 10. 测风结束,探头移到中间play('middle'),横杆向高位移动
  286. if(selectData['poleIncipient'] == 1){
  287. // 横杆在高位,开始执行 或是 执行结束
  288. if(selectData.sensorMiddle == 1 && !deviceRunState && !tanTouRunState){
  289. // 1. 开始执行
  290. deviceRunState = 'up'
  291. tanTouRunState= 'middle'
  292. play('up', true)
  293. play('middle', true)
  294. }
  295. if (deviceRunState == 'up-m') {
  296. play('up', true)
  297. play('middle', true)
  298. deviceRunState = ''
  299. tanTouRunState = ''
  300. playCamera('end')
  301. }
  302. // 初始已经在运行
  303. if(selectData.sensorLeft == 0 && selectData.sensorMiddle == 0 && selectData.sensorRight == 0) {
  304. //2.探头左移play('left')
  305. if(tanTouRunState == 'middle'){
  306. tanTouRunState = 'left-m'
  307. play('left')
  308. }
  309. //3. 探头右移play('right')
  310. if (tanTouRunState == 'left') {
  311. tanTouRunState = 'right-m'
  312. play('right')
  313. }
  314. }
  315. if(selectData.sensorLeft == 1){
  316. tanTouRunState = 'left'
  317. if (!tanTouRunState || tanTouRunState == 'left-m') {
  318. play('left', true)
  319. }
  320. }
  321. if (selectData.sensorRight == 1) {
  322. tanTouRunState = 'right'
  323. if (!tanTouRunState || tanTouRunState == 'right-m') {
  324. play('right', true)
  325. }
  326. }
  327. }else if (selectData['poleMiddle'] == 1) {
  328. if(deviceRunState == 'center-m'){
  329. play('center', true)
  330. deviceRunState = 'center'
  331. tanTouRunState = 'right'
  332. play('right', true)
  333. }
  334. if (!deviceRunState) {
  335. deviceRunState = 'center'
  336. play('center', true)
  337. }
  338. if (!tanTouRunState) {
  339. play('right', true)
  340. }
  341. // 横杆在中位
  342. if (selectData.sensorLeft == 0 && selectData.sensorMiddle == 0 && selectData.sensorRight == 0) {
  343. //5. 探头移到中间play('middle')
  344. if (tanTouRunState == 'right') {
  345. tanTouRunState = 'middle-m'
  346. play('middle')
  347. }
  348. //6. 探头移到左边play('left')
  349. if (tanTouRunState == 'middle') {
  350. tanTouRunState = 'left-m'
  351. play('left')
  352. }
  353. }
  354. if (selectData.sensorMiddle == 1) {
  355. tanTouRunState = 'middle'
  356. if (!tanTouRunState || tanTouRunState == 'middle-m') {
  357. play('middle', true)
  358. }
  359. }
  360. if (selectData.sensorLeft == 1) {
  361. tanTouRunState = 'left'
  362. if (!tanTouRunState || tanTouRunState == 'left-m') {
  363. play('left', true)
  364. }
  365. }
  366. }else if (selectData['poleNether'] == 1) {
  367. if (deviceRunState == 'down-m') {
  368. play('down', true)
  369. deviceRunState = 'down'
  370. tanTouRunState = 'left'
  371. play('left', true)
  372. }
  373. if(!deviceRunState) {
  374. play('down', true)
  375. deviceRunState = 'down'
  376. }
  377. if (!tanTouRunState) {
  378. play('left', true)
  379. }
  380. // 横杆在低位
  381. if (selectData.sensorLeft == 0 && selectData.sensorMiddle == 0 && selectData.sensorRight == 0) {
  382. //8. 探头移到中间play('middle')
  383. if (tanTouRunState == 'left') {
  384. tanTouRunState = 'left-middle-m'
  385. play('middle')
  386. }
  387. //9. 探头右移play('right')
  388. if (tanTouRunState == 'middle1') {
  389. tanTouRunState = 'right-m'
  390. play('right')
  391. }
  392. // 10. 测风结束,探头移到中间play('middle'),横杆向高位移动
  393. if (tanTouRunState == 'right') {
  394. tanTouRunState = 'right-middle-m'
  395. play('middle')
  396. }
  397. }
  398. if (selectData.sensorMiddle == 1) {
  399. if(tanTouRunState == 'left-middle-m')tanTouRunState = 'middle1'
  400. if (tanTouRunState == 'right-middle-m') tanTouRunState = 'middle2'
  401. if (!tanTouRunState || tanTouRunState == 'left-middle-m' || tanTouRunState == 'right-middle-m') {
  402. play('middle', true)
  403. }
  404. }
  405. if (selectData.sensorRight == 1) {
  406. tanTouRunState = 'right'
  407. if (!tanTouRunState || tanTouRunState == 'right-m') {
  408. play('right', true)
  409. }
  410. }
  411. }else {
  412. // 横杆正在运行
  413. if(deviceRunState == 'up'){
  414. deviceRunState = 'center-m'
  415. play('center')
  416. }
  417. if (deviceRunState == 'center') {
  418. deviceRunState = 'down-m'
  419. play('down')
  420. }
  421. if (deviceRunState == 'down') {
  422. deviceRunState = 'up-m'
  423. play('up')
  424. }
  425. }
  426. // //正在执行时
  427. // // 判断上中下是否都为0
  428. // if(selectData['poleIncipient'] == 0 && selectData['poleMiddle'] == 0 && selectData['poleNether'] == 0) {
  429. // // 判断是否有前一个状态值,有的话执行
  430. // //没有前一个状态
  431. // //有前一个状态
  432. // // 横杆前状态在上位时,横杆中位移动,探头在右边
  433. // // 横杆前状态在中位时,横杆下位移动,探头在左边
  434. // // 横杆前状态在下位时,横杆上位移动,探头在中间
  435. // }else{
  436. // // 判断当前动画停在固定位置
  437. // if(selectData['poleIncipient'] == 1) {
  438. // // 滑杆停在上面,探头在中间
  439. // }else if (selectData['poleMiddle'] == 1) {
  440. // // 滑杆停在中间面,初始探头在右边
  441. // } else if (selectData['poleNether'] == 1) {
  442. // // 滑杆停在下面,初始探头在左边
  443. // }
  444. // }
  445. }else {
  446. // if(selectData['poleIncipient'] == 1){
  447. // deviceRunState = ''
  448. // tanTouRunState = ''
  449. // }
  450. }
  451. }
  452. if (selectData.deviceType == "windrect_rect") {
  453. if (selectData['apparatusRun'] == 1) {
  454. const flag = selectData.sign == 0 ? 'center' : selectData.sign == 1 ? 'down' : selectData.sign == 2 ? 'up' : null
  455. if (flag) play(flag);
  456. } else {
  457. const flag = selectData.sign == 1 ? 'center' : selectData.sign == 2 ? 'down' : selectData.sign == 0 ? 'up' : null
  458. if (flag) play(flag, true);
  459. }
  460. }
  461. if (selectData.deviceType == "windrect_ds") {
  462. if (selectData['apparatusRun'] == 1) {
  463. if(!deviceRunState) {
  464. deviceRunState = 'start'
  465. play('start')
  466. }
  467. } else {
  468. deviceRunState = ''
  469. play('start', true)
  470. }
  471. }
  472. }
  473. // 自测动画方法
  474. function testPlay(flag) {
  475. if (selectData.deviceType == 'windrect_rect') {
  476. setTimeout(() => {
  477. play('center')
  478. }, 0)
  479. setTimeout(() => {
  480. play('down')
  481. }, 4000)
  482. setTimeout(() => {
  483. play('up')
  484. }, 10000)
  485. }
  486. if(selectData.deviceType == 'windrect_normal') {
  487. setTimeout(() => {
  488. play('up')
  489. }, 0)
  490. setTimeout(() => {
  491. play('center')
  492. }, 10000)
  493. setTimeout(() => {
  494. play('down')
  495. }, 18000)
  496. setTimeout(() => {
  497. play('up')
  498. }, 21000)
  499. }
  500. if(selectData.deviceType == 'windrect_ds') {
  501. play('moni')
  502. }
  503. };
  504. function clearPlay() {
  505. modalType.value = 'autoClear'
  506. modalIsShow.value = true
  507. if (globalConfig?.simulatedPassword) {
  508. controlDevice('', modalType.value)
  509. }
  510. }
  511. function startRun() {
  512. modalType.value = 'sing'
  513. modalIsShow.value = true
  514. if (globalConfig?.simulatedPassword) {
  515. controlDevice('', modalType.value)
  516. }
  517. }
  518. async function getCamera() {
  519. const res = await cameraList({ deviceid: selectData['deviceID'] })
  520. const cameras: [] = res.records || []
  521. let cameraAddrs: any[] = [], cameraNames: string[] = [];
  522. if (cameras.length > 0) {
  523. cameras.forEach(item => {
  524. if (item['devicekind'] == 'toRtsp' || item['devicekind'] == 'toHLS') {
  525. cameraNames.push(item['name'])
  526. } else {
  527. cameraAddrs.push({ name: item['name'], addr: item['addr'] })
  528. }
  529. })
  530. }
  531. if (cameraNames.length > 0) {
  532. // 请求接口从装备院拿数据
  533. const addrs: string[] = await cameraAddrList({ cameraNameList: cameraNames })
  534. for (let i = 0; i < addrs.length; i++) {
  535. cameraAddrs.push({ name: '摄像头' + i, addr: addrs[i] })
  536. }
  537. }
  538. const obj = await deviceCameraInit(cameraAddrs, playerRef.value, webRtcServer)
  539. webRtcServer = obj.webRtcServerList
  540. const playerDoms = obj.playerDoms
  541. // 注意前后门适应需要对应 //[0] 后门 [1]前门
  542. await initCameraCanvas(...playerDoms)
  543. }
  544. // 切换检测数据
  545. async function getSelectRow(selectRow, index) {
  546. if(selectRow){
  547. loading.value = true;
  548. selectRowIndex.value = index;
  549. Object.assign(selectData, selectRow);
  550. let type = ''
  551. if(selectRow.deviceType == 'windrect_rect') {
  552. type = 'lmWindRect'
  553. }
  554. if (selectRow.deviceType == 'windrect_normal') {
  555. type = 'zdWindRect'
  556. }
  557. if (selectRow.deviceType == 'windrect_rect_single') {
  558. type = 'lmWindSide'
  559. }
  560. if (selectRow.deviceType == 'windrect_ds') {
  561. type = 'dsWindRect_move'
  562. }
  563. if (selectRow.deviceType == 'windrect_ds_four') {
  564. type = 'dsWindRect_four'
  565. }
  566. if (selectRow.deviceType == 'windrect_ds_two') {
  567. // type = 'dsWindRect_two'
  568. type = 'duisheFixed'
  569. }
  570. if (selectRow.deviceType == 'windrect_dd' || selectRow.deviceType == 'windrect_safety') {
  571. type = 'ddWindSide'
  572. }
  573. // const type = selectRowIndex.value >= 1 ? 'lmWindRect' : selectRowIndex.value <= 3 ? 'zdWindRect' : 'dsWindRect';
  574. await setModelType(type);
  575. loading.value = false;
  576. deviceRunState = ''
  577. tanTouRunState = ''
  578. getCamera()
  579. }
  580. };
  581. /* 一键测风 */
  582. function handleOk() {
  583. modalType.value = 'multiple'
  584. modalIsShow.value = true
  585. if (globalConfig?.simulatedPassword) {
  586. controlDevice('', modalType.value)
  587. }
  588. };
  589. /* 打开一键测风弹窗 */
  590. function openModel() {
  591. setModalProps({ visible: true });
  592. };
  593. function exportExcel(id) {
  594. exportXls({ testid: id })
  595. }
  596. /* 关闭一键测风弹窗 */
  597. function handleCancel() {
  598. setModalProps({ visible: false });
  599. modalTable.value.clearSelectedRowKeys();
  600. };
  601. /* 关闭一键测风控制*/
  602. function handleCancelControl() {
  603. modalIsShow.value = false
  604. };
  605. function controlDevice(passWord, type) {
  606. if(type == 'sing'){
  607. testWind({ ids: [selectData.deviceID], maxnum: runNum.value, password: passWord }).then((res) => {
  608. message.success('开始测风。。。');
  609. });
  610. }else if(type == 'multiple'){
  611. const ids = toRaw(modalTable.value.selectedRowKeys);
  612. testWind({ ids: ids, maxnum: runNum.value, password: passWord }).then((res) => {
  613. message.success(res);
  614. setModalProps({ visible: false });
  615. modalTable.value.clearSelectedRowKeys();
  616. });
  617. }else if(type == 'autoClear') {
  618. const data = {
  619. deviceid: selectData.deviceID,
  620. devicetype: selectData.deviceType,
  621. paramcode: 'autoClear',
  622. value: null,
  623. password: passWord,
  624. masterComputer: selectData.masterComputer,
  625. };
  626. deviceControlApi(data)
  627. .then((res) => {
  628. // 模拟时开启
  629. if (res.success) {
  630. if (globalConfig.History_Type == 'remote') {
  631. message.success('指令已下发至生产管控平台成功!')
  632. } else {
  633. message.success('指令已下发成功!')
  634. }
  635. }
  636. })
  637. }
  638. }
  639. /** 避灾路线上的测风装置 */
  640. async function getPathList() {
  641. const pathArr = await pathList({});
  642. criticalPathList.value = pathArr.records.filter((item) => {
  643. return item.strsystype == 3;
  644. });
  645. };
  646. /* 根据路线选择测风装置 */
  647. function selectCriticalPath(pathId) {
  648. deviceList({ deviceType: 'wind', sysId: pathId }).then((res) => {
  649. const ids: string[] = [];
  650. res.records.forEach((item) => {
  651. ids.push(item.id);
  652. });
  653. if (modalTable.value) modalTable.value.setSelectedRowKeys(ids);
  654. });
  655. };
  656. onBeforeMount(() => {
  657. getPathList();
  658. });
  659. onMounted(() => {
  660. const playerDom = document.getElementById('cf-player1')?.getElementsByClassName('vjs-tech')[0]
  661. loading.value = true;
  662. mountedThree(playerDom).then(async () => {
  663. getMonitor(true);
  664. // loading.value = false;
  665. });
  666. });
  667. onUnmounted(() => {
  668. destroy();
  669. if (timer) {
  670. clearTimeout(timer);
  671. timer = undefined;
  672. }
  673. if (webRtcServer.length > 0) {
  674. webRtcServer.forEach(item => {
  675. item.disconnect()
  676. })
  677. }
  678. });
  679. </script>
  680. <style scoped lang="less">
  681. @import '/@/design/vent/modal.less';
  682. @ventSpace: zxm;
  683. :deep(.@{ventSpace}-tabs-tabpane-active) {
  684. height: 100%;
  685. }
  686. .scene-box{
  687. .bottom-tabs-box{
  688. height: 350px;
  689. }
  690. }
  691. .head-line {
  692. display: flex;
  693. flex-direction: row;
  694. justify-content: space-between;
  695. .button-box {
  696. position: relative;
  697. padding: 5px;
  698. border: 1px transparent solid;
  699. border-radius: 5px;
  700. margin-left: 8px;
  701. margin-right: 8px;
  702. width: auto;
  703. height: 34px;
  704. border: 1px solid #65dbea;
  705. display: flex;
  706. align-items: center;
  707. justify-content: center;
  708. color: #fff;
  709. padding: 0 15px;
  710. cursor: pointer;
  711. pointer-events: auto;
  712. &:hover {
  713. background: linear-gradient(#3eb2ff55, #00c3ff55);
  714. }
  715. &::before {
  716. width: calc(100% - 6px);
  717. height: 26px;
  718. content: '';
  719. position: absolute;
  720. top: 3px;
  721. right: 0;
  722. left: 3px;
  723. bottom: 0;
  724. z-index: -1;
  725. border-radius: inherit; /*important*/
  726. background: linear-gradient(#014978, #3bf3fc);
  727. }
  728. }
  729. }
  730. </style>