index.vue 28 KB

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