groutHome.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550
  1. <template>
  2. <div class="monitor-container">
  3. <div class="lr left-box">
  4. <div class="monitor-info item-box">
  5. <ventBox1>
  6. <template #title>
  7. <div>设备信息监测</div>
  8. </template>
  9. <template #container v-if="dataSource.length > 0">
  10. <div v-for="(monitor, key) in deviceMonitorData" :key="key" class="monitor-item">
  11. <div class="item-title">{{ monitor.text }}</div>
  12. <div class="item-val">{{
  13. key.startsWith('1#')
  14. ? dataSource[0][key.split('_')[1]] || '-'
  15. : key.startsWith('2#')
  16. ? dataSource[1][key.split('_')[1]] || '-'
  17. : dataSource[0][key] || '-'
  18. }}</div>
  19. <div class="item-unit">{{ monitor.unit }}</div>
  20. </div>
  21. </template>
  22. </ventBox1>
  23. </div>
  24. <div class="warning-group">
  25. <ventBox1>
  26. <template #title>
  27. <div>近一月报警情况</div>
  28. </template>
  29. <template #container>
  30. <dv-scroll-board ref="scrollBoard" :config="warningConfig" style="width: 100%; height: 240px; overflow-y: auto" />
  31. </template>
  32. </ventBox1>
  33. </div>
  34. <div class="item-box vent-margin-t-10">
  35. <!-- <LivePlayer id="fm-player1" style="height: 220px;" ref="player1" :videoUrl="flvURL1()" muted live loading controls /> -->
  36. </div>
  37. </div>
  38. <div class="lr right-box">
  39. <div class="control-container item-box">
  40. <ventBox1>
  41. <template #title>
  42. <div>设备设施集中控制</div>
  43. </template>
  44. <template #container>
  45. <div class="control-group">
  46. <div class="control-item" v-for="(item, key) in deviceControlData" :key="key">
  47. <div class="control-item-title">{{ item }}</div>
  48. <div class="control-item-state" v-if="!key.startsWith('2#')">
  49. <a-switch
  50. v-model="dataSource[0][key.split('_')[1]]"
  51. size="small"
  52. checked-children="开启"
  53. un-checked-children="关闭"
  54. @change="handlerDevice(dataSource[0][key.split('_')[1]])"
  55. />
  56. </div>
  57. <div class="control-item-state" v-else>
  58. <a-switch
  59. v-model="dataSource[1][key.split('_')[1]]"
  60. size="small"
  61. checked-children="开启"
  62. un-checked-children="关闭"
  63. @change="handlerDevice(dataSource[1][key.split('_')[1]])"
  64. />
  65. </div>
  66. </div>
  67. </div>
  68. <a-divider style="height: 1px; background-color: #d7d7d755" />
  69. <div class="control-btn-group">
  70. <div class="control-left-box">
  71. <div class="btn-box">
  72. <span @click="handlerDevice({ remote: true })">远程</span>
  73. <span @click="handlerDevice({ remote: false })">就地</span>
  74. </div>
  75. <div class="icon-box" :class="{ 'remote-icon-box': true }">
  76. <div class="icon"></div>
  77. </div>
  78. </div>
  79. <div class="control-right-box">
  80. <a-button class="btn" type="primary" @click="handlerDevice({ run: true })">一键启动</a-button>
  81. <a-button type="primary" danger @click="handlerDevice({ run: false })">紧急停止</a-button>
  82. </div>
  83. </div>
  84. <a-divider style="height: 1px; background-color: #d7d7d755" />
  85. <div class="parameter-btn-group">
  86. <a-button type="primary" @click="openModal('RunParameterModal')">参数设置</a-button>
  87. <a-button type="primary" @click="openModal('WarningParameterModal')">报警设置</a-button>
  88. </div>
  89. </template>
  90. </ventBox1>
  91. </div>
  92. <div class="control-container item-box echarts-box">
  93. <ventBox1>
  94. <template #title>
  95. <div>设备实时监测曲线</div>
  96. </template>
  97. <template #container>
  98. <div class="btn-group">
  99. <span class="active">注浆流量</span>
  100. <span>注浆压力</span>
  101. <span>水舱液位</span>
  102. <span>注浆筒液位</span>
  103. </div>
  104. <div class="item-box echarts-container">
  105. <div class="echarts-group">
  106. <div class="echarts-item">
  107. <BarAndLineCustom
  108. xAxisPropType="readTime"
  109. :chartData="dataSource"
  110. height="240px"
  111. :propTypeArr="['flowRate']"
  112. :option="zhujiangOption"
  113. />
  114. </div>
  115. <div class="echarts-item">
  116. <BarAndLineCustom
  117. xAxisPropType="readTime"
  118. :chartData="dataSource"
  119. height="240px"
  120. :propTypeArr="['pressure']"
  121. :option="yaliOption"
  122. />
  123. </div>
  124. <div class="echarts-item">
  125. <BarAndLineCustom
  126. xAxisPropType="readTime"
  127. :chartData="dataSource"
  128. height="240px"
  129. :propTypeArr="['flowRate']"
  130. :option="zhujiangOption"
  131. />
  132. </div>
  133. <div class="echarts-item">
  134. <BarAndLineCustom
  135. xAxisPropType="readTime"
  136. :chartData="dataSource"
  137. height="240px"
  138. :propTypeArr="['flowRate']"
  139. :option="zhujiangOption"
  140. />
  141. </div>
  142. </div>
  143. </div>
  144. </template>
  145. </ventBox1>
  146. </div>
  147. </div>
  148. </div>
  149. <component v-if="modalVisible" :is="currentModal" v-model:visible="modalVisible" />
  150. </template>
  151. <script setup lang="ts">
  152. import { onBeforeMount, ref, onMounted, onUnmounted, shallowRef, defineProps, ComponentOptions, reactive } from 'vue';
  153. import { mountedThree, destroy, setModelType } from '../grout.threejs';
  154. import { ScrollBoard as DvScrollBoard } from '@kjgl77/datav-vue3';
  155. import ventBox1 from '/@/components/vent/ventBox1.vue';
  156. import RunParameterModal from './runParameter.modal.vue';
  157. import WarningParameterModal from './warningParameter.modal.vue';
  158. import { warningConfig, zhujiangOption, yaliOption } from '../grout.data';
  159. import { list } from '../grout.api';
  160. import BarAndLineCustom from '/@/components/chart/BarAndLineCustom.vue';
  161. const props = defineProps({
  162. deviceId: {
  163. type: String,
  164. require: true,
  165. },
  166. deviceType: {
  167. type: String,
  168. require: true,
  169. },
  170. });
  171. const left: string = '0px';
  172. const currentModal = shallowRef<Nullable<ComponentOptions>>(null); //模态框
  173. const modalVisible = ref<Boolean>(false); // 模态框是否可见
  174. const loading = ref(false);
  175. // 默认初始是第一行
  176. const dataSource = ref([
  177. {
  178. waterSupply: '-',
  179. beltVla: '-',
  180. density: '-',
  181. pressure: '-',
  182. liquidLevel: '-',
  183. flowRate: '-',
  184. readTime: '',
  185. },
  186. {
  187. waterSupply: '-',
  188. beltVla: '-',
  189. density: '-',
  190. pressure: '-',
  191. liquidLevel: '-',
  192. flowRate: '-',
  193. readTime: '',
  194. },
  195. ]); //dusting
  196. const deviceMonitorData = {
  197. '1#_waterSupply': { text: '1#制浆机供水流量', unit: 'm³/h' },
  198. '1#_beltVla': { text: '1#皮带秤数值', unit: 'T' },
  199. '2#_waterSupply': { text: '2#制浆机供水流量', unit: 'm³/h' },
  200. '2#_beltVla': { text: '2#皮带秤数值', unit: 'T' },
  201. density: { text: '密度', unit: 'g/cm' },
  202. pressure: { text: '压力', unit: 'MPa' },
  203. liquidLevel: { text: '缓冲池液位', unit: 'm' },
  204. flowRate: { text: '注浆流量', unit: 'm³/h' },
  205. };
  206. const deviceControlData = {
  207. '1#_waterPump': '1#清水泵',
  208. '1#_groutingPump': '1#注浆泵',
  209. '1#_pulpingMachine': '1#制浆机',
  210. '2#_waterPump': '2#清水泵',
  211. '2#_groutingPump': '2#注浆泵',
  212. '2#_pulpingMachine': '2#制浆机',
  213. 'liquidLevelProtect ': '液位保护',
  214. };
  215. const flvURL1 = () => {
  216. return `https://sf1-hscdn-tos.pstatp.com/obj/media-fe/xgplayer_doc_video/flv/xgplayer-demo-360p.flv`;
  217. // return ''
  218. };
  219. const openModal = (modalName) => {
  220. modalVisible.value = true;
  221. if (modalName == 'RunParameterModal') {
  222. currentModal.value = RunParameterModal;
  223. } else {
  224. currentModal.value = WarningParameterModal;
  225. }
  226. };
  227. // https获取监测数据
  228. let timer: null | NodeJS.Timeout = null;
  229. function getMonitor(flag?) {
  230. if (Object.prototype.toString.call(timer) === '[object Null]') {
  231. timer = setTimeout(
  232. async () => {
  233. await getDataSource();
  234. if (timer) {
  235. timer = null;
  236. }
  237. await getMonitor();
  238. },
  239. flag ? 0 : 1000
  240. );
  241. }
  242. }
  243. async function getDataSource() {
  244. const res = await list({ devicetype: 'pulping_auto', pagetype: 'normal' });
  245. const dataList = res.msgTxt[0].datalist || [];
  246. dataSource.value = dataList.filter((data) => {
  247. const item = data.readData;
  248. Object.assign(data, item);
  249. return item;
  250. });
  251. }
  252. function handlerDevice(param: string | Object) {}
  253. function controlDevice(flag) {}
  254. onBeforeMount(() => {});
  255. onMounted(() => {
  256. loading.value = true;
  257. mountedThree().then(async () => {
  258. // await setModelType('groutBase');
  259. await setModelType('bertaiBase');
  260. loading.value = false;
  261. timer = null;
  262. await getMonitor(true);
  263. });
  264. });
  265. onUnmounted(() => {
  266. destroy();
  267. if (timer) {
  268. clearTimeout(timer);
  269. timer = undefined;
  270. }
  271. });
  272. </script>
  273. <style lang="less" scoped>
  274. @import '/@/design/vent/modal.less';
  275. @ventSpace: zxm;
  276. .monitor-container {
  277. width: 100%;
  278. height: 100%;
  279. // height: 550px;
  280. // border: 1px solid #fff;
  281. margin-top: 40px;
  282. display: flex;
  283. justify-content: space-between;
  284. padding: 0 5px;
  285. .lr {
  286. width: 350px;
  287. height: 100%;
  288. display: flex;
  289. flex-direction: column;
  290. margin-top: 10px;
  291. pointer-events: auto;
  292. }
  293. .right-box {
  294. width: 320px;
  295. margin-top: 30px;
  296. .control-group {
  297. display: flex;
  298. flex-wrap: wrap;
  299. .control-item {
  300. display: flex;
  301. flex-direction: column;
  302. justify-content: center;
  303. align-items: center;
  304. padding: 0 2px;
  305. .control-item-title {
  306. color: #63e0ff;
  307. position: relative;
  308. top: 5px;
  309. }
  310. .control-item-state {
  311. width: 94px;
  312. height: 47px;
  313. background: url('/@/assets/images/vent/control-switch-bg.png');
  314. display: flex;
  315. justify-content: center;
  316. align-items: center;
  317. color: #fff;
  318. }
  319. .button-box {
  320. position: relative;
  321. padding: 5px;
  322. border: 1px transparent solid;
  323. background-clip: border-box;
  324. border-radius: 5px;
  325. margin-left: 8px;
  326. }
  327. .a-button {
  328. pointer-events: auto;
  329. }
  330. &::v-deep .a-button--mini {
  331. padding: 6px 10px;
  332. }
  333. &::v-deep .a-button--mini.is-round {
  334. padding: 6px 10px;
  335. }
  336. }
  337. }
  338. .control-btn-group {
  339. display: flex;
  340. flex-direction: row;
  341. justify-content: space-between;
  342. .control-left-box {
  343. display: flex;
  344. flex-direction: column;
  345. justify-content: center;
  346. align-items: center;
  347. padding: 0 20px;
  348. .btn-box {
  349. width: 100px;
  350. color: #fff;
  351. display: flex;
  352. justify-content: space-between;
  353. span {
  354. display: inline-block;
  355. padding: 2px 8px;
  356. background: #007099;
  357. border-radius: 4px;
  358. border: 1px solid rgb(125, 230, 249);
  359. cursor: pointer;
  360. &:hover {
  361. background: #005574;
  362. }
  363. }
  364. }
  365. .icon-box {
  366. width: 60px;
  367. height: 60px;
  368. border-radius: 30px;
  369. border: 2px solid #00bcdd;
  370. box-shadow: 0 0 20px #ffffff88;
  371. display: flex;
  372. justify-content: center;
  373. align-items: center;
  374. margin-top: 20px;
  375. .icon {
  376. width: 18px;
  377. height: 18px;
  378. border-radius: 9px;
  379. border: 3px solid #d7f9ff;
  380. position: relative;
  381. background: #00bcdd;
  382. &::before {
  383. position: absolute;
  384. content: '';
  385. width: 2px;
  386. height: 12px;
  387. background-color: #00bcdd;
  388. left: 6px;
  389. top: -16px;
  390. }
  391. &::after {
  392. position: absolute;
  393. content: '';
  394. width: 2px;
  395. height: 12px;
  396. left: 6px;
  397. top: 17px;
  398. background-color: #00d9ff;
  399. }
  400. }
  401. }
  402. .remote-icon-box {
  403. transform: rotate(30deg);
  404. animation: iconRotate 1s linear;
  405. }
  406. .remote-icon-box1 {
  407. transform: rotate(-30deg);
  408. animation: iconRotate1 1s linear;
  409. }
  410. @keyframes iconRotate {
  411. from {
  412. transform: rotate(-30deg);
  413. }
  414. to {
  415. transform: rotate(30deg);
  416. }
  417. }
  418. @keyframes iconRotate1 {
  419. from {
  420. transform: rotate(30deg);
  421. }
  422. to {
  423. transform: rotate(-30deg);
  424. }
  425. }
  426. }
  427. .control-right-box {
  428. width: 100px;
  429. .btn {
  430. margin-bottom: 30px;
  431. }
  432. }
  433. }
  434. .parameter-btn-group {
  435. display: flex;
  436. justify-content: space-between;
  437. padding: 0 20px;
  438. margin-bottom: 10px;
  439. }
  440. .echarts-box {
  441. width: 100%;
  442. height: 332px;
  443. position: relative;
  444. &:deep(.box-container) {
  445. padding: 0px !important;
  446. }
  447. .btn-group {
  448. line-height: 30px;
  449. color: #fff;
  450. text-align: center;
  451. margin-top: 3px;
  452. span {
  453. padding: 3px 5px;
  454. margin: 0 2px;
  455. border-radius: 2px;
  456. background-image: linear-gradient(#32475b, #5b95c7);
  457. border: 1px solid #32475b;
  458. cursor: pointer;
  459. }
  460. .active {
  461. background-image: linear-gradient(#2e4659, #37a7b4);
  462. border-top: 1px solid #3df6ff;
  463. }
  464. }
  465. .echarts-container {
  466. width: 100%;
  467. height: 240px;
  468. overflow: hidden;
  469. position: relative;
  470. .echarts-group {
  471. display: flex;
  472. flex-direction: row;
  473. position: absolute;
  474. left: v-bind(left);
  475. .echarts-item {
  476. width: 305px;
  477. }
  478. }
  479. }
  480. }
  481. }
  482. .left-box {
  483. margin-top: 30px;
  484. .monitor-item {
  485. display: flex;
  486. color: #fff;
  487. justify-content: space-between;
  488. background-image: linear-gradient(to left, #3df6ff10, #3df6ff00);
  489. margin: 10px 0;
  490. .item-title {
  491. width: 200px;
  492. margin-left: 10px;
  493. }
  494. .item-val {
  495. width: 80px;
  496. color: #00eefffe;
  497. }
  498. .item-unit {
  499. width: 80px;
  500. }
  501. }
  502. }
  503. .item-box {
  504. margin-bottom: 15px;
  505. }
  506. }
  507. :deep(.@{ventSpace}-tabs-tabpane-active) {
  508. overflow: auto;
  509. }
  510. .input-box {
  511. display: flex;
  512. align-items: center;
  513. padding-left: 10px;
  514. .input-title {
  515. color: #73e8fe;
  516. width: auto;
  517. }
  518. .@{ventSpace}-input-number {
  519. border-color: #ffffff88 !important;
  520. }
  521. margin-right: 10px;
  522. }
  523. </style>