groutHome.vue 12 KB

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