index.vue 29 KB

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