screenFront/src/views/Mechanics/child/station/index.vue

114 lines
2.4 KiB
Vue
Raw Normal View History

2024-01-09 00:37:13 +00:00
<!--
* @FilePath: index.vue
* @Author: zz
* @Date: 2023-12-28 15:29:14
* @LastEditors: Please set LastEditors
* @LastEditTime: 2024-01-04 15:33:20
* @Descripttion:
-->
<template>
<div class="container">
<div class="bj">
<div class="text">
2024-01-31 07:47:45 +00:00
<span>{{ ori_data.name }}数据监控平台</span>
2024-01-09 00:37:13 +00:00
</div>
<div class="date">
<p class="date-time">{{ timeHtml }}</p>
</div>
2024-01-30 08:44:35 +00:00
<Float :top_data="topData"></Float>
2024-01-31 07:47:45 +00:00
<Sum :bottom_data="bottomData"></Sum>
2024-01-09 00:37:13 +00:00
</div>
</div>
</template>
<script setup lang="ts">
2024-02-01 09:08:15 +00:00
import { ref, getCurrentInstance, reactive, onMounted,watch } from "vue";
2024-01-31 07:47:45 +00:00
import { reqHologramDataMF} from "@/http/Mechanics"
2024-02-01 09:08:15 +00:00
import { connectWebsocket, closeWebsocket } from "@/utils/websocket";
2024-01-31 07:47:45 +00:00
import handleData from "./handle"
2024-01-12 09:05:48 +00:00
import { useRoute } from "vue-router";
2024-01-09 00:37:13 +00:00
import Sum from "./components/sum.vue";
import Float from "./components/float.vue";
import useNowTime from "@/hook/nowTime";
let { timeHtml } = useNowTime();
2024-01-12 09:05:48 +00:00
let route = useRoute();
2024-01-09 00:37:13 +00:00
2024-01-31 07:47:45 +00:00
let ori_data = ref({
name: "机床1",
2024-01-12 09:05:48 +00:00
image: "/dev-api/profile/upload/2023/12/17/cc3940d1e85e4861845e797213802975.png",
2024-01-31 07:47:45 +00:00
})
let topData = ref([]);
let bottomData = ref({})
function getHologramDataMF() {
reqHologramDataMF({id:route.params.id}).then((res:any) => {
if (res.code == 200&&res.data) {
ori_data.value = res.data;
let handle = handleData(ori_data.value)
topData.value = handle.top;
bottomData.value = handle.bottom;
}
});
}
2024-02-01 09:08:15 +00:00
function getWebsocket(val) {
try {
let data = JSON.parse(val);
//实时推送的数据
if (data.type == "HologramDataMFInfo") {
}
} catch (err) {}
}
function errWebsocket(val) {
// console.log(val);
}
2024-01-31 07:47:45 +00:00
onMounted(() => {
getHologramDataMF();
2024-02-01 09:08:15 +00:00
connectWebsocket(null, null, getWebsocket, errWebsocket);
2024-01-09 09:06:41 +00:00
});
2024-01-09 00:37:13 +00:00
</script>
<style scoped>
.container {
height: 1080px;
width: 1920px;
position: relative;
}
2024-01-09 09:06:41 +00:00
2024-01-09 00:37:13 +00:00
.bj {
width: 100%;
height: 100%;
padding: 16px 16px 10px 16px;
box-sizing: border-box;
background-image: url(./img/u0.png);
background-size: cover;
background-position: center center;
color: #aeeefa;
2024-01-09 09:06:41 +00:00
2024-01-09 00:37:13 +00:00
.text {
position: absolute;
top: 25px;
left: 38px;
width: 614px;
height: 53px;
2024-01-31 07:47:45 +00:00
font-size: 48px;
2024-01-09 00:37:13 +00:00
color: #aeeefa;
font-family: "华文新魏", sans-serif;
}
}
2024-01-09 09:06:41 +00:00
2024-01-09 00:37:13 +00:00
.date {
font-size: 28px;
height: 6%;
display: flex;
justify-content: flex-end;
align-items: center;
}
.date-time {
margin-right: 125px;
2024-01-12 09:05:48 +00:00
}
</style>