nitrogenHome.vue 20 KB

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