nitrogenHome.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610
  1. <template>
  2. <div id="nitrogenCss3D" class="threejs-Object-CSS"
  3. style="width: 100%; height: 100%; position: absolute; pointer-events: none; overflow: hidden; z-index: 2; top: 0px; left: 0px">
  4. <a-spin :spinning="loading" />
  5. <div v-for="groupNum in monitorDataGroupNum" :key="groupNum" class="modal-monitor">
  6. <fourBorderBg :class="`kyj${groupNum}`" :id="`nitrogenMonitor${groupNum}`">
  7. <div class="title">{{ groupNum }}号空压机 </div>
  8. <div class="monitor-item">
  9. <span class="monitor-title">排气压力:</span>
  10. <span class="monitor-val"><span class="val">{{ monitorData[groupNum - 1]['compressExhaustPressF1'] ?
  11. monitorData[groupNum - 1]['compressExhaustPressF1'] : '-' }}</span><span class="unit">Mpa</span></span>
  12. </div>
  13. <div class="monitor-item">
  14. <span class="monitor-title">分离压力:</span>
  15. <span class="monitor-val"><span class="val">{{ monitorData[groupNum - 1]['compressSeparatePressF1'] ?
  16. monitorData[groupNum - 1]['compressSeparatePressF1'] : '-' }}</span><span class="unit">Mpa</span></span>
  17. </div>
  18. <div class="monitor-item">
  19. <span class="monitor-title">排气温度:</span>
  20. <span class="monitor-val"><span class="val">{{ monitorData[groupNum - 1]['exhaustTemp'] ? monitorData[groupNum
  21. - 1]['exhaustTemp'] : '-' }}</span><span class="unit">℃</span></span>
  22. </div>
  23. <div class="signal-item">
  24. <div class="signal"><span class="monitor-title">运行信号</span><span
  25. :class="{ 'signal-round': true, 'signal-round-run': monitorData[groupNum - 1]['compressRunSigF1'], 'signal-round-gry': !monitorData[groupNum - 1]['compressRunSigF1'] }"></span>
  26. </div>
  27. <div class="signal"><span class="monitor-title">加载信号</span><span
  28. :class="{ 'signal-round': true, 'signal-round-run': monitorData[groupNum - 1]['compressLoadSigF1'], 'signal-round-gry': !monitorData[groupNum - 1]['compressLoadSigF1'] }"></span>
  29. </div>
  30. </div>
  31. </fourBorderBg>
  32. <fourBorderBg :class="`cqg${groupNum}`" :id="`cqgMonitor${groupNum}`">
  33. <div class="title">{{ cqgs[groupNum - 1] }}</div>
  34. <div class="monitor-item">
  35. <span class="monitor-title">气囊温度:</span>
  36. <span class="monitor-val"><span class="val">{{ monitorData[groupNum - 1]['airReceiverTemp'] ?
  37. monitorData[groupNum - 1]['airReceiverTemp'] : '-' }}</span><span class="unit">℃</span></span>
  38. </div>
  39. <div class="monitor-item">
  40. <span class="monitor-title">气囊压力<span class="unit"></span>:</span>
  41. <span class="monitor-val"><span class="val">{{ monitorData[groupNum - 1]['airReceiverPress'] ?
  42. monitorData[groupNum - 1]['airReceiverPress'] : '-' }}</span><span class="unit">Mpa</span></span>
  43. </div>
  44. <div class="monitor-item">
  45. <span class="monitor-title">气囊流量<span class="unit"></span>:</span>
  46. <span class="monitor-val"><span class="val">{{ monitorData[groupNum - 1]['airReceiverFlow'] ?
  47. monitorData[groupNum - 1]['airReceiverFlow'] : '-' }}</span><span class="unit">m³/k</span></span>
  48. </div>
  49. </fourBorderBg>
  50. </div>
  51. </div>
  52. <div id="nitrogen3D" style="width: 100%; height: 100%; position: absolute; overflow: hidden"></div>
  53. <div class="nitrogen-home">
  54. <div class="nitrogen-container">
  55. <div class="top-box">
  56. <!-- 左边监测数据 -->
  57. <div class="lr-box left-box">
  58. <div class="item item-l" v-for="groupNum in monitorDataGroupNum" :key="groupNum">
  59. <div class="monitor-box">
  60. <!-- <div class="device-title">{{ monitorData[groupNum - 1]['strName'] }}</div>-->
  61. <dv-decoration7 style="height:30px;">
  62. <div class="base-title">{{ groupNum }}号空压机组</div>
  63. </dv-decoration7>
  64. <div class="state-item" v-for="(data, index) in showMonitorData" :key="index">
  65. <div class="item-col">
  66. <span class="state-title">{{ Object.values(data)[0] }} :</span>
  67. <span class="state-val">{{ (monitorData.length > 0 && monitorData[groupNum - 1][Object.keys(data)[0]])
  68. >= 0 ? monitorData[groupNum - 1][Object.keys(data)[0]] : '-' }}</span>
  69. </div>
  70. <div class="item-col">
  71. <span class="state-title">{{ Object.values(data)[1] }} :</span>
  72. <span class="state-val">{{ (monitorData.length > 0 && monitorData[groupNum - 1][Object.keys(data)[1]])
  73. >= 0 ? monitorData[groupNum - 1][Object.keys(data)[1]] : '-' }}</span>
  74. </div>
  75. </div>
  76. </div>
  77. </div>
  78. </div>
  79. <!-- 右边控制状态 -->
  80. <div class="lr-box right-box">
  81. <div class="item">
  82. <div class="control-item">
  83. <div class="control-item-l">
  84. <!-- <img src="@/assets/img/yccz.png" alt="" width="36px" height="36px" style="margin-right: 10px;"> -->
  85. <span style="font-size: 18px;">远程控制</span>
  86. </div>
  87. </div>
  88. <div class="control-item" v-for="groupNum in monitorDataGroupNum" :key="groupNum">
  89. <div class="control-item-l">
  90. <span class="round"></span>
  91. <span>{{ kyjs[groupNum - 1] }}</span>
  92. </div>
  93. <div class="control-item-r" style="display: flex; align-items: center;">
  94. <a-switch v-model="airCompressorState[groupNum - 1][`compressRunSigF1`]" checked-children="开启"
  95. un-checked-children="关闭" :disabled="airCompressorState[groupNum - 1][`controlModel`]"
  96. @change="handlerDevice(airCompressorState[groupNum - 1])">
  97. </a-switch>
  98. </div>
  99. </div>
  100. <div class="control-item">
  101. <div class="control-item-l">
  102. <span class="round"></span>
  103. <span>控制模式</span>
  104. </div>
  105. <div>
  106. <a-switch v-model="airCompressorState[0][`controlModel`]" checked-children="就地" un-checked-children="远程"
  107. @change="handlerControlModel(airCompressorState[0])">
  108. </a-switch>
  109. </div>
  110. </div>
  111. <div class="control-item">
  112. <div class="control-item-l">
  113. <span class="round"></span>
  114. <span>是否开启联动</span>
  115. </div>
  116. <div class="item-data-box" style="display: flex">
  117. <div
  118. :class="{ 'state-icon': true, 'open': monitorData[0].linkState, 'close': !monitorData[0].linkState }">
  119. </div>
  120. <div style="margin-left: 10px;">{{ !monitorData[0].linkState ? '不联动' : '联动' }}</div>
  121. </div>
  122. </div>
  123. </div>
  124. </div>
  125. </div>
  126. </div>
  127. </div>
  128. </template>
  129. <script lang="ts" setup name="nitrogenHome">
  130. import { onMounted, onUnmounted, ref, watch } from 'vue'
  131. import { Decoration7 as DvDecoration7 } from '@kjgl77/datav-vue3'
  132. import fourBorderBg from '../../../comment/components/fourBorderBg.vue'
  133. import { mountedThree, destroy } from '../nitrogen.threejs'
  134. import { list } from '../nitrogen.api'
  135. const loading = ref(true)
  136. const kyjs = ['1号空压机', '2号空压机', '3号空压机', '4号空压机'];
  137. const cqgs = ['1号储气罐', '2号储气罐', '3号储气罐', '4号储气罐'];
  138. const monitorDataGroupNum = ref(3);
  139. const airCompressorState = ref([
  140. {
  141. id: '',
  142. compressRunSigF1: false,
  143. controlModel: false
  144. },
  145. {
  146. id: '',
  147. compressRunSigF1: false,
  148. controlModel: false
  149. },
  150. {
  151. id: '',
  152. compressRunSigF1: false,
  153. controlModel: false
  154. },
  155. {
  156. id: '',
  157. compressRunSigF1: false,
  158. controlModel: false
  159. }
  160. ]);
  161. const showMonitorData = [
  162. {
  163. supVolt1: '电流A(A)',
  164. supVolt2: '电流B(A)',
  165. },
  166. {
  167. supVolt3: '电流C(A)',
  168. current: '电源电压(V)',
  169. },
  170. {
  171. shock1: '震动X(mm/s)',
  172. shock2: '震动Y(mm/s)',
  173. },
  174. {
  175. shock3: '震动Z(mm/s)',
  176. noise: '噪声',
  177. },
  178. {
  179. ambTempCol: '环境温度(℃)',
  180. },
  181. ];
  182. const monitorData = ref(new Array(4).fill({
  183. strName: '空压机',
  184. compressGroupName: '',
  185. compressExhaustPressF1: '-',
  186. compressSeparatePressF1: '-',
  187. compressHostTempF1: '-',
  188. compressCrewTempF1: '-',
  189. compressRunTimeF1: '-',
  190. controlModel: 'LOC'
  191. }));
  192. // https获取监测数据
  193. let timer: null | NodeJS.Timeout = null;
  194. async function getMonitor() {
  195. if (Object.prototype.toString.call(timer) === '[object Null]') {
  196. timer = await setTimeout(async () => {
  197. await getDataSource();
  198. if (timer) {
  199. timer = null;
  200. }
  201. await getMonitor();
  202. }, 1000);
  203. }
  204. };
  205. async function getDataSource() {
  206. const res = await list({ devicetype: 'pressurefan', pagetype: 'normal' });
  207. const dataSource = res.msgTxt[0].datalist || [];
  208. dataSource.forEach((data, index) => {
  209. const item = data.readData;
  210. Object.assign(item, data);
  211. item.compressRunSigF1 = item.compressRunSigF1 ? true : false
  212. airCompressorState.value[index].id = item.id
  213. airCompressorState.value[index].compressRunSigF1 = item.compressRunSigF1
  214. airCompressorState.value[index].controlModel = item.controlModel === 'LOC' ? true : false
  215. monitorData.value[index] = item
  216. });
  217. monitorDataGroupNum.value = monitorData.value.length
  218. loading.value = false
  219. };
  220. function handlerDevice(data) {
  221. // if (data.length < 1) return
  222. // handleAirCompressor({ id: data.id, compressRunF1: data.compressRunSigF1 }).then(res => {
  223. // if (res.success) {
  224. // message.success('操作成功')
  225. // } else {
  226. // message.warning(data.msg)
  227. // }
  228. // })
  229. };
  230. function resetDevice(data) {
  231. }
  232. function handlerControlModel(data) {
  233. }
  234. watch(monitorDataGroupNum, (newVal) => {
  235. if (newVal) {
  236. destroy()
  237. mountedThree(newVal)
  238. }
  239. })
  240. onMounted(async () => {
  241. await getMonitor()
  242. })
  243. onUnmounted(() => {
  244. destroy();
  245. if (timer) {
  246. clearTimeout(timer);
  247. timer = undefined;
  248. }
  249. });
  250. </script>
  251. <style lang="less" scoped>
  252. @ventSpace: zxm;
  253. .nitrogen-box {
  254. width: 100%;
  255. height: 100%;
  256. display: flex;
  257. justify-content: center;
  258. }
  259. #nitrogenCss3D {
  260. .modal-monitor {
  261. position: absolute;
  262. left: 0px;
  263. top: 0px;
  264. }
  265. &:deep(.win) {
  266. margin: 0 !important;
  267. }
  268. &:deep(.main) {
  269. .title {
  270. height: 34px;
  271. text-align: center;
  272. font-weight: 600;
  273. color: #7AF5FF;
  274. // background-image: url('../../../assets/img/yfj/light.png');
  275. background-repeat: no-repeat;
  276. background-position-x: center;
  277. background-position-y: 100%;
  278. background-size: 80%;
  279. font-size: 16px;
  280. }
  281. .monitor-item {
  282. display: flex;
  283. flex-direction: row;
  284. width: auto;
  285. margin-bottom: 3px;
  286. .monitor-val {
  287. color: #ffb700;
  288. display: flex;
  289. width: auto;
  290. .val {
  291. width: 80px;
  292. font-size: 14px;
  293. }
  294. .unit {
  295. color: #ffffffbb;
  296. font-size: 14px;
  297. }
  298. }
  299. }
  300. .monitor-title {
  301. width: 100px;
  302. color: #7AF5FF;
  303. font-weight: 400;
  304. font-size: 14px;
  305. }
  306. .signal-item {
  307. display: flex;
  308. justify-content: space-between;
  309. // margin-bottom: 5px;
  310. .signal-round {
  311. display: inline-block;
  312. width: 8px;
  313. height: 8px;
  314. border-radius: 50%;
  315. margin: 0 10px;
  316. position: relative;
  317. &::after {
  318. display: block;
  319. content: '';
  320. position: absolute;
  321. width: 12px;
  322. height: 12px;
  323. top: -2px;
  324. left: -2px;
  325. border-radius: 50%;
  326. }
  327. }
  328. .signal-round-gry {
  329. background-color: #858585;
  330. &::after {
  331. background-color: #85858544;
  332. box-shadow: 0 0 1px 1px #85858599;
  333. }
  334. }
  335. .signal-round-run {
  336. background-color: #67FC00;
  337. &::after {
  338. background-color: #67FC0044;
  339. box-shadow: 0 0 1px 1px #c6ff77;
  340. }
  341. }
  342. .signal-round-warning {
  343. background-color: #E9170B;
  344. &::after {
  345. background-color: #E9170B44;
  346. box-shadow: 0 0 1px 1px #E9170B;
  347. }
  348. }
  349. }
  350. }
  351. }
  352. .nitrogen-home {
  353. width: 100%;
  354. height: calc(100% - 100px);
  355. position: fixed;
  356. z-index: 99;
  357. display: flex;
  358. flex-direction: column;
  359. justify-content: center;
  360. align-items: center;
  361. pointer-events: none;
  362. top: 100px;
  363. .nitrogen-container {
  364. width: 100%;
  365. height: calc(100%);
  366. display: flex;
  367. justify-content: space-between;
  368. margin-bottom: 100px;
  369. .top-box {
  370. width: 100%;
  371. padding: 10px;
  372. overflow: hidden;
  373. display: flex;
  374. justify-content: space-between;
  375. .lr-box {
  376. height: fit-content;
  377. display: flex;
  378. flex-direction: column;
  379. position: relative;
  380. overflow: hidden;
  381. z-index: 9999;
  382. }
  383. .item {
  384. width: 285px;
  385. height: auto;
  386. position: relative;
  387. border-radius: 5px;
  388. margin-top: 10px;
  389. margin-bottom: 0px;
  390. pointer-events: auto;
  391. color: #fff;
  392. overflow: hidden;
  393. .control-item {
  394. height: auto;
  395. min-height: 35px;
  396. display: flex;
  397. flex-direction: row;
  398. justify-content: space-between;
  399. align-items: center;
  400. padding: 5px;
  401. margin: 0 10px 0 3px;
  402. pointer-events: auto;
  403. background: linear-gradient(to right, #0063CD22, #0063CD04);
  404. margin-bottom: 5px;
  405. border-width: 1px;
  406. border-style: dashed;
  407. border-image: linear-gradient(to right, #008ccd66, #0063CD04)1 1;
  408. border-radius: 5px;
  409. &:last-child {
  410. margin-bottom: 0
  411. }
  412. .control-item-l {
  413. display: flex;
  414. align-items: center;
  415. font-size: 14px;
  416. .round {
  417. display: inline-block;
  418. width: 3px;
  419. height: 3px;
  420. padding: 1px;
  421. border-radius: 50%;
  422. background-color: #3DF6FF;
  423. margin-right: 5px;
  424. box-shadow: 0 0 1px 1px #64f7ff;
  425. }
  426. }
  427. .control-item-r {
  428. text-align: right;
  429. }
  430. .button-box {
  431. position: relative;
  432. padding: 5px;
  433. border: 1px transparent solid;
  434. background-clip: border-box;
  435. border-radius: 5px;
  436. margin-left: 8px;
  437. }
  438. .a-button {
  439. pointer-events: auto;
  440. }
  441. &::v-deep .a-button--mini {
  442. padding: 6px 10px;
  443. }
  444. &::v-deep .a-button--mini.is-round {
  445. padding: 6px 10px;
  446. }
  447. }
  448. .base-title {
  449. width: calc(100% - 60px);
  450. text-align: center;
  451. color: #00d8ff;
  452. }
  453. .state-item {
  454. display: flex;
  455. flex-direction: row;
  456. padding: 5px;
  457. .item-col {
  458. width: 50%;
  459. display: flex;
  460. justify-content: center;
  461. align-items: center;
  462. padding-right: 4px;
  463. .state-title {
  464. color: #ffffffcc;
  465. flex: 9;
  466. font-size: 14px;
  467. .unit {
  468. // color: #ffffffbb;
  469. }
  470. }
  471. .state-val {
  472. flex: 1;
  473. color: #e4a300;
  474. margin-right: 5px;
  475. text-align: right;
  476. font-size: 14px;
  477. }
  478. }
  479. }
  480. .signal-box {
  481. margin: 5px 0;
  482. display: flex;
  483. align-items: center;
  484. .signal-title {
  485. color: #7AF5FF;
  486. margin: 0 5px;
  487. }
  488. &:last-child {
  489. margin-right: 0px;
  490. }
  491. }
  492. .list-item {
  493. padding: 0 10px;
  494. display: flex;
  495. justify-content: space-between;
  496. align-items: center;
  497. .item-data-key {
  498. color: #ffffff99;
  499. }
  500. }
  501. .item-data-box {
  502. color: #fff;
  503. .state-icon {
  504. display: inline-block;
  505. width: 12px;
  506. height: 12px;
  507. border-radius: 12px;
  508. }
  509. .open {
  510. border: 5px solid #133a56;
  511. background: #4ecb73;
  512. }
  513. .close {
  514. border: 5px solid #192961;
  515. background: #6d7898;
  516. }
  517. }
  518. }
  519. .item-l {
  520. width: 335px;
  521. .monitor-box {
  522. width: 335px;
  523. background-color: #ffffff05;
  524. margin-left: 2px;
  525. border-radius: 5px;
  526. backdrop-filter: blur(10px);
  527. }
  528. }
  529. .right-box {
  530. .item {
  531. height: auto;
  532. }
  533. }
  534. .left-box {
  535. width: 365px;
  536. .control-item {
  537. height: 36px;
  538. }
  539. }
  540. }
  541. }
  542. }</style>