index.vue 29 KB

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