groutHomelt.vue 14 KB

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