index.vue 29 KB

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