index.vue 27 KB

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