index.vue 28 KB

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