index.vue 29 KB

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