index.vue 28 KB

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