groutHome.vue 15 KB

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