nitrogenHome.vue 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737
  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, 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(4).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. if (!systemID) return;
  298. const res = await list({ devicetype: 'sys', systemID, type: 'all' });
  299. // 数据与机数一次提交:没绑注氮设备的场景一并归零,不残留上一个场景的机器;
  300. // 设备类型统一按 nitrogen 前缀匹配(nitrogen_auto 等)
  301. const nitrogenItem = (res?.msgTxt || []).find((item) => item?.type?.startsWith('nitrogen'));
  302. monitorData.value = (nitrogenItem?.['datalist'] || []).map((data) => Object.assign(data, data.readData || {}));
  303. monitorDataGroupNum.value = monitorData.value.length;
  304. monitorNetStatus.value = monitorData.value.some((data) => data['netStatus'] == 1) ? 1 : 0;
  305. }
  306. function handlerDevice(data) {
  307. // if (data.length < 1) return
  308. // handleAirCompressor({ id: data.id, compressRunF1: data.compressRunSigF1 }).then(res => {
  309. // if (res.success) {
  310. // message.success('操作成功')
  311. // } else {
  312. // message.warning(data.msg)
  313. // }
  314. // })
  315. }
  316. function resetDevice(data) {}
  317. function handlerControlModel(data) {}
  318. watch([monitorDataGroupNum, loading], ([newMonitorDataGroupNum, newLoading]) => {
  319. nextTick(() => {
  320. if (newMonitorDataGroupNum && !newLoading) {
  321. setModelType(props.modalType, newMonitorDataGroupNum);
  322. }
  323. });
  324. });
  325. onMounted(async () => {
  326. await getMonitor(true);
  327. await mountedThree('nitrogen_bjhz').then(() => {
  328. loading.value = false;
  329. });
  330. });
  331. onUnmounted(() => {
  332. destroy();
  333. if (timer) {
  334. clearTimeout(timer);
  335. timer = undefined;
  336. }
  337. });
  338. </script>
  339. <style lang="less" scoped>
  340. @ventSpace: zxm;
  341. .nitrogen-box {
  342. width: 100%;
  343. height: 100%;
  344. display: flex;
  345. justify-content: center;
  346. }
  347. #nitrogenCss3D {
  348. .modal-monitor {
  349. width: 200px;
  350. position: absolute;
  351. left: 0px;
  352. top: 0px;
  353. }
  354. &:deep(.win) {
  355. margin: 0 !important;
  356. background: #00000044;
  357. }
  358. }
  359. .nitrogen-home {
  360. width: 100%;
  361. height: 100%;
  362. position: fixed;
  363. z-index: 9999;
  364. display: flex;
  365. flex-direction: column;
  366. justify-content: center;
  367. align-items: center;
  368. pointer-events: none;
  369. top: 60px;
  370. .nitrogen-container {
  371. width: 100%;
  372. height: calc(100% - 100px);
  373. display: flex;
  374. justify-content: space-between;
  375. margin-bottom: 100px;
  376. .device-state {
  377. width: 100%;
  378. position: absolute;
  379. top: 70px;
  380. color: #e90000;
  381. display: flex;
  382. justify-content: center;
  383. font-size: 20px;
  384. }
  385. .top-box {
  386. width: 100%;
  387. padding: 10px;
  388. overflow: hidden;
  389. display: flex;
  390. justify-content: space-between;
  391. .lr-box {
  392. height: fit-content;
  393. display: flex;
  394. flex-direction: column;
  395. position: relative;
  396. overflow: hidden;
  397. z-index: 9999;
  398. pointer-events: auto;
  399. }
  400. .item {
  401. width: 335px;
  402. height: auto;
  403. position: relative;
  404. border-radius: 5px;
  405. margin-top: 10px;
  406. margin-bottom: 0px;
  407. pointer-events: auto;
  408. color: #fff;
  409. overflow: hidden;
  410. &:first-child {
  411. margin-top: 0px;
  412. }
  413. .base-title {
  414. color: #fff;
  415. margin-bottom: 8px;
  416. padding-left: 10px;
  417. position: relative;
  418. font-size: 16px;
  419. &::after {
  420. content: '';
  421. position: absolute;
  422. display: block;
  423. width: 4px;
  424. height: 12px;
  425. top: 7px;
  426. left: 0px;
  427. background: #45d3fd;
  428. border-radius: 4px;
  429. }
  430. }
  431. .state-item {
  432. display: flex;
  433. flex-direction: row;
  434. padding: 5px;
  435. .item-col {
  436. width: calc(50% - 5px);
  437. display: flex;
  438. justify-content: center;
  439. align-items: center;
  440. padding-right: 4px;
  441. background-image: linear-gradient(to right, #39a3ff00, #39a3ff10);
  442. &:first-child {
  443. margin-right: 10px;
  444. }
  445. .state-title {
  446. color: #ffffffcc;
  447. flex: 9;
  448. font-size: 14px;
  449. }
  450. .state-val {
  451. flex: 1;
  452. color: #00eefffe;
  453. margin-right: 5px;
  454. text-align: right;
  455. font-size: 14px;
  456. }
  457. }
  458. }
  459. .signal-box {
  460. margin: 5px 0;
  461. display: flex;
  462. align-items: center;
  463. .signal-title {
  464. color: #7af5ff;
  465. margin: 0 5px;
  466. }
  467. &:last-child {
  468. margin-right: 0px;
  469. }
  470. }
  471. .list-item {
  472. padding: 0 10px;
  473. display: flex;
  474. justify-content: space-between;
  475. align-items: center;
  476. .item-data-key {
  477. color: #ffffff99;
  478. }
  479. }
  480. .item-data-box {
  481. color: #fff;
  482. .state-icon {
  483. display: inline-block;
  484. width: 12px;
  485. height: 12px;
  486. border-radius: 12px;
  487. }
  488. .open {
  489. border: 5px solid #133a56;
  490. background: #4ecb73;
  491. }
  492. .close {
  493. border: 5px solid #192961;
  494. background: #6d7898;
  495. }
  496. }
  497. }
  498. .item-l {
  499. width: 100%;
  500. .monitor-box {
  501. width: 100%;
  502. .parameter-title {
  503. position: relative;
  504. width: 100%;
  505. height: 14px;
  506. margin-top: 10px;
  507. .icon,
  508. span {
  509. position: absolute;
  510. top: -10px;
  511. }
  512. }
  513. .group-parameter-title {
  514. background-image: linear-gradient(to right, #39a3ff50, #39a3ff00);
  515. .icon {
  516. left: -12px;
  517. top: -17px;
  518. }
  519. span {
  520. left: 18px;
  521. }
  522. .item-col {
  523. background-image: linear-gradient(to right, #39a3ff00, #39a3ff10);
  524. }
  525. }
  526. .device-parameter-title {
  527. background-image: linear-gradient(to right, #3df6ff40, #3df6ff00);
  528. .icon {
  529. left: -10px;
  530. top: -14px;
  531. }
  532. span {
  533. left: 18px;
  534. }
  535. .item-col {
  536. background-image: linear-gradient(to right, #3df6ff10, #3df6ff00);
  537. }
  538. }
  539. }
  540. }
  541. .right-box {
  542. width: 330px;
  543. margin-top: 50px;
  544. .control-group {
  545. display: flex;
  546. // justify-content: space-around;
  547. flex-wrap: wrap;
  548. .control-item {
  549. display: flex;
  550. flex-direction: column;
  551. justify-content: center;
  552. align-items: center;
  553. padding: 0 4px;
  554. .control-item-title {
  555. color: #a6dce9;
  556. position: relative;
  557. top: 5px;
  558. }
  559. .control-item-state {
  560. width: 94px;
  561. height: 47px;
  562. background: url('/@/assets/images/vent/control-switch-bg.png');
  563. display: flex;
  564. justify-content: center;
  565. align-items: center;
  566. color: #fff;
  567. }
  568. .button-box {
  569. position: relative;
  570. padding: 5px;
  571. border: 1px transparent solid;
  572. background-clip: border-box;
  573. border-radius: 5px;
  574. margin-left: 8px;
  575. }
  576. .a-button {
  577. pointer-events: auto;
  578. }
  579. &::v-deep .a-button--mini {
  580. padding: 6px 10px;
  581. }
  582. &::v-deep .a-button--mini.is-round {
  583. padding: 6px 10px;
  584. }
  585. }
  586. }
  587. }
  588. .left-box {
  589. width: 365px;
  590. margin-top: 80px;
  591. }
  592. }
  593. &:deep(.win) {
  594. width: 100%;
  595. margin: 0 !important;
  596. }
  597. }
  598. }
  599. &:deep(.main) {
  600. .title {
  601. height: 34px;
  602. text-align: center;
  603. font-weight: 600;
  604. color: #7af5ff;
  605. // background-image: url('../../../assets/img/yfj/light.png');
  606. background-repeat: no-repeat;
  607. background-position-x: center;
  608. background-position-y: 100%;
  609. background-size: 80%;
  610. font-size: 16px;
  611. }
  612. .monitor-item {
  613. width: 200px;
  614. display: flex;
  615. flex-direction: row;
  616. width: auto;
  617. margin-bottom: 3px;
  618. .monitor-val {
  619. color: #ffb700;
  620. display: flex;
  621. width: auto;
  622. .val {
  623. width: 80px;
  624. font-size: 14px;
  625. }
  626. .unit {
  627. color: #ffffffbb;
  628. font-size: 14px;
  629. }
  630. }
  631. }
  632. .monitor-title {
  633. width: 100px;
  634. color: #7af5ff;
  635. font-weight: 400;
  636. font-size: 14px;
  637. }
  638. .signal-item {
  639. display: flex;
  640. justify-content: space-between;
  641. // margin-bottom: 5px;
  642. .signal-round {
  643. display: inline-block;
  644. width: 8px;
  645. height: 8px;
  646. border-radius: 50%;
  647. margin: 0 10px;
  648. position: relative;
  649. &::after {
  650. display: block;
  651. content: '';
  652. position: absolute;
  653. width: 12px;
  654. height: 12px;
  655. top: -2px;
  656. left: -2px;
  657. border-radius: 50%;
  658. }
  659. }
  660. .signal-round-gry {
  661. background-color: #858585;
  662. &::after {
  663. background-color: #85858544;
  664. box-shadow: 0 0 1px 1px #85858599;
  665. }
  666. }
  667. .signal-round-run {
  668. background-color: #67fc00;
  669. &::after {
  670. background-color: #67fc0044;
  671. box-shadow: 0 0 1px 1px #c6ff77;
  672. }
  673. }
  674. .signal-round-warning {
  675. background-color: #e9170b;
  676. &::after {
  677. background-color: #e9170b44;
  678. box-shadow: 0 0 1px 1px #e9170b;
  679. }
  680. }
  681. }
  682. }
  683. :deep(.zxm-radio-wrapper) {
  684. color: #fff !important;
  685. }
  686. </style>