groutHomehlg.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538
  1. <template>
  2. <div class="monitor-container">
  3. <div class="area-box lr-box">
  4. <div class="item item-l" v-for="groupNum in monitorDataGroupNum" :key="groupNum">
  5. <ventBox1>
  6. <template #title>
  7. <div>注浆站输出监测</div>
  8. </template>
  9. <template #container>
  10. <div class="monitor-box">
  11. <div class="monitor-item">
  12. <div class="state-item" v-for="(preFan, index) in groutFanMonitorDataHlg" :key="index">
  13. <div class="state-title">{{ preFan.title }}</div>
  14. <div v-if="preFan.unit !== 'signal'" class="state-val">{{
  15. monitorData[preFan.code] >= 0 ? formatNum(Number(monitorData[preFan.code])) : '-'
  16. }}</div>
  17. <div
  18. v-else-if="preFan.code=='Running'"
  19. :class="{
  20. 'signal-round': true,
  21. 'signal-round-warning': monitorData[preFan.code] == '0',
  22. 'signal-round-run': monitorData[preFan.code] == '1',
  23. 'signal-round-gry': monitorData[preFan.code] != '0' && monitorData[preFan.code] != '1',
  24. }"
  25. ></div>
  26. <div
  27. v-else
  28. :class="{
  29. 'signal-round': true,
  30. 'signal-round-warning': monitorData[preFan.code] == '1',
  31. 'signal-round-run': monitorData[preFan.code] == '0',
  32. 'signal-round-gry': monitorData[preFan.code] != '0' && monitorData[preFan.code] != '1',
  33. }"
  34. ></div>
  35. </div>
  36. </div>
  37. </div>
  38. </template>
  39. </ventBox1>
  40. </div>
  41. </div>
  42. <div class="header-box">
  43. <div class="header-container">
  44. <div class="device-detail">
  45. <div class="device-title">&nbsp</div>
  46. <div class="device-val">故障代码</div>
  47. <div class="device-val">警告代码</div>
  48. </div>
  49. <div v-for="(device, key) in deviceMonitorListHlg" class="device-detail" :key="key">
  50. <div class="device-title">{{ device.title }}</div>
  51. <div v-for="(detailItem, index) in device.dataList" :key="detailItem.code" class="device-val">
  52. <span v-if="index == 0" :style="{ color: monitorData[detailItem.code] == '0' ? '#BFBFBF' : '#10BC79' }">{{
  53. monitorData[detailItem.code]
  54. }}</span>
  55. <span v-if="index == 1" :style="{ color: monitorData[detailItem.code] == '0' ? '#BFBFBF' : '#10BC79' }">{{
  56. monitorData[detailItem.code]
  57. }}</span>
  58. </div>
  59. </div>
  60. </div>
  61. </div>
  62. <div ref="playerRef" style="z-index: 9999; position: absolute; top: 0px; right: 15px; height: 100%; margin: auto; pointer-events: none"> </div>
  63. </div>
  64. </template>
  65. <script setup lang="ts">
  66. import { watch, ref, onMounted, onUnmounted, defineProps, reactive } from 'vue';
  67. import ventBox1 from '/@/components/vent/ventBox1.vue';
  68. import { mountedThree, destroy, setModelType } from '../grout.threejs';
  69. import { formatNum } from '/@/utils/ventutil';
  70. import { deviceMonitorListHlg, groutFanMonitorDataHlg } from '../grout.data';
  71. import { device } from '../grout.api';
  72. import { useCamera } from '/@/hooks/system/useCamera';
  73. const props = defineProps({
  74. deviceId: {
  75. type: String,
  76. require: true,
  77. },
  78. deviceType: {
  79. type: String,
  80. require: true,
  81. },
  82. });
  83. let monitorDataGroupNum = ref(1);
  84. const loading = ref(false);
  85. const monitorData = ref({});
  86. const playerRef = ref();
  87. const { getCamera, removeCamera } = useCamera();
  88. // https获取监测数据
  89. let timer: null | NodeJS.Timeout = null;
  90. function getMonitor(flag?) {
  91. if (Object.prototype.toString.call(timer) === '[object Null]') {
  92. return new Promise((resolve) => {
  93. timer = setTimeout(
  94. async () => {
  95. if (props.deviceId) {
  96. await getDataSource(props.deviceId);
  97. }
  98. if (timer) {
  99. timer = null;
  100. }
  101. resolve(null);
  102. await getMonitor();
  103. },
  104. flag ? 0 : 1000
  105. );
  106. });
  107. }
  108. }
  109. async function getDataSource(systemID) {
  110. // const res = await list({ devicetype: 'pulping_auto', systemID, pagetype: 'normal' });
  111. const res = await device({ devicetype: 'pulping', pagetype: 'normal' });
  112. if(res && res.result.msgTxt[0]){
  113. const result = res.result.msgTxt[0];
  114. if (result.type.startsWith('pulping')) {
  115. monitorData.value = Object.assign(result['datalist'][0], result['datalist'][0]['readData']);
  116. }
  117. loading.value = false;
  118. }else {
  119. monitorData.value={}
  120. }
  121. }
  122. watch(
  123. () => props.deviceId,
  124. async (deviceId) => {
  125. if (deviceId) {
  126. await getCamera(deviceId, playerRef.value, 'pulping');
  127. }
  128. }
  129. );
  130. onMounted(() => {
  131. getMonitor(true)?.then(async () => {
  132. if (props.deviceId) await getCamera(props.deviceId, playerRef.value, 'pulping');
  133. });
  134. loading.value = true;
  135. mountedThree().then(async () => {
  136. // await setModelType('groutBase');
  137. await setModelType('bertaiBase');
  138. loading.value = false;
  139. timer = null;
  140. });
  141. });
  142. onUnmounted(() => {
  143. destroy();
  144. removeCamera();
  145. if (timer) {
  146. clearTimeout(timer);
  147. timer = undefined;
  148. }
  149. });
  150. </script>
  151. <style lang="less" scoped>
  152. @import '/@/design/theme.less';
  153. @import '/@/design/vent/modal.less';
  154. @ventSpace: zxm;
  155. @{theme-deepblue} {
  156. .monitor-container {
  157. --box-shadow: #316b92;
  158. --border-color: #0a80fad4;
  159. }
  160. }
  161. .monitor-container {
  162. --box-shadow: #0099b8;
  163. --border-color: #00baffd4;
  164. position:relative;
  165. width: 100%;
  166. height: 100%;
  167. // height: 550px;
  168. // border: 1px solid #fff;
  169. margin-top: 80px;
  170. // display: flex;
  171. // justify-content: space-between;
  172. // justify-content: center;
  173. padding: 0 5px;
  174. .header-box {
  175. position:absolute;
  176. bottom:20px;
  177. left:50%;
  178. transform:translate(-50%,0%);
  179. // margin: 50px 15px 0px 15px;
  180. .header-container {
  181. height: auto;
  182. display: flex;
  183. flex-direction: row;
  184. justify-content: center;
  185. color: #fff;
  186. box-shadow: 0 0 30px var(--box-shadow) inset;
  187. margin-top: 500px;
  188. }
  189. .device-title {
  190. width: 130px;
  191. text-align: center;
  192. border-top: 1px solid var(--border-color);
  193. border-left: 1px solid var(--border-color);
  194. line-height: 46px;
  195. color: var(--vent-table-action-link);
  196. background-color: #00bbff21;
  197. backdrop-filter: blur(5px);
  198. }
  199. .device-detail {
  200. text-align: center;
  201. &:first-child {
  202. background-color: #00bbff11;
  203. }
  204. &:last-child {
  205. .device-val,
  206. .device-title {
  207. border-right: 1px solid var(--border-color);
  208. }
  209. }
  210. .device-val {
  211. line-height: 36px;
  212. border-top: 1px solid var(--border-color);
  213. border-left: 1px solid var(--border-color);
  214. &:last-child {
  215. border-bottom: 1px solid var(--border-color);
  216. }
  217. }
  218. }
  219. }
  220. .lr-box {
  221. height: 100%;
  222. display: flex;
  223. flex-direction: column;
  224. position: relative;
  225. // overflow: hidden;
  226. z-index: 9999;
  227. pointer-events: auto;
  228. overflow-y: auto;
  229. overflow-x: hidden;
  230. }
  231. .area-box {
  232. width: 335px;
  233. margin-top: 50px;
  234. .input-item {
  235. display: flex;
  236. justify-content: space-between;
  237. align-items: center;
  238. padding: 4px 8px;
  239. margin: 6px 0;
  240. background-image: linear-gradient(to right, #39deff15, #3977e500);
  241. .title {
  242. width: 200px;
  243. }
  244. .title-auto {
  245. width: auto;
  246. }
  247. .input-value {
  248. width: 80px;
  249. height: 28px;
  250. line-height: 28px !important;
  251. background: transparent !important;
  252. border-color: #228da2 !important;
  253. color: #fff !important;
  254. }
  255. .value {
  256. width: 100px;
  257. color: #00d8ff;
  258. padding-right: 20px;
  259. }
  260. .unit {
  261. width: 80px;
  262. }
  263. }
  264. }
  265. .item {
  266. width: 305px;
  267. height: 450px;
  268. position: relative;
  269. border-radius: 5px;
  270. margin-top: 10px;
  271. margin-bottom: 0px;
  272. pointer-events: auto;
  273. color: #fff;
  274. // overflow: hidden;
  275. &:first-child {
  276. margin-top: 0px;
  277. }
  278. .base-title {
  279. color: #fff;
  280. margin-bottom: 8px;
  281. padding-left: 10px;
  282. position: relative;
  283. font-size: 16px;
  284. &::after {
  285. content: '';
  286. position: absolute;
  287. display: block;
  288. width: 4px;
  289. height: 12px;
  290. top: 7px;
  291. left: 0px;
  292. background: #45d3fd;
  293. border-radius: 4px;
  294. }
  295. }
  296. .monitor-item {
  297. width: 100%;
  298. display: flex;
  299. flex-direction: row;
  300. flex-wrap: wrap;
  301. .state-item {
  302. width: 50%;
  303. padding: 5px;
  304. display: flex;
  305. align-items: center;
  306. justify-content: space-between;
  307. .state-title {
  308. width: 100px;
  309. color: #ffffffdd;
  310. flex: 9;
  311. font-size: 14px;
  312. .unit {
  313. // color: #ffffffbb;
  314. }
  315. }
  316. .state-val {
  317. flex: 1;
  318. color: #e4a300;
  319. margin-right: 5px;
  320. text-align: right;
  321. font-size: 14px;
  322. }
  323. }
  324. }
  325. .signal-box {
  326. margin: 5px 0;
  327. display: flex;
  328. align-items: center;
  329. .signal-title {
  330. color: #7af5ff;
  331. margin: 0 5px;
  332. }
  333. &:last-child {
  334. margin-right: 0px;
  335. }
  336. }
  337. .list-item {
  338. padding: 0 10px;
  339. display: flex;
  340. justify-content: space-between;
  341. align-items: center;
  342. .item-data-key {
  343. color: #ffffff99;
  344. }
  345. }
  346. .item-data-box {
  347. color: #fff;
  348. .state-icon {
  349. display: inline-block;
  350. width: 12px;
  351. height: 12px;
  352. border-radius: 12px;
  353. }
  354. .open {
  355. border: 5px solid #133a56;
  356. background: #4ecb73;
  357. }
  358. .close {
  359. border: 5px solid #192961;
  360. background: #6d7898;
  361. }
  362. }
  363. }
  364. .item-l {
  365. width: 100%;
  366. .monitor-box {
  367. width: 100%;
  368. .parameter-title {
  369. position: relative;
  370. width: 100%;
  371. height: 14px;
  372. margin-top: 10px;
  373. .icon,
  374. span {
  375. position: absolute;
  376. top: -10px;
  377. }
  378. }
  379. .group-parameter-title {
  380. background-image: linear-gradient(to right, #39a3ff50, #39a3ff00);
  381. .icon {
  382. left: -12px;
  383. top: -17px;
  384. }
  385. span {
  386. left: 18px;
  387. }
  388. .item-col {
  389. background-image: linear-gradient(to right, #39a3ff00, #39a3ff10);
  390. }
  391. }
  392. .device-parameter-title {
  393. background-image: linear-gradient(to right, #3df6ff40, #3df6ff00);
  394. .icon {
  395. left: -10px;
  396. top: -14px;
  397. }
  398. span {
  399. left: 18px;
  400. }
  401. .item-col {
  402. background-image: linear-gradient(to right, #3df6ff10, #3df6ff00);
  403. }
  404. }
  405. }
  406. }
  407. .signal-round {
  408. display: inline-block;
  409. width: 8px;
  410. height: 8px;
  411. border-radius: 50%;
  412. // margin: 0 10px;
  413. margin: 0 5px;
  414. position: relative;
  415. &::after {
  416. display: block;
  417. content: '';
  418. position: absolute;
  419. width: 12px;
  420. height: 12px;
  421. top: -2px;
  422. left: -2px;
  423. border-radius: 50%;
  424. }
  425. }
  426. .signal-round-gry {
  427. background-color: #858585;
  428. &::after {
  429. background-color: #85858544;
  430. box-shadow: 0 0 1px 1px #85858599;
  431. }
  432. }
  433. .signal-round-run {
  434. background-color: #67fc00;
  435. &::after {
  436. background-color: #67fc0044;
  437. box-shadow: 0 0 1px 1px #c6ff77;
  438. }
  439. }
  440. .signal-round-warning {
  441. background-color: #e9170b;
  442. &::after {
  443. background-color: #e9170b44;
  444. box-shadow: 0 0 1px 1px #e9170b;
  445. }
  446. }
  447. }
  448. :deep(.@{ventSpace}-tabs-tabpane-active) {
  449. overflow: auto;
  450. }
  451. .input-box {
  452. display: flex;
  453. align-items: center;
  454. padding-left: 10px;
  455. .input-title {
  456. color: #73e8fe;
  457. width: auto;
  458. }
  459. .@{ventSpace}-input-number {
  460. border-color: #ffffff88 !important;
  461. }
  462. margin-right: 10px;
  463. }
  464. </style>