index.vue 28 KB

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