groutHomehlg.vue 13 KB

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