index.vue 28 KB

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