index.vue 28 KB

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