|
@@ -0,0 +1,336 @@
|
|
|
+<script setup>
|
|
|
+import { ref, onBeforeUnmount, onMounted } from "vue";
|
|
|
+import { userTop } from '@/components';
|
|
|
+import shuizhi from "./components/shuizhi";
|
|
|
+import dataBox from "./components/dataBox";
|
|
|
+import liuliang from "./components/liuliang";
|
|
|
+import gongyi from "./components/gongyi";
|
|
|
+import middleBox from "./components/middleBox";
|
|
|
+import EchartBar from "./components/EchartBar";
|
|
|
+// import motor3d from './3d/renderModel.js';
|
|
|
+import ControlHelper from "./components/ControlHelper";
|
|
|
+import { screenApi } from "@/api/screen"
|
|
|
+import dayjs from 'dayjs';
|
|
|
+import 'dayjs/locale/zh-cn';
|
|
|
+
|
|
|
+dayjs.locale('zh-cn'); // 设置day.js使用中文/ 导入中文语言包
|
|
|
+
|
|
|
+const gongyiData = ref([])
|
|
|
+const reportData = ref({})
|
|
|
+const screenData = ref({})
|
|
|
+const time = ref('')
|
|
|
+let timer = null
|
|
|
+let timeHour = null
|
|
|
+
|
|
|
+const dataTime = ref("");
|
|
|
+
|
|
|
+// 获取工艺管控 助手
|
|
|
+const getWarningList = () => {
|
|
|
+ screenApi.warningList().then(res => {
|
|
|
+ gongyiData.value = res.data || []
|
|
|
+ })
|
|
|
+}
|
|
|
+
|
|
|
+// 获取数据费助手
|
|
|
+const getLeastShortReport = () => {
|
|
|
+ screenApi.getLeastShortReport().then(res => {
|
|
|
+ reportData.value = res.data
|
|
|
+ })
|
|
|
+}
|
|
|
+
|
|
|
+// 获取大屏分析数据
|
|
|
+const getRealTimeData = () => {
|
|
|
+ screenApi.realTimeData().then(res => {
|
|
|
+ screenData.value = res.data
|
|
|
+ dataTime.value = `更新时间:${res.data.testHour}`
|
|
|
+ time.value = dayjs(res.data.timestamp).format('HH:mm:ss')
|
|
|
+ timeHour = setInterval(() => {
|
|
|
+ time.value = updateCurrentTime(res.data.timestamp)
|
|
|
+ }, 1000)
|
|
|
+ })
|
|
|
+}
|
|
|
+
|
|
|
+const updateCurrentTime = (timestamp) => {
|
|
|
+ // 计算从初始时间戳到现在经过的时间
|
|
|
+ const now = dayjs();
|
|
|
+ const initialTime = dayjs(timestamp);
|
|
|
+ const elapsedTime = now.diff(initialTime);
|
|
|
+
|
|
|
+ // 使用初始时间戳加上经过的时间来更新当前时间
|
|
|
+ const currentTime = initialTime.add(elapsedTime, 'millisecond');
|
|
|
+ return currentTime.format('HH:mm:ss');
|
|
|
+}
|
|
|
+const init = () => {
|
|
|
+ getRealTimeData()
|
|
|
+ getWarningList()
|
|
|
+ getLeastShortReport()
|
|
|
+}
|
|
|
+
|
|
|
+init()
|
|
|
+
|
|
|
+onMounted(() => {
|
|
|
+
|
|
|
+ //每5s刷新数据
|
|
|
+ timer = setInterval(() => {
|
|
|
+ init()
|
|
|
+ }, 1000 * 60 * 60)
|
|
|
+})
|
|
|
+
|
|
|
+onBeforeUnmount(() => {
|
|
|
+ clearInterval(timer)
|
|
|
+ clearInterval(timeHour)
|
|
|
+ timer = null;
|
|
|
+ timeHour = null
|
|
|
+})
|
|
|
+
|
|
|
+</script>
|
|
|
+<template>
|
|
|
+ <div class="screen-view" id="screen-view">
|
|
|
+ <div class="screen-view-top">
|
|
|
+ <div class="left space-x-[1rem]">
|
|
|
+ <span class="time">{{ time }}</span>
|
|
|
+ <span class="line"></span>
|
|
|
+ <div class="data">
|
|
|
+ <div>{{ dayjs(screenData.timestamp).format("dddd") }}</div>
|
|
|
+ <div class="text-[12px]">{{ dayjs(screenData.timestamp).format('YYYY-MM-DD') }}</div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="chat-header flex items-center justify-end pr-[18px] space-x-[16px]">
|
|
|
+ <userTop></userTop>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="menu">
|
|
|
+ <RouterLink to="/" class="item item1">智慧总控</RouterLink>
|
|
|
+ <RouterLink to="/answer" class="item item2">专家问答</RouterLink>
|
|
|
+ <RouterLink to="/water-warn" class="item item3">工艺管控</RouterLink>
|
|
|
+ <RouterLink to="/work" class="item item4">智能办公</RouterLink>
|
|
|
+ </div>
|
|
|
+ <div class="screen-container">
|
|
|
+ <div class="screen-container-main">
|
|
|
+ <div class="left">
|
|
|
+ <shuizhi :screenData="screenData"></shuizhi>
|
|
|
+ <EchartBar :screenData="screenData"></EchartBar>
|
|
|
+ <liuliang :screenData="screenData"></liuliang>
|
|
|
+ </div>
|
|
|
+ <div class="middle">
|
|
|
+ <middleBox :dataTime="dataTime"></middleBox>
|
|
|
+ </div>
|
|
|
+ <div class="right">
|
|
|
+ <ControlHelper></ControlHelper>
|
|
|
+ <dataBox :reportData="reportData"></dataBox>
|
|
|
+ <gongyi :gongyiData="gongyiData"></gongyi>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<style lang="scss" scoped>
|
|
|
+.screen-view {
|
|
|
+ position: relative;
|
|
|
+ display: flex;
|
|
|
+ justify-content: space-around;
|
|
|
+ flex-flow: column;
|
|
|
+ width: 100vw;
|
|
|
+ height: 100vh;
|
|
|
+ background: url(@/assets/images/home/home_bg1.png) center center no-repeat;
|
|
|
+ background-size: 100% 100%;
|
|
|
+ overflow: hidden;
|
|
|
+
|
|
|
+ &-top {
|
|
|
+ display: flex;
|
|
|
+ align-items: end;
|
|
|
+ justify-content: space-between;
|
|
|
+ padding: 0 5rem;
|
|
|
+ height: 9rem;
|
|
|
+
|
|
|
+ .left {
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ font-size: 1.6rem;
|
|
|
+ }
|
|
|
+
|
|
|
+ .time {
|
|
|
+ font-size: 3.6rem;
|
|
|
+ font-weight: bold;
|
|
|
+ color: #333;
|
|
|
+ }
|
|
|
+
|
|
|
+ .line {
|
|
|
+ margin: 0 1rem 0 1.5rem;
|
|
|
+ display: inline-block;
|
|
|
+ background: #767C82;
|
|
|
+ height: 2.8rem;
|
|
|
+ width: 0.2rem;
|
|
|
+ }
|
|
|
+
|
|
|
+ .data {
|
|
|
+ color: #415B73;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ .menu {
|
|
|
+ display: flex;
|
|
|
+ align-content: center;
|
|
|
+ justify-content: center;
|
|
|
+ flex-shrink: 0;
|
|
|
+
|
|
|
+ .item {
|
|
|
+ width: 21.8rem;
|
|
|
+ height: 5.2rem;
|
|
|
+ display: inline-block;
|
|
|
+ font-size: 0;
|
|
|
+ }
|
|
|
+
|
|
|
+ .item1 {
|
|
|
+ background: url('@/assets/images/home/menu_1_hover.png') no-repeat;
|
|
|
+ background-size: 100% 100%;
|
|
|
+ }
|
|
|
+
|
|
|
+ .item2 {
|
|
|
+ background: url('@/assets/images/home/menu_2.png') no-repeat;
|
|
|
+ background-size: 100% 100%;
|
|
|
+ margin-right: 20rem;
|
|
|
+
|
|
|
+ &:hover {
|
|
|
+ background: url('@/assets/images/home/menu_2_hover.png') no-repeat;
|
|
|
+ background-size: 100% 100%;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ .item3 {
|
|
|
+ background: url('@/assets/images/home/menu_3.png') no-repeat;
|
|
|
+ background-size: 100% 100%;
|
|
|
+
|
|
|
+ &:hover {
|
|
|
+ background: url('@/assets/images/home/menu_3_hover.png') no-repeat;
|
|
|
+ background-size: 100% 100%;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ .item4 {
|
|
|
+ background: url('@/assets/images/home/menu_4.png') no-repeat;
|
|
|
+ background-size: 100% 100%;
|
|
|
+
|
|
|
+ &:hover {
|
|
|
+ background: url('@/assets/images/home/menu_4_hover.png') no-repeat;
|
|
|
+ background-size: 100% 100%;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ .water-work-inner {
|
|
|
+ position: absolute;
|
|
|
+ left: 50%;
|
|
|
+ top: 50%;
|
|
|
+ transform: translate(-50%, -50%);
|
|
|
+ width: 150rem;
|
|
|
+ height: 80rem;
|
|
|
+ background: url("@assets/images/home/water-work.png") no-repeat;
|
|
|
+ }
|
|
|
+
|
|
|
+ .screen-container {
|
|
|
+ position: relative;
|
|
|
+ display: flex;
|
|
|
+ flex-flow: column;
|
|
|
+ height: 80rem;
|
|
|
+ padding: 0 6rem;
|
|
|
+ z-index: 2;
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ &-main {
|
|
|
+ position: relative;
|
|
|
+ height: 100%;
|
|
|
+ display: flex;
|
|
|
+ justify-content: space-between;
|
|
|
+ z-index: 2;
|
|
|
+
|
|
|
+ .left {
|
|
|
+ position: relative;
|
|
|
+ display: flex;
|
|
|
+ flex-flow: column;
|
|
|
+ z-index: 3;
|
|
|
+ }
|
|
|
+
|
|
|
+ .middle {
|
|
|
+ position: relative;
|
|
|
+ flex: 1;
|
|
|
+
|
|
|
+ // .send-ask {
|
|
|
+ // position: relative;
|
|
|
+ // z-index: 2;
|
|
|
+ // }
|
|
|
+ }
|
|
|
+ .right {
|
|
|
+ position: relative;
|
|
|
+ z-index: 3;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ .img-card {
|
|
|
+ position: absolute;
|
|
|
+ top: 50%;
|
|
|
+ left: 50%;
|
|
|
+ transform: translate(-50%, -50%);
|
|
|
+ width: 79rem;
|
|
|
+ height: 59rem;
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+@media screen and (max-width: 1440px) {
|
|
|
+ .screen-view {
|
|
|
+ justify-content: flex-start;
|
|
|
+ // background: url(@/assets/images/home/home_bg.png) center top no-repeat;
|
|
|
+ // background-size: contain;
|
|
|
+ }
|
|
|
+}
|
|
|
+</style>
|
|
|
+
|
|
|
+<style lang="scss">
|
|
|
+.home-box {
|
|
|
+ width: 54rem;
|
|
|
+ // width: 540px;
|
|
|
+ border-radius: 0.8rem;
|
|
|
+ // border: 1px solid #fff;
|
|
|
+ // margin-bottom: 2rem;
|
|
|
+
|
|
|
+ &-top {
|
|
|
+ padding: 0.7rem 2.4rem 0.7rem 1.2rem;
|
|
|
+ display: flex;
|
|
|
+ justify-content: space-between;
|
|
|
+ position: relative;
|
|
|
+ align-items: center;
|
|
|
+
|
|
|
+ &::after {
|
|
|
+ content: '';
|
|
|
+ height: 0.2rem;
|
|
|
+ background: url('@/assets/images/home/line.png') no-repeat;
|
|
|
+ background-size: 100% 100%;
|
|
|
+ width: 100%;
|
|
|
+ position: absolute;
|
|
|
+ left: 1.2rem;
|
|
|
+ bottom: 0;
|
|
|
+ }
|
|
|
+
|
|
|
+ .title {
|
|
|
+ font-size: 1.8rem;
|
|
|
+ font-weight: bold;
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+
|
|
|
+ &::before {
|
|
|
+ content: '';
|
|
|
+ width: 2rem;
|
|
|
+ height: 2rem;
|
|
|
+ background: url('@/assets/images/home/mark.png') no-repeat;
|
|
|
+ background-size: cover;
|
|
|
+ margin-right: 0.8rem;
|
|
|
+ display: inline-block;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+</style>
|