nitrogenHome_ln.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640
  1. <template>
  2. <div id="compressor3D" style="width: 100%; height: 100%; position: absolute; overflow: hidden"></div>
  3. <template v-for="(sysItem, sysIndex) in monitorDataGroupArr" :key="sysIndex">
  4. <div :id="`compressorCss3D${sysIndex + 1}`" class="threejs-Object-CSS compressorCss3D-box"
  5. style="width: 100%; height: 100%; position: absolute; pointer-events: none; overflow: hidden; z-index: 2; top: 0px; left: 0px">
  6. </div>
  7. </template>
  8. <!-- 模型卡片 -->
  9. <div v-for="(sysItem, sysIndex) in monitorDataGroupArr" :key="sysIndex" style="position: absolute; z-index: -1">
  10. <div v-show="monitorDataGroupFlag == sysIndex + 1" :id="`nitrogenMonitorBox${sysIndex}`">
  11. <div v-for="(groupNum, index) in sysItem" :key="index" class="modal-monitor">
  12. <fourBorderBg :class="`kyj${groupNum}`" :id="`nitrogenMonitor${groupNum}`">
  13. <div class="title">{{ `空压机${groupNum}` }} </div>
  14. <template v-for="(preMonitor, preMonitorIndex) in preMonitorList" :key="preMonitorIndex">
  15. <div v-if="preMonitor.code !== 'signal'" class="monitor-item">
  16. <span class="monitor-title">{{ preMonitor.title }}:</span>
  17. <span class="monitor-val"><span class="val">{{
  18. monitorData[preMonitor.code.replace(prefix[0], `${prefix[0]}${groupNum}`)]
  19. ? formatNum(monitorData[preMonitor.code.replace(prefix[0], `${prefix[0]}${groupNum}`)])
  20. : preMonitor.value
  21. ? preMonitor.value
  22. : '-'
  23. }}</span><span class="unit">{{ preMonitor.unit }}</span></span>
  24. </div>
  25. <div v-else class="signal-item">
  26. <div class="signal" v-for="(signal, childIndex) in preMonitor.child" :key="childIndex">
  27. <span class="monitor-title">{{ signal.title }}</span>
  28. <span :class="{
  29. 'signal-round': true,
  30. 'signal-round-run': signal.title != '故障信号' && monitorData[signal.code.replace(prefix[0], `${prefix[0]}${groupNum}`)] == '1',
  31. 'signal-round-warning':
  32. signal.title == '故障信号' && monitorData[signal.code.replace(prefix[0], `${prefix[0]}${groupNum}`)] == '1',
  33. 'signal-round-gry': monitorData[signal.code.replace(prefix[0], `${prefix[0]}${groupNum}`)] != '1',
  34. }"></span>
  35. </div>
  36. </div>
  37. </template>
  38. </fourBorderBg>
  39. <fourBorderBg :class="`cqg${groupNum}`" :id="`cqgMonitor${groupNum}`"
  40. v-if="cqgMonitorList && cqgMonitorList.length > 0">
  41. <div class="title">{{ `风包${groupNum}` }}</div>
  42. <template v-for="(cqgMonitor, cqgMonitorIndex) in cqgMonitorList" :key="cqgMonitorIndex">
  43. <div class="monitor-item">
  44. <span class="monitor-title">{{ cqgMonitor.title }}:</span>
  45. <span class="monitor-val"><span class="val">{{
  46. monitorData[cqgMonitor.code.replace(prefix[0], `${prefix[0]}${groupNum}`)]
  47. ? formatNum(monitorData[cqgMonitor.code.replace(prefix[0], `${prefix[0]}${groupNum}`)])
  48. : cqgMonitor.value
  49. ? cqgMonitor.value
  50. : '-'
  51. }}</span><span class="unit">{{ cqgMonitor.unit }}</span></span>
  52. </div>
  53. </template>
  54. </fourBorderBg>
  55. </div>
  56. </div>
  57. </div>
  58. <div class="nitrogen-home">
  59. <!-- 顶部导航提示 -->
  60. <!-- <div class="total-data" v-if="totalData && totalData.length > 0">
  61. <div class="vent-flex-row">
  62. <div class="item" v-for="(data, index) in totalData" :key="index"
  63. >{{ data.title + '(' + data.unit + ')' }}:<span class="val">{{
  64. monitorData[data.code] ? formatNum(monitorData[data.code]) : data.value ? data.value : '-'
  65. }}</span></div
  66. >
  67. </div>
  68. </div> -->
  69. <div class="nitrogen-container">
  70. <div v-if="monitorData['netStatus'] == 0" class="device-state">网络断开</div>
  71. <div class="top-box">
  72. <!-- 左边监测数据 -->
  73. <div class="lr-box left-box">
  74. <div class="left-container" v-if="preFanMonitorData && preFanMonitorData.length > 0">
  75. <div class="item item-l" v-for="(groupNum, index) in monitorDataGroup" :key="index">
  76. <div class="monitor-box">
  77. <ventBox1>
  78. <template #title>
  79. <div>{{ groupNum }}号压风机</div>
  80. </template>
  81. <template #container>
  82. <div class="state-item">
  83. <div class="item-col" v-for="(preFan, preFanIndex) in preFanMonitorData" :key="preFanIndex">
  84. <span class="state-title">{{
  85. preFan.title + (preFan.unit !== 'signal' && preFan.unit !== 'warning' ? `(${preFan.unit})` :
  86. '')
  87. }}</span>
  88. <span v-if="preFan.unit !== 'signal' && preFan.unit !== 'warning'" class="state-val">{{
  89. monitorData[preFan.code.replace(prefix[1], prefix[1] + groupNum)] >= 0
  90. ? formatNum(Number(monitorData[preFan.code.replace(prefix[1], prefix[1] + groupNum)]))
  91. : preFan.value
  92. ? preFan.value
  93. : '-'
  94. }}</span>
  95. <span v-else :class="{
  96. 'signal-round': true,
  97. 'signal-round-run':
  98. preFan.unit == 'signal' && monitorData[preFan.code.replace(prefix[0], `${prefix[0]}${groupNum}`)] != '1',
  99. 'signal-round-warning':
  100. preFan.unit == 'warning' && monitorData[preFan.code.replace(prefix[0], `${prefix[0]}${groupNum}`)] == '1',
  101. 'signal-round-gry': monitorData[preFan.code.replace(prefix[0], `${prefix[0]}${groupNum}`)] != '1',
  102. }"></span>
  103. </div>
  104. </div>
  105. </template>
  106. </ventBox1>
  107. </div>
  108. </div>
  109. </div>
  110. </div>
  111. <div v-if="renderPlayer" ref="playerRef" class="playerBox"> </div>
  112. </div>
  113. </div>
  114. </div>
  115. </template>
  116. <script lang="ts" setup name="nitrogenHome">
  117. import { onMounted, onUnmounted, ref, onBeforeUnmount } from 'vue';
  118. import fourBorderBg from '../../../comment/components/fourBorderBg.vue';
  119. import { mountedThree, destroy, setModelType } from '../nitrogen.threejs';
  120. import { list } from '../nitrogen.api';
  121. import ventBox1 from '/@/components/vent/ventBox1.vue';
  122. import { monitorDataGroupArr, preFanMonitorData, preMonitorList, cqgMonitorList, prefix, totalData, } from '../nitrogen.data.lh';
  123. import { formatNum } from '/@/utils/ventutil';
  124. import { useCamera } from '/@/hooks/system/useCamera';
  125. const loading = ref(true);
  126. const monitorDataGroupFlag = ref(1);
  127. const monitorDataGroup = ref<Number[]>([]);
  128. const monitorData = ref<Object | []>({});
  129. const playerRef = ref();
  130. const renderPlayer = ref(true);
  131. const { getCamera, removeCamera } = useCamera();
  132. // https获取监测数据
  133. let timer: null | NodeJS.Timeout = null;
  134. async function getMonitor(flag?) {
  135. if (Object.prototype.toString.call(timer) === '[object Null]') {
  136. return new Promise(async (resolve) => {
  137. timer = await setTimeout(
  138. async () => {
  139. await getDataSource();
  140. if (timer) {
  141. timer = null;
  142. }
  143. resolve(null);
  144. await getMonitor(false);
  145. },
  146. flag ? 0 : 1000
  147. );
  148. });
  149. }
  150. }
  151. async function getDataSource() {
  152. const res = await list({ devicetype: 'forcFan', pagetype: 'normal' });
  153. let dataSource = res.msgTxt[0] && res.msgTxt[0].datalist ? res.msgTxt[0].datalist[0] : [];
  154. if (dataSource) {
  155. Object.assign(monitorData.value, dataSource, dataSource.readData);
  156. }
  157. loading.value = false;
  158. }
  159. function setMonitorGroupNum(flag) {
  160. if (flag != monitorDataGroupFlag.value) monitorDataGroupFlag.value = flag;
  161. const monitorGroup = monitorDataGroupArr[flag - 1];
  162. setModelType('compressor' + (flag - 1));
  163. monitorDataGroup.value = monitorGroup;
  164. }
  165. onMounted(async () => {
  166. setTimeout(() => {
  167. mountedThree(monitorDataGroupArr).then(async () => {
  168. setMonitorGroupNum(1);
  169. getMonitor(true).then(async () => {
  170. if (monitorData.value && monitorData.value['deviceID']) await getCamera(monitorData.value['deviceID'], playerRef, renderPlayer);
  171. });
  172. });
  173. }, 0);
  174. });
  175. onBeforeUnmount(() => {
  176. removeCamera(playerRef);
  177. });
  178. onUnmounted(() => {
  179. destroy();
  180. if (timer) {
  181. clearTimeout(timer);
  182. timer = undefined;
  183. }
  184. });
  185. </script>
  186. <style lang="less" scoped>
  187. @import '../../comment/less/workFace.less';
  188. @ventSpace: zxm;
  189. .compressorCss3D-box {
  190. .modal-monitor {
  191. position: absolute;
  192. left: 0px;
  193. top: 0px;
  194. }
  195. &:deep(.win) {
  196. margin: 0 !important;
  197. background: #00000044;
  198. }
  199. &:deep(.main) {
  200. .title {
  201. height: 34px;
  202. text-align: center;
  203. font-weight: 600;
  204. color: #7af5ff;
  205. // background-image: url('../../../assets/img/yfj/light.png');
  206. background-repeat: no-repeat;
  207. background-position-x: center;
  208. background-position-y: 100%;
  209. background-size: 80%;
  210. font-size: 16px;
  211. }
  212. .monitor-item {
  213. display: flex;
  214. flex-direction: row;
  215. width: auto;
  216. margin-bottom: 3px;
  217. .monitor-val {
  218. color: #ffb700;
  219. display: flex;
  220. width: auto;
  221. .val {
  222. width: 80px;
  223. font-size: 14px;
  224. }
  225. .unit {
  226. color: #ffffffbb;
  227. font-size: 14px;
  228. }
  229. }
  230. }
  231. .monitor-title {
  232. width: 100px;
  233. color: #7af5ff;
  234. font-weight: 400;
  235. font-size: 14px;
  236. }
  237. .signal-item {
  238. display: flex;
  239. justify-content: space-between;
  240. // margin-bottom: 5px;
  241. .signal-round {
  242. display: inline-block;
  243. width: 8px;
  244. height: 8px;
  245. border-radius: 50%;
  246. margin: 0 10px;
  247. position: relative;
  248. &::after {
  249. display: block;
  250. content: '';
  251. position: absolute;
  252. width: 12px;
  253. height: 12px;
  254. top: -2px;
  255. left: -2px;
  256. border-radius: 50%;
  257. }
  258. }
  259. .signal-round-gry {
  260. background-color: #858585;
  261. &::after {
  262. background-color: #85858544;
  263. box-shadow: 0 0 1px 1px #85858599;
  264. }
  265. }
  266. .signal-round-run {
  267. background-color: #67fc00;
  268. &::after {
  269. background-color: #67fc0044;
  270. box-shadow: 0 0 1px 1px #c6ff77;
  271. }
  272. }
  273. .signal-round-warning {
  274. background-color: #e9170b;
  275. &::after {
  276. background-color: #e9170b44;
  277. box-shadow: 0 0 1px 1px #e9170b;
  278. }
  279. }
  280. }
  281. }
  282. }
  283. .nitrogen-home {
  284. width: 100%;
  285. height: calc(100%);
  286. position: fixed;
  287. z-index: 99;
  288. display: flex;
  289. flex-direction: column;
  290. justify-content: center;
  291. align-items: center;
  292. pointer-events: none;
  293. top: 60px;
  294. .total-data {
  295. position: absolute;
  296. color: #e4cd00;
  297. z-index: 9;
  298. top: 20px;
  299. right: 30px;
  300. // display: flex;
  301. font-size: 18px;
  302. .item {
  303. margin-left: 20px;
  304. .val {
  305. display: inline-box;
  306. width: 150px;
  307. color: #00d8ff;
  308. }
  309. }
  310. }
  311. .nitrogen-container {
  312. width: 100%;
  313. height: calc(100%);
  314. display: flex;
  315. justify-content: space-between;
  316. position: relative;
  317. .device-state {
  318. width: 100%;
  319. position: absolute;
  320. top: 20px;
  321. color: #e90000;
  322. display: flex;
  323. justify-content: center;
  324. font-size: 20px;
  325. }
  326. .top-box {
  327. width: 100%;
  328. padding: 10px;
  329. overflow: hidden;
  330. display: flex;
  331. justify-content: space-between;
  332. .lr-box {
  333. display: flex;
  334. flex-direction: column;
  335. position: relative;
  336. z-index: 9999;
  337. pointer-events: auto;
  338. }
  339. .item {
  340. width: 285px;
  341. height: auto;
  342. position: relative;
  343. border-radius: 5px;
  344. margin-top: 10px;
  345. margin-bottom: 0px;
  346. pointer-events: auto;
  347. color: #fff;
  348. overflow: hidden;
  349. .control-item {
  350. height: auto;
  351. min-height: 35px;
  352. display: flex;
  353. flex-direction: row;
  354. justify-content: space-between;
  355. align-items: center;
  356. padding: 5px;
  357. margin: 0 10px 0 3px;
  358. pointer-events: auto;
  359. background: linear-gradient(to right, #0063cd22, #0063cd04);
  360. margin-bottom: 5px;
  361. border-width: 1px;
  362. border-style: dashed;
  363. border-image: linear-gradient(to right, #008ccd66, #0063cd04) 1 1;
  364. border-radius: 5px;
  365. &:last-child {
  366. margin-bottom: 0;
  367. }
  368. .control-item-l {
  369. display: flex;
  370. align-items: center;
  371. font-size: 14px;
  372. .round {
  373. display: inline-block;
  374. width: 3px;
  375. height: 3px;
  376. padding: 1px;
  377. border-radius: 50%;
  378. background-color: #3df6ff;
  379. margin-right: 5px;
  380. box-shadow: 0 0 1px 1px #64f7ff;
  381. }
  382. }
  383. .control-item-r {
  384. text-align: right;
  385. }
  386. .button-box {
  387. position: relative;
  388. padding: 5px;
  389. border: 1px transparent solid;
  390. background-clip: border-box;
  391. border-radius: 5px;
  392. margin-left: 8px;
  393. }
  394. .a-button {
  395. pointer-events: auto;
  396. }
  397. &::v-deep .a-button--mini {
  398. padding: 6px 10px;
  399. }
  400. &::v-deep .a-button--mini.is-round {
  401. padding: 6px 10px;
  402. }
  403. }
  404. .base-title {
  405. width: calc(100% - 60px);
  406. text-align: center;
  407. color: #00d8ff;
  408. }
  409. .state-item {
  410. width: 100%;
  411. display: flex;
  412. flex-direction: row;
  413. flex-wrap: wrap;
  414. .item-col {
  415. width: 50%;
  416. display: flex;
  417. justify-content: center;
  418. align-items: center;
  419. padding: 5px;
  420. .state-title {
  421. color: #ffffffcc;
  422. flex: 9;
  423. font-size: 14px;
  424. .unit {
  425. // color: #ffffffbb;
  426. }
  427. }
  428. .state-val {
  429. flex: 1;
  430. color: #e4a300;
  431. margin-right: 5px;
  432. text-align: right;
  433. font-size: 14px;
  434. }
  435. }
  436. }
  437. .signal-box {
  438. margin: 5px 0;
  439. display: flex;
  440. align-items: center;
  441. .signal-title {
  442. color: #7af5ff;
  443. margin: 0 5px;
  444. }
  445. &:last-child {
  446. margin-right: 0px;
  447. }
  448. }
  449. .list-item {
  450. padding: 0 10px;
  451. display: flex;
  452. justify-content: space-between;
  453. align-items: center;
  454. .item-data-key {
  455. color: #ffffff99;
  456. }
  457. }
  458. .item-data-box {
  459. color: #fff;
  460. .state-icon {
  461. display: inline-block;
  462. width: 12px;
  463. height: 12px;
  464. border-radius: 12px;
  465. }
  466. .open {
  467. border: 5px solid #133a56;
  468. background: #4ecb73;
  469. }
  470. .close {
  471. border: 5px solid #192961;
  472. background: #6d7898;
  473. }
  474. }
  475. }
  476. .left-box {
  477. height: calc(100% - 50px);
  478. overflow-x: hidden;
  479. overflow-y: auto;
  480. pointer-events: auto;
  481. direction: rtl;
  482. .item-l {
  483. width: 335px;
  484. .monitor-box {
  485. background-color: #ffffff05;
  486. }
  487. }
  488. .left-container {
  489. direction: ltr;
  490. }
  491. .control-item {
  492. height: 36px;
  493. }
  494. }
  495. }
  496. }
  497. .playerBox {
  498. z-index: 9999;
  499. position: fixed;
  500. // top: 200px;
  501. right: 15px;
  502. width: 100%;
  503. height: calc(100% - 100px);
  504. overflow-y: auto;
  505. margin: auto;
  506. pointer-events: none;
  507. display: flex;
  508. justify-content: end;
  509. &:deep(#LivePlayerBox) {
  510. width: auto !important;
  511. height: auto !important;
  512. display: flex;
  513. flex-flow: column;
  514. justify-content: end;
  515. }
  516. }
  517. }
  518. .btn {
  519. padding: 2px 12px;
  520. position: relative;
  521. border-radius: 2px;
  522. color: #fff;
  523. cursor: pointer;
  524. &::before {
  525. position: absolute;
  526. display: block;
  527. content: '';
  528. width: calc(100% - 4px);
  529. height: calc(100% - 4px);
  530. top: 2px;
  531. left: 2px;
  532. border-radius: 2px;
  533. z-index: -1;
  534. }
  535. }
  536. .btn1 {
  537. border: 1px solid #5cfaff;
  538. &::before {
  539. background-image: linear-gradient(#2effee92, #0cb1d592);
  540. }
  541. &:hover {
  542. border: 1px solid #5cfaffaa;
  543. &::before {
  544. background-image: linear-gradient(#2effee72, #0cb1d572);
  545. }
  546. }
  547. }
  548. .btn2 {
  549. border: 1px solid #e91927;
  550. margin-left: 10px;
  551. &::before {
  552. background-image: linear-gradient(#b02533, #a31f2e);
  553. }
  554. &:hover {
  555. &::before {
  556. background-image: linear-gradient(#bd2e3ccc, #a31f2ecc);
  557. }
  558. }
  559. }
  560. </style>