nitrogenHome.vue 22 KB

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