index.vue 28 KB

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