index.vue 28 KB

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