index.vue 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867
  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 v-if="sysOrgCode != 'xjttzhqmk'" key="7" tab="报警次数统计">
  117. <div class="tab-item" v-if="activeKey === '7'">
  118. <AlarmNumTable columns-type="alarmNum" :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. import { useGlobSetting } from '/@/hooks/setting';
  178. const { hasPermission } = usePermission();
  179. const globalConfig = inject('globalConfig');
  180. const { sysOrgCode } = useGlobSetting();
  181. const { currentRoute } = useRouter();
  182. const MonitorDataTable = ref();
  183. const scroll = reactive({
  184. y: 230,
  185. });
  186. const modalType = ref('');
  187. const modalIsShow = ref(false);
  188. const modalTable = ref();
  189. const runNum = ref(5); //设备运行数量
  190. const criticalPathList = ref([]);
  191. const playerRef = ref();
  192. const activeKey = ref('1');
  193. const loading = ref(false);
  194. // 默认初始是第一行
  195. const selectRowIndex = ref(-1);
  196. // 监测数据
  197. const selectData = reactive({
  198. deviceID: '',
  199. deviceType: '',
  200. strname: '',
  201. dataDh: '-', //压差
  202. dataDtestq: '-', //测试风量
  203. // sourcePressure: '-', //气源压力
  204. dataDequivalarea: '-',
  205. netStatus: '0', //通信状态
  206. fault: '气源压力超限',
  207. sign: -1,
  208. sensorRight: 0,
  209. sensorMiddle: 1,
  210. sensorLeft: 0,
  211. });
  212. const deviceType = ref('windrect');
  213. const deviceId = ref('');
  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: deviceType.value, pagetype: 'normal' }).then((res) => {
  244. if (res && res.msgTxt[0]) {
  245. // dataSource.value = res.msgTxt[0].datalist || [];
  246. const getData = res.msgTxt[0].datalist || [];
  247. getData.forEach((data) => {
  248. if (data.regulation) {
  249. const testRegulation = JSON.parse(data.regulation);
  250. data.fmin = testRegulation.fmin;
  251. data.fmax = testRegulation.fmax;
  252. }
  253. });
  254. dataSource.value = getData;
  255. if (dataSource.value.length > 0) {
  256. dataSource.value.forEach((data: any) => {
  257. const readData = data.readData;
  258. data = Object.assign(data, readData);
  259. });
  260. if (dataSource.value.length > 0 && selectRowIndex.value == -1) {
  261. // 初始打开页面
  262. if (currentRoute.value && currentRoute.value['query'] && currentRoute.value['query']['id']) {
  263. MonitorDataTable.value.setSelectedRowKeys([currentRoute.value['query']['id']]);
  264. } else {
  265. MonitorDataTable.value.setSelectedRowKeys([dataSource.value[0]['deviceID']]);
  266. }
  267. });
  268. dataSource.value = getData;
  269. if (dataSource.value.length > 0) {
  270. dataSource.value.forEach((data: any) => {
  271. const readData = data.readData;
  272. data = Object.assign(data, readData);
  273. });
  274. if (dataSource.value.length > 0 && selectRowIndex.value == -1) {
  275. // 初始打开页面
  276. if (currentRoute.value && currentRoute.value['query'] && currentRoute.value['query']['id']) {
  277. MonitorDataTable.value.setSelectedRowKeys([currentRoute.value['query']['id']]);
  278. } else {
  279. MonitorDataTable.value.setSelectedRowKeys([dataSource.value[0]['deviceID']]);
  280. }
  281. }
  282. const data: any = toRaw(dataSource.value[selectRowIndex.value]); //maxarea
  283. Object.assign(selectData, data);
  284. addMonitorText(selectData);
  285. palyAnimation(selectData);
  286. }
  287. }
  288. if (timer) {
  289. timer = null;
  290. }
  291. getMonitor();
  292. });
  293. },
  294. flag ? 0 : 1000
  295. );
  296. }
  297. }
  298. let deviceRunState = '',
  299. tanTouRunState = '';
  300. // 根据3个点位分别执行动画
  301. function palyAnimation(selectData) {
  302. if (selectData.deviceType == 'windrect_normal') {
  303. if (selectData['apparatusRun'] == 1) {
  304. const flag = selectData.sign == '0' ? 'up' : selectData.sign == 1 ? 'center' : selectData.sign == 2 ? 'down' : null;
  305. if (flag) play(flag);
  306. } else {
  307. const flag = selectData.sign == 1 ? 'center' : selectData.sign == 2 ? 'down' : null;
  308. if (flag) play(flag, true);
  309. }
  310. }
  311. // 运行中是0,运行到达是1
  312. if (selectData.deviceType == 'windrect_rect_single') {
  313. if (selectData['apparatusRun'] == 1) {
  314. // 镜头指向横杆
  315. // if(!deviceRunState && !tanTouRunState)playCamera('start')
  316. // 正在执行或是开始执行
  317. //开始执行时,
  318. // selectData['poleIncipient'] == 1 selectData.sensorMiddle == 1 代表可是执行 或是 执行结束
  319. // 1. selectData['poleIncipient'] == 1 selectData.sensorMiddle == 1, 执行 play('up', true),play('middle', true)
  320. // 2. 探头左移play('left')
  321. // 3. 探头右移play('right')
  322. // 4. 横杆向中位移动,探头在右边
  323. // 5. 探头移到中间play('middle')
  324. // 6. 探头移到左边play('left')
  325. // 7. 横杆向低位移动,探头在左边
  326. // 8. 探头移到中间play('middle')
  327. // 9. 探头右移play('right')
  328. // 10. 测风结束,探头移到中间play('middle'),横杆向高位移动
  329. if (selectData['poleIncipient'] == 1) {
  330. // 横杆在高位,开始执行 或是 执行结束
  331. if (selectData.sensorMiddle == 1 && !deviceRunState && !tanTouRunState) {
  332. // 1. 开始执行
  333. deviceRunState = 'up';
  334. tanTouRunState = 'middle';
  335. play('up', true);
  336. play('middle', true);
  337. }
  338. if (deviceRunState == 'up-m') {
  339. play('up', true);
  340. play('middle', true);
  341. deviceRunState = '';
  342. tanTouRunState = '';
  343. playCamera('end');
  344. }
  345. // 初始已经在运行
  346. if (selectData.sensorLeft == '0' && selectData.sensorMiddle == '0' && selectData.sensorRight == '0') {
  347. //2.探头左移play('left')
  348. if (tanTouRunState == 'middle') {
  349. tanTouRunState = 'left-m';
  350. play('left');
  351. }
  352. //3. 探头右移play('right')
  353. if (tanTouRunState == 'left') {
  354. tanTouRunState = 'right-m';
  355. play('right');
  356. }
  357. }
  358. if (selectData.sensorLeft == 1) {
  359. tanTouRunState = 'left';
  360. if (!tanTouRunState || tanTouRunState == 'left-m') {
  361. play('left', true);
  362. }
  363. }
  364. if (selectData.sensorRight == 1) {
  365. tanTouRunState = 'right';
  366. if (!tanTouRunState || tanTouRunState == 'right-m') {
  367. play('right', true);
  368. }
  369. }
  370. } else if (selectData['poleMiddle'] == 1) {
  371. if (deviceRunState == 'center-m') {
  372. play('center', true);
  373. deviceRunState = 'center';
  374. tanTouRunState = 'right';
  375. play('right', true);
  376. }
  377. if (!deviceRunState) {
  378. deviceRunState = 'center';
  379. play('center', true);
  380. }
  381. if (!tanTouRunState) {
  382. play('right', true);
  383. }
  384. // 横杆在中位
  385. if (selectData.sensorLeft == '0' && selectData.sensorMiddle == '0' && selectData.sensorRight == '0') {
  386. //5. 探头移到中间play('middle')
  387. if (tanTouRunState == 'right') {
  388. tanTouRunState = 'middle-m';
  389. play('middle');
  390. }
  391. //6. 探头移到左边play('left')
  392. if (tanTouRunState == 'middle') {
  393. tanTouRunState = 'left-m';
  394. play('left');
  395. }
  396. }
  397. if (selectData.sensorMiddle == 1) {
  398. tanTouRunState = 'middle';
  399. if (!tanTouRunState || tanTouRunState == 'middle-m') {
  400. play('middle', true);
  401. }
  402. }
  403. if (selectData.sensorLeft == 1) {
  404. tanTouRunState = 'left';
  405. if (!tanTouRunState || tanTouRunState == 'left-m') {
  406. play('left', true);
  407. }
  408. }
  409. } else if (selectData['poleNether'] == 1) {
  410. if (deviceRunState == 'down-m') {
  411. play('down', true);
  412. deviceRunState = 'down';
  413. tanTouRunState = 'left';
  414. play('left', true);
  415. }
  416. if (!deviceRunState) {
  417. play('down', true);
  418. deviceRunState = 'down';
  419. }
  420. if (!tanTouRunState) {
  421. play('left', true);
  422. }
  423. // 横杆在低位
  424. if (selectData.sensorLeft == '0' && selectData.sensorMiddle == '0' && selectData.sensorRight == '0') {
  425. //8. 探头移到中间play('middle')
  426. if (tanTouRunState == 'left') {
  427. tanTouRunState = 'left-middle-m';
  428. play('middle');
  429. }
  430. //9. 探头右移play('right')
  431. if (tanTouRunState == 'middle1') {
  432. tanTouRunState = 'right-m';
  433. play('right');
  434. }
  435. // 10. 测风结束,探头移到中间play('middle'),横杆向高位移动
  436. if (tanTouRunState == 'right') {
  437. tanTouRunState = 'right-middle-m';
  438. play('middle');
  439. }
  440. }
  441. if (selectData.sensorMiddle == 1) {
  442. if (tanTouRunState == 'left-middle-m') tanTouRunState = 'middle1';
  443. if (tanTouRunState == 'right-middle-m') tanTouRunState = 'middle2';
  444. if (!tanTouRunState || tanTouRunState == 'left-middle-m' || tanTouRunState == 'right-middle-m') {
  445. play('middle', true);
  446. }
  447. }
  448. if (selectData.sensorRight == 1) {
  449. tanTouRunState = 'right';
  450. if (!tanTouRunState || tanTouRunState == 'right-m') {
  451. play('right', true);
  452. }
  453. }
  454. } else {
  455. // 横杆正在运行
  456. if (deviceRunState == 'up') {
  457. deviceRunState = 'center-m';
  458. play('center');
  459. }
  460. if (deviceRunState == 'center') {
  461. deviceRunState = 'down-m';
  462. play('down');
  463. }
  464. if (deviceRunState == 'down') {
  465. deviceRunState = 'up-m';
  466. play('up');
  467. }
  468. }
  469. // //正在执行时
  470. // // 判断上中下是否都为0
  471. // if(selectData['poleIncipient'] == 0 && selectData['poleMiddle'] == 0 && selectData['poleNether'] == 0) {
  472. // // 判断是否有前一个状态值,有的话执行
  473. // //没有前一个状态
  474. // //有前一个状态
  475. // // 横杆前状态在上位时,横杆中位移动,探头在右边
  476. // // 横杆前状态在中位时,横杆下位移动,探头在左边
  477. // // 横杆前状态在下位时,横杆上位移动,探头在中间
  478. // }else{
  479. // // 判断当前动画停在固定位置
  480. // if(selectData['poleIncipient'] == 1) {
  481. // // 滑杆停在上面,探头在中间
  482. // }else if (selectData['poleMiddle'] == 1) {
  483. // // 滑杆停在中间面,初始探头在右边
  484. // } else if (selectData['poleNether'] == 1) {
  485. // // 滑杆停在下面,初始探头在左边
  486. // }
  487. // }
  488. } else {
  489. // if(selectData['poleIncipient'] == 1){
  490. // deviceRunState = ''
  491. // tanTouRunState = ''
  492. // }
  493. }
  494. }
  495. if (selectData.deviceType == 'windrect_rect') {
  496. if (selectData['apparatusRun'] == 1) {
  497. const flag = selectData.sign == '0' ? 'center' : selectData.sign == 1 ? 'down' : selectData.sign == 2 ? 'up' : null;
  498. if (flag) play(flag);
  499. } else {
  500. const flag = selectData.sign == 1 ? 'center' : selectData.sign == 2 ? 'down' : selectData.sign == '0' ? 'up' : null;
  501. if (flag) play(flag, true);
  502. }
  503. }
  504. if (selectData.deviceType == 'windrect_ds') {
  505. if (selectData['apparatusRun'] == 1 && selectData['sign'] == 2) {
  506. if (!deviceRunState) {
  507. deviceRunState = 'start';
  508. play('down');
  509. }
  510. } else if (selectData['apparatusRun'] == 0 && selectData['sign'] == 0 && deviceRunState == 'start') {
  511. deviceRunState = '';
  512. play('up');
  513. }
  514. }
  515. }
  516. // 自测动画方法
  517. function testPlay(flag) {
  518. if (selectData.deviceType == 'windrect_rect') {
  519. setTimeout(() => {
  520. play('center');
  521. }, 0);
  522. setTimeout(() => {
  523. play('down');
  524. }, 4000);
  525. setTimeout(() => {
  526. play('up');
  527. }, 10000);
  528. }
  529. if (selectData.deviceType == 'windrect_normal') {
  530. setTimeout(() => {
  531. play('up');
  532. }, 0);
  533. setTimeout(() => {
  534. play('center');
  535. }, 10000);
  536. setTimeout(() => {
  537. play('down');
  538. }, 18000);
  539. setTimeout(() => {
  540. play('up');
  541. }, 21000);
  542. }
  543. if (selectData.deviceType == 'windrect_ds') {
  544. play('moni');
  545. }
  546. }
  547. function clearPlay() {
  548. modalType.value = 'autoClear';
  549. modalIsShow.value = true;
  550. if (globalConfig?.simulatedPassword) {
  551. controlDevice('', modalType.value);
  552. }
  553. }
  554. function startRun() {
  555. modalType.value = 'sing';
  556. modalIsShow.value = true;
  557. if (globalConfig?.simulatedPassword) {
  558. controlDevice('', modalType.value);
  559. }
  560. }
  561. // 切换检测数据
  562. async function getSelectRow(selectRow, index) {
  563. if (selectRow) {
  564. loading.value = true;
  565. selectRowIndex.value = index;
  566. Object.assign(selectData, selectRow);
  567. let type = '';
  568. if (selectRow['modelType']) {
  569. type = selectRow['modelType'];
  570. debugger;
  571. } else {
  572. if (selectRow.deviceType.startsWith('windrect_rect')) {
  573. type = 'lmWindRect';
  574. }
  575. if (selectRow.deviceType.startsWith('windrect_normal')) {
  576. type = 'zdWindRect';
  577. }
  578. if (selectRow.deviceType.startsWith('windrect_rect_single')) {
  579. type = 'lmWindSide';
  580. }
  581. if (selectRow.deviceType.startsWith('windrect_ds')) {
  582. type = 'dsWindRect_move';
  583. // type = 'duisheFixed';
  584. }
  585. if (selectRow.deviceType.startsWith('windrect_ds_four')) {
  586. //windrect_ds_two
  587. type = 'dsWindRect_four';
  588. }
  589. if (selectRow.deviceType.startsWith('windrect_ds_two')) {
  590. type = 'dsWindRect_two';
  591. }
  592. if (selectRow.deviceType.startsWith('windrect_ds_sut') || selectRow.deviceType.startsWith('windrect_muti')) {
  593. type = 'duisheFixed';
  594. }
  595. if (
  596. selectRow.deviceType.startsWith('windrect_dd') ||
  597. selectRow.deviceType == 'windrect_safety' ||
  598. selectRow.deviceType == 'windrect_sensor'
  599. ) {
  600. type = 'ddWindSide';
  601. }
  602. }
  603. // const type = selectRowIndex.value >= 1 ? 'lmWindRect' : selectRowIndex.value <= 3 ? 'zdWindRect' : 'dsWindRect';
  604. await setModelType(type);
  605. loading.value = false;
  606. deviceRunState = '';
  607. tanTouRunState = '';
  608. await getCamera(selectRow.deviceID, playerRef.value);
  609. }
  610. }
  611. /* 一键测风 */
  612. function handleOk() {
  613. modalType.value = 'multiple';
  614. modalIsShow.value = true;
  615. if (globalConfig?.simulatedPassword) {
  616. controlDevice('', modalType.value);
  617. }
  618. }
  619. /* 打开一键测风弹窗 */
  620. function openModel() {
  621. setModalProps({ visible: true });
  622. }
  623. function resetHandle() {
  624. modalType.value = 'resetWind';
  625. modalIsShow.value = true;
  626. }
  627. function exportExcel(id) {
  628. exportXls({ testid: id });
  629. }
  630. /* 关闭一键测风弹窗 */
  631. function handleCancel() {
  632. setModalProps({ visible: false });
  633. modalTable.value.clearSelectedRowKeys();
  634. }
  635. /* 关闭一键测风控制*/
  636. function handleCancelControl() {
  637. modalIsShow.value = false;
  638. }
  639. function controlDevice(passWord, type) {
  640. try {
  641. if (type == 'sing') {
  642. testWind({
  643. ids: [selectData.deviceID],
  644. maxnum: 1000,
  645. windnum: 1,
  646. password: passWord || globalConfig?.simulatedPassword,
  647. }).then((res) => {
  648. if (res && res.success === false) {
  649. message.error(res.message);
  650. } else {
  651. if (globalConfig.History_Type == 'remote') {
  652. message.success('指令已下发至生产管控平台成功!');
  653. } else {
  654. message.success('指令已下发成功!');
  655. }
  656. }
  657. modalIsShow.value = false;
  658. });
  659. } else if (type == 'multiple') {
  660. const ids = toRaw(modalTable.value.selectedRowKeys);
  661. testWind({
  662. ids: ids,
  663. maxnum: 1000,
  664. windnum: modalTable.value.selectedRowKeys.length,
  665. password: passWord || globalConfig?.simulatedPassword,
  666. }).then((res) => {
  667. if (res && res.success === false) {
  668. message.error(res.message);
  669. } else {
  670. if (globalConfig.History_Type == 'remote') {
  671. message.success('指令已下发至生产管控平台成功!');
  672. } else {
  673. message.success('指令已下发成功!');
  674. }
  675. }
  676. modalIsShow.value = false;
  677. setModalProps({ visible: false });
  678. modalTable.value.clearSelectedRowKeys();
  679. });
  680. } else if (type == 'autoClear') {
  681. const data = {
  682. deviceid: selectData.deviceID,
  683. devicetype: selectData.deviceType,
  684. paramcode: 'autoClear',
  685. value: null,
  686. password: passWord || globalConfig?.simulatedPassword,
  687. masterComputer: selectData.masterComputer,
  688. };
  689. deviceControlApi(data).then((res) => {
  690. // 模拟时开启
  691. if (res.success) {
  692. if (globalConfig.History_Type == 'remote') {
  693. message.success('指令已下发至生产管控平台成功!');
  694. } else {
  695. message.success('指令已下发成功!');
  696. }
  697. } else {
  698. message.error(res.message);
  699. }
  700. modalIsShow.value = false;
  701. });
  702. } else if (type == 'resetWind') {
  703. resetWind({}).then((res: any) => {
  704. message.info(res);
  705. });
  706. modalIsShow.value = false;
  707. }
  708. } catch (error) {
  709. message.error('测风失败,请联系管理员。。。');
  710. modalIsShow.value = false;
  711. }
  712. }
  713. /** 避灾路线上的测风装置 */
  714. async function getPathList() {
  715. const pathArr = await pathList({});
  716. criticalPathList.value = pathArr.records.filter((item) => {
  717. return item.strsystype == 3;
  718. });
  719. }
  720. /* 根据路线选择测风装置 */
  721. function selectCriticalPath(pathId) {
  722. deviceList({ deviceType: 'wind', sysId: pathId }).then((res) => {
  723. const ids: string[] = [];
  724. res.records.forEach((item) => {
  725. ids.push(item.id);
  726. });
  727. if (modalTable.value) modalTable.value.setSelectedRowKeys(ids);
  728. });
  729. }
  730. function deviceEdit(e: Event, type: string, record) {
  731. e.stopPropagation();
  732. openModal(true, {
  733. type,
  734. deviceId: record['deviceID'],
  735. });
  736. }
  737. onBeforeMount(() => {
  738. getPathList();
  739. });
  740. onMounted(async () => {
  741. // const playerDom = document.getElementById('cf-player1')?.getElementsByClassName('vjs-tech')[0];
  742. // loading.value = true;
  743. // mountedThree(playerDom).then(async () => {
  744. // getMonitor(true);
  745. // // loading.value = false;
  746. // });
  747. const { query } = unref(currentRoute);
  748. if (query['deviceType']) deviceType.value = query['deviceType'] as string;
  749. loading.value = true;
  750. mountedThree(null).then(async () => {
  751. await getMonitor(true);
  752. loading.value = false;
  753. });
  754. });
  755. onUnmounted(() => {
  756. removeCamera();
  757. if (timer) {
  758. clearTimeout(timer);
  759. timer = undefined;
  760. }
  761. destroy();
  762. });
  763. </script>
  764. <style scoped lang="less">
  765. @import '/@/design/theme.less';
  766. @import '/@/design/vent/modal.less';
  767. @ventSpace: zxm;
  768. :deep(.@{ventSpace}-tabs-tabpane-active) {
  769. height: 100%;
  770. }
  771. .scene-box {
  772. .bottom-tabs-box {
  773. height: 350px;
  774. }
  775. }
  776. .head-line {
  777. display: flex;
  778. flex-direction: row;
  779. justify-content: space-between;
  780. .button-box {
  781. position: relative;
  782. padding: 5px;
  783. border: 1px transparent solid;
  784. border-radius: 5px;
  785. margin-left: 8px;
  786. margin-right: 8px;
  787. width: auto;
  788. height: 34px;
  789. border: 1px solid var(--vent-base-border);
  790. display: flex;
  791. align-items: center;
  792. justify-content: center;
  793. color: var(--vent-font-color);
  794. padding: 0 15px;
  795. cursor: pointer;
  796. pointer-events: auto;
  797. &:hover {
  798. background: var(--vent-device-manager-control-btn-hover);
  799. }
  800. &::before {
  801. width: calc(100% - 6px);
  802. height: 26px;
  803. content: '';
  804. position: absolute;
  805. top: 3px;
  806. right: 0;
  807. left: 3px;
  808. bottom: 0;
  809. z-index: -1;
  810. border-radius: inherit; /*important*/
  811. background: var(--vent-device-manager-control-btn);
  812. }
  813. }
  814. }
  815. :deep(.@{ventSpace}-picker-datetime-panel) {
  816. height: 200px !important;
  817. overflow-y: auto !important;
  818. }
  819. </style>