nitrogenHome1.vue 20 KB

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