nitrogenHome.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663
  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]['nitrogenPressure'] ?
  11. monitorData[groupNum - 1]['nitrogenPressure'] : '-' }}</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]['instantaneousFlow'] ?
  16. monitorData[groupNum - 1]['instantaneousFlow'] : '-' }}</span><span class="unit">m³/h</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]['nitrogenContent'] ?
  21. monitorData[groupNum - 1]['nitrogenContent'] : '-' }}</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. </div>
  33. </div>
  34. <div id="nitrogen3D" style="width: 100%; height: 100%; position: absolute; overflow: hidden"></div>
  35. <div class="nitrogen-home">
  36. <div class="nitrogen-container">
  37. <div class="top-box">
  38. <!-- 左边监测数据 -->
  39. <div class="lr-box left-box">
  40. <div class="item item-l" v-for="groupNum in monitorDataGroupNum" :key="groupNum">
  41. <ventBox1>
  42. <template #title>
  43. <div>{{ groupNum }}号制氮机组</div>
  44. </template>
  45. <template #container>
  46. <div class="monitor-box">
  47. <div class="parameter-title group-parameter-title"><SvgIcon class="icon" size="38" name="device-group-paramer"/><span>机组参数</span></div>
  48. <div class="state-item" v-for="(data, index) in groupParameterData" :key="index">
  49. <div class="item-col">
  50. <span class="state-title">{{ Object.values(data)[0] }} :</span>
  51. <span class="state-val">{{ (monitorData.length > 0 && monitorData[groupNum - 1][Object.keys(data)[0]])
  52. >= 0 ? monitorData[groupNum - 1][Object.keys(data)[0]] : '-' }}</span>
  53. </div>
  54. <div class="item-col">
  55. <span class="state-title">{{ Object.values(data)[1] }} :</span>
  56. <span class="state-val">{{ (monitorData.length > 0 && monitorData[groupNum - 1][Object.keys(data)[1]])
  57. >= 0 ? monitorData[groupNum - 1][Object.keys(data)[1]] : '-' }}</span>
  58. </div>
  59. </div>
  60. </div>
  61. <div class="monitor-box">
  62. <div class="parameter-title device-parameter-title"><SvgIcon class="icon" size="32" name="device-paramer"/><span>电机数据</span></div>
  63. <div class="state-item" v-for="(data, index) in deviceParameterData" :key="index">
  64. <div class="item-col">
  65. <span class="state-title">{{ Object.values(data)[0] }} :</span>
  66. <span class="state-val">{{ (monitorData.length > 0 && monitorData[groupNum - 1][Object.keys(data)[0]])
  67. >= 0 ? monitorData[groupNum - 1][Object.keys(data)[0]] : '-' }}</span>
  68. </div>
  69. <div class="item-col">
  70. <span class="state-title">{{ Object.values(data)[1] }} :</span>
  71. <span class="state-val">{{ (monitorData.length > 0 && monitorData[groupNum - 1][Object.keys(data)[1]])
  72. >= 0 ? monitorData[groupNum - 1][Object.keys(data)[1]] : '-' }}</span>
  73. </div>
  74. </div>
  75. </div>
  76. </template>
  77. </ventBox1>
  78. </div>
  79. </div>
  80. <!-- 右边控制状态 -->
  81. <div class="lr-box right-box">
  82. <ventBox1>
  83. <template #title>
  84. <div>远程控制</div>
  85. </template>
  86. <template #container>
  87. <div class="control-group">
  88. <div class="control-item" v-for="groupNum in monitorDataGroupNum" :key="groupNum">
  89. <div class="control-item-title">{{ zdjs[groupNum - 1] }}</div>
  90. <div class="control-item-state">
  91. <a-switch v-model="airCompressorState[groupNum - 1][`compressRunSigF1`]" size="small" checked-children="开启"
  92. un-checked-children="关闭" :disabled="airCompressorState[groupNum - 1][`controlModel`]"
  93. @change="handlerDevice(airCompressorState[groupNum - 1])">
  94. </a-switch>
  95. </div>
  96. </div>
  97. <div class="control-item" v-for="groupNum in monitorDataGroupNum" :key="groupNum">
  98. <div class="control-item-title">{{ kyjs[groupNum - 1] }}</div>
  99. <div class="control-item-state">
  100. <a-switch v-model="airCompressorState[groupNum - 1][`compressRunSigF1`]" size="small" checked-children="开启"
  101. un-checked-children="关闭" :disabled="airCompressorState[groupNum - 1][`controlModel`]"
  102. @change="handlerDevice(airCompressorState[groupNum - 1])">
  103. </a-switch>
  104. </div>
  105. </div>
  106. <div class="control-item">
  107. <div class="control-item-title">是否开启联动</div>
  108. <div class="control-item-state">
  109. <a-radio v-model:checked="isLink">开启</a-radio>
  110. </div>
  111. </div>
  112. </div>
  113. </template>
  114. </ventBox1>
  115. <ventBox1 class="vent-margin-t-10">
  116. <template #title>
  117. <div>设备实时监测曲线</div>
  118. </template>
  119. <template #container >
  120. <BarAndLineCustom xAxisPropType="readTime" :chartData="monitorData" height="240px" :propTypeArr="['flowRate']" :option="zhudanOption" />
  121. </template>
  122. </ventBox1>
  123. <div class="vent-margin-t-10">
  124. <LivePlayer id="fm-player1" style="height: 250px;" ref="player1" :videoUrl="flvURL1()" muted live loading controls />
  125. </div>
  126. </div>
  127. </div>
  128. </div>
  129. </div>
  130. </template>
  131. <script lang="ts" setup name="nitrogenHome">
  132. import { onMounted, onUnmounted, ref, watch } from 'vue'
  133. import ventBox1 from '/@/components/vent/ventBox1.vue'
  134. import fourBorderBg from '../../../comment/components/fourBorderBg.vue'
  135. import { mountedThree, destroy } from '../nitrogen.threejs'
  136. import { list } from '../nitrogen.api'
  137. import { SvgIcon } from '/@/components/Icon'
  138. import LivePlayer from '@liveqing/liveplayer-v3';
  139. import BarAndLineCustom from '/@/components/chart/BarAndLineCustom.vue';
  140. import { zhudanOption } from '../nitrogen.data.ts'
  141. const loading = ref(true)
  142. const isLink = ref(true)
  143. const zdjs = ['1号制氮机', '2号制氮机', '3号制氮机', '4号制氮机'];
  144. const kyjs = ['1号空压机', '1号空压机', '1号空压机', '1号空压机'];
  145. const flvURL1 = () => {
  146. return `https://sf1-hscdn-tos.pstatp.com/obj/media-fe/xgplayer_doc_video/flv/xgplayer-demo-360p.flv`;
  147. // return ''
  148. };
  149. const monitorDataGroupNum = ref(0);
  150. const airCompressorState = ref([
  151. {
  152. id: '',
  153. compressRunSigF1: false,
  154. controlModel: false
  155. },
  156. {
  157. id: '',
  158. compressRunSigF1: false,
  159. controlModel: false
  160. },
  161. {
  162. id: '',
  163. compressRunSigF1: false,
  164. controlModel: false
  165. },
  166. {
  167. id: '',
  168. compressRunSigF1: false,
  169. controlModel: false
  170. }
  171. ]);
  172. const groupParameterData = [
  173. {
  174. cumulativeFlow: '累计流量(m³)',
  175. centerTemperature: '加热器中心温度',
  176. },
  177. {
  178. outletTemperature: '加热器出口温度',
  179. },
  180. ];
  181. const deviceParameterData = [
  182. {
  183. Ia: 'A项电流(A)',
  184. Ib: 'B项电流(A)',
  185. },
  186. {
  187. Ic: 'c项电流(A)',
  188. Vab: 'AB项间电压(V)',
  189. },
  190. {
  191. Vac: 'AC项间电压(V)',
  192. Vbc: 'BC项间电压(V)',
  193. },
  194. ];
  195. const monitorData = ref(new Array(3).fill({
  196. strName: '空压机',
  197. compressGroupName: '',
  198. compressExhaustPressF1: '-',
  199. compressSeparatePressF1: '-',
  200. compressHostTempF1: '-',
  201. compressCrewTempF1: '-',
  202. compressRunTimeF1: '-',
  203. controlModel: 'LOC'
  204. }));
  205. // https获取监测数据
  206. let timer: null | NodeJS.Timeout = null;
  207. async function getMonitor() {
  208. if (Object.prototype.toString.call(timer) === '[object Null]') {
  209. timer = await setTimeout(async () => {
  210. await getDataSource();
  211. if (timer) {
  212. timer = null;
  213. }
  214. await getMonitor();
  215. }, 1000);
  216. }
  217. };
  218. async function getDataSource() {
  219. const res = await list({ devicetype: 'nitrogen', pagetype: 'normal' });
  220. const dataSource = res.msgTxt[0].datalist || [];
  221. monitorData.value = dataSource.filter((data) => {
  222. const item = data.readData;
  223. Object.assign(data, item);
  224. return item
  225. });
  226. monitorDataGroupNum.value = monitorData.value.length
  227. loading.value = false
  228. };
  229. function handlerDevice(data) {
  230. // if (data.length < 1) return
  231. // handleAirCompressor({ id: data.id, compressRunF1: data.compressRunSigF1 }).then(res => {
  232. // if (res.success) {
  233. // message.success('操作成功')
  234. // } else {
  235. // message.warning(data.msg)
  236. // }
  237. // })
  238. };
  239. function resetDevice(data) {
  240. }
  241. function handlerControlModel(data) {
  242. }
  243. watch(monitorDataGroupNum, (newVal) => {
  244. if (newVal) {
  245. destroy()
  246. mountedThree(newVal)
  247. }
  248. })
  249. onMounted(async () => {
  250. await getMonitor()
  251. })
  252. onUnmounted(() => {
  253. destroy();
  254. if (timer) {
  255. clearTimeout(timer);
  256. timer = undefined;
  257. }
  258. });
  259. </script>
  260. <style lang="less" scoped>
  261. @ventSpace: zxm;
  262. .nitrogen-box {
  263. width: 100%;
  264. height: 100%;
  265. display: flex;
  266. justify-content: center;
  267. }
  268. #nitrogenCss3D {
  269. .modal-monitor {
  270. width: 200px;
  271. position: absolute;
  272. left: 0px;
  273. top: 0px;
  274. }
  275. &:deep(.win) {
  276. margin: 0 !important;
  277. }
  278. }
  279. .nitrogen-home {
  280. width: 100%;
  281. height: 100%;
  282. position: fixed;
  283. z-index: 99;
  284. display: flex;
  285. flex-direction: column;
  286. justify-content: center;
  287. align-items: center;
  288. pointer-events: none;
  289. top: 60px;
  290. .nitrogen-container {
  291. width: 100%;
  292. height: calc(100%);
  293. display: flex;
  294. justify-content: space-between;
  295. margin-bottom: 100px;
  296. .top-box {
  297. width: 100%;
  298. padding: 10px;
  299. overflow: hidden;
  300. display: flex;
  301. justify-content: space-between;
  302. .lr-box {
  303. height: fit-content;
  304. display: flex;
  305. flex-direction: column;
  306. position: relative;
  307. overflow: hidden;
  308. z-index: 9999;
  309. pointer-events: auto;
  310. }
  311. .item {
  312. width: 335px;
  313. height: auto;
  314. position: relative;
  315. border-radius: 5px;
  316. margin-top: 10px;
  317. margin-bottom: 0px;
  318. pointer-events: auto;
  319. color: #fff;
  320. overflow: hidden;
  321. .base-title {
  322. color: #fff;
  323. margin-bottom: 8px;
  324. padding-left: 10px;
  325. position: relative;
  326. font-size: 16px;
  327. &::after{
  328. content: '';
  329. position: absolute;
  330. display: block;
  331. width: 4px;
  332. height: 12px;
  333. top: 7px;
  334. left: 0px;
  335. background: #45d3fd;
  336. border-radius: 4px;
  337. }
  338. }
  339. .state-item {
  340. display: flex;
  341. flex-direction: row;
  342. padding: 5px;
  343. .item-col {
  344. width: calc(50% - 5px);
  345. display: flex;
  346. justify-content: center;
  347. align-items: center;
  348. padding-right: 4px;
  349. background-image: linear-gradient(to right, #39A3FF00, #39A3FF10);
  350. &:first-child{
  351. margin-right: 10px;
  352. }
  353. .state-title {
  354. color: #ffffffcc;
  355. flex: 9;
  356. font-size: 14px;
  357. }
  358. .state-val {
  359. flex: 1;
  360. color: #00eefffe;
  361. margin-right: 5px;
  362. text-align: right;
  363. font-size: 14px;
  364. }
  365. }
  366. }
  367. .signal-box {
  368. margin: 5px 0;
  369. display: flex;
  370. align-items: center;
  371. .signal-title {
  372. color: #7AF5FF;
  373. margin: 0 5px;
  374. }
  375. &:last-child {
  376. margin-right: 0px;
  377. }
  378. }
  379. .list-item {
  380. padding: 0 10px;
  381. display: flex;
  382. justify-content: space-between;
  383. align-items: center;
  384. .item-data-key {
  385. color: #ffffff99;
  386. }
  387. }
  388. .item-data-box {
  389. color: #fff;
  390. .state-icon {
  391. display: inline-block;
  392. width: 12px;
  393. height: 12px;
  394. border-radius: 12px;
  395. }
  396. .open {
  397. border: 5px solid #133a56;
  398. background: #4ecb73;
  399. }
  400. .close {
  401. border: 5px solid #192961;
  402. background: #6d7898;
  403. }
  404. }
  405. }
  406. .item-l {
  407. width: 100%;
  408. .monitor-box {
  409. width: 100%;
  410. .parameter-title{
  411. position: relative;
  412. width: 100%;
  413. height: 14px;
  414. margin-top: 10px;
  415. .icon, span{
  416. position: absolute;
  417. top: -10px;
  418. }
  419. }
  420. .group-parameter-title{
  421. background-image: linear-gradient(to right, #39a3ff50, #39a3ff00);
  422. .icon{
  423. left: -12px;
  424. top: -17px;
  425. }
  426. span{
  427. left: 18px;
  428. }
  429. .item-col{
  430. background-image: linear-gradient(to right, #39A3FF00, #39A3FF10);
  431. }
  432. }
  433. .device-parameter-title{
  434. background-image: linear-gradient(to right, #3df6ff40, #3df6ff00);
  435. .icon{
  436. left: -10px;
  437. top: -14px;
  438. }
  439. span{
  440. left: 18px;
  441. }
  442. .item-col{
  443. background-image: linear-gradient(to right, #3df6ff10, #3df6ff00);
  444. }
  445. }
  446. }
  447. }
  448. .right-box {
  449. width: 330px;
  450. .control-group{
  451. display: flex;
  452. // justify-content: space-around;
  453. flex-wrap: wrap;
  454. .control-item {
  455. display: flex;
  456. flex-direction: column;
  457. justify-content: center;
  458. align-items: center;
  459. padding: 0 4px;
  460. .control-item-title{
  461. color: #A6DCE9;
  462. position: relative;
  463. top: 5px;
  464. }
  465. .control-item-state{
  466. width: 94px;
  467. height: 47px;
  468. background: url('/@/assets/images/vent/control-switch-bg.png');
  469. display: flex;
  470. justify-content: center;
  471. align-items: center;
  472. color: #fff;
  473. }
  474. .button-box {
  475. position: relative;
  476. padding: 5px;
  477. border: 1px transparent solid;
  478. background-clip: border-box;
  479. border-radius: 5px;
  480. margin-left: 8px;
  481. }
  482. .a-button {
  483. pointer-events: auto;
  484. }
  485. &::v-deep .a-button--mini {
  486. padding: 6px 10px;
  487. }
  488. &::v-deep .a-button--mini.is-round {
  489. padding: 6px 10px;
  490. }
  491. }
  492. }
  493. }
  494. .left-box {
  495. width: 385px;
  496. }
  497. }
  498. &:deep(.win) {
  499. width: 100%;
  500. margin: 0 !important;
  501. }
  502. }
  503. }
  504. &:deep(.main) {
  505. .title {
  506. height: 34px;
  507. text-align: center;
  508. font-weight: 600;
  509. color: #7AF5FF;
  510. // background-image: url('../../../assets/img/yfj/light.png');
  511. background-repeat: no-repeat;
  512. background-position-x: center;
  513. background-position-y: 100%;
  514. background-size: 80%;
  515. font-size: 16px;
  516. }
  517. .monitor-item {
  518. width: 200px;
  519. display: flex;
  520. flex-direction: row;
  521. width: auto;
  522. margin-bottom: 3px;
  523. .monitor-val {
  524. color: #ffb700;
  525. display: flex;
  526. width: auto;
  527. .val {
  528. width: 80px;
  529. font-size: 14px;
  530. }
  531. .unit {
  532. color: #ffffffbb;
  533. font-size: 14px;
  534. }
  535. }
  536. }
  537. .monitor-title {
  538. width: 100px;
  539. color: #7AF5FF;
  540. font-weight: 400;
  541. font-size: 14px;
  542. }
  543. .signal-item {
  544. display: flex;
  545. justify-content: space-between;
  546. // margin-bottom: 5px;
  547. .signal-round {
  548. display: inline-block;
  549. width: 8px;
  550. height: 8px;
  551. border-radius: 50%;
  552. margin: 0 10px;
  553. position: relative;
  554. &::after {
  555. display: block;
  556. content: '';
  557. position: absolute;
  558. width: 12px;
  559. height: 12px;
  560. top: -2px;
  561. left: -2px;
  562. border-radius: 50%;
  563. }
  564. }
  565. .signal-round-gry {
  566. background-color: #858585;
  567. &::after {
  568. background-color: #85858544;
  569. box-shadow: 0 0 1px 1px #85858599;
  570. }
  571. }
  572. .signal-round-run {
  573. background-color: #67FC00;
  574. &::after {
  575. background-color: #67FC0044;
  576. box-shadow: 0 0 1px 1px #c6ff77;
  577. }
  578. }
  579. .signal-round-warning {
  580. background-color: #E9170B;
  581. &::after {
  582. background-color: #E9170B44;
  583. box-shadow: 0 0 1px 1px #E9170B;
  584. }
  585. }
  586. }
  587. }
  588. :deep(.zxm-radio-wrapper){
  589. color: #fff !important;
  590. }
  591. </style>