生产监控前端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

182 lines
6.2 KiB

2 years ago
<template>
<div ref="screenRef" class="screen">
<section ref="titleRef" class="header">
<Header :titleData="titleData" :settingShow="true" @showModalClick="showModalClick" @returnClick="returnClick" />
<!-- <div class="title">
<h3>{{ titleData }}</h3>
</div>
<div class="weather">
<div class="time">
{{ currentTime }} {{ lunarDay.ncWeek }}
</div>
<div class="line"></div>
<div class="forecast">
<span>天气多云</span>
<img src="../../../assets/images/weather/duoyun.png" />
</div>
</div>
2 years ago
<div class="seeting">
<n-tooltip trigger="hover">
<template #trigger>
<n-button class="tooltips" circle quaternary @click="showClick">
<template #icon>
<n-icon>
<Settings />
</n-icon>
</template>
</n-button>
</template>
显示项
</n-tooltip>
<n-tooltip trigger="hover">
<template #trigger>
<n-button class="tooltips" circle quaternary @click="returnBack">
<template #icon>
<n-icon>
<Power />
</n-icon>
</template>
</n-button>
</template>
返回首页
</n-tooltip>
</div> -->
</section>
2 years ago
<section class="layout">
<div ref="sidebar" class="sidebar animate__animated animate__fadeIn" :class="menuShow ? '' : 'sidebarHide'">
2 years ago
<Menu @tableMenuData="tableMenuData" />
</div>
<div class="main" :style="`width: ${mainWidth}%`">
2 years ago
<Main :tapsShow="tapsShow" :sidebarHeight="sidebarHeight" @tableHeaderData="tableHeaderData" />
<InfoPanel class="animate__animated animate__fadeInUp" v-if="panelShow" />
2 years ago
</div>
</section>
<section>
<!-- <n-modal v-model:show="showModal"> -->
<el-dialog v-model="showModal" title="显示项" width="600">
<!-- <n-card class="cardClass" style="width: 600px" title="显示项" :bordered="false" size="huge" role="dialog"
aria-modal="true"> -->
<ShowTree :headerData="headerData" @cancelClick="cancelClick" />
<!-- <template #header-extra>
2 years ago
*
</template> -->
<!-- <template #footer>
2 years ago
<n-button>取消</n-button>
<n-button type="info"> 确定 </n-button>
</template> -->
<!-- </n-card> -->
</el-dialog>
<!-- </n-modal> -->
2 years ago
</section>
<div class="menuShow" @click="menuIsShow">
<i class="iconfont icon-angle-double" :class="menuShow ? 'left' : 'right'"></i>
</div>
<div class="panelBtn" :class="menuShow ? 'left' : 'right'" @click="panelClick">
<i class="iconfont icon-arrow-up" :class="!panelShow ? 'up' : 'down'"></i>
<!-- <n-button type="info" size="tiny" ghost @click="panelClick">按钮</n-button> -->
</div>
2 years ago
</div>
</template>
<script lang="ts" setup>
import router from '@/router';
// import { useDateFormat, useNow } from '@vueuse/core';
// import { Filter, Maximize, Settings, Power } from '@vicons/tabler';
2 years ago
import Menu from './components/menu.vue';
import Main from './components/main.vue';
import InfoPanel from './components/infoPanel.vue';
2 years ago
import ShowTree from './components/showTree.vue';
import Header from '../components/header.vue';
import useStorage from '@/utils/useStorage'
const sessionStorageIns = useStorage('sessionStorage');
// import calendar from '@/utils/lunar';
// const currentTime = useDateFormat(useNow(), 'YYYY-MM-DD HH:mm:ss');
// const lunarDay: any = calendar.solarToLunar(
// useNow().value.getUTCFullYear(),
// useNow().value.getUTCMonth() + 1,
// useNow().value.getUTCDate()
// );
// import screenfull from 'screenfull'
2 years ago
const tapsShow = ref(false);
const showModal = ref(false);
const screenRef = ref<HTMLElement>();
const titleRef = ref<HTMLElement>();
const sidebar = ref<HTMLElement>();
const sidebarHeight = ref()
const headerData = ref([]);
const mainWidth = ref(87)
2 years ago
const titleData = ref('')
const menuShow = ref(true)
const panelShow = ref(false)
const panelHeight = ref(0)
2 years ago
onMounted(() => {
// titleRef.value?.clientHeight; //获取头部标题高度
console.log(sidebar.value)
const offsetHeight = sidebar.value?.offsetHeight; //获取侧边栏菜单高度
sidebarHeight.value = offsetHeight === undefined ? 0 : offsetHeight - panelHeight.value
// menuShow.value=localStorage.getItem('menuShow')===undefined?true:JSON.parse(localStorage.getItem('menuShow'));
2 years ago
console.log("sidebar:", sidebar.value?.offsetHeight)
});
window.addEventListener('resize', () => {
// 监听窗口改变,改变后重新获取
const offsetHeight = sidebar.value?.offsetHeight; //获取侧边栏菜单高度
sidebarHeight.value = offsetHeight === undefined ? 0 : offsetHeight - panelHeight.value
2 years ago
console.log("监听sidebar:", sidebar.value?.offsetHeight)
});
function tableMenuData(data: any) {
//获取菜单数据
titleData.value = data[0].deptName
}
function tableHeaderData(data: any) {
//获取表格header数据
headerData.value = data;
}
function filterClick() {
//显示/隐藏热源信息栏
tapsShow.value = !tapsShow.value;
}
function showModalClick(val: boolean) {
2 years ago
//显示/隐藏表格配置栏
showModal.value = val;
2 years ago
}
function cancelClick() {
//表格配置栏取消
showModal.value = false;
}
function returnClick(val: string) {
//返回首页
router.replace("/dashboard")
2 years ago
}
function menuIsShow() {
//点击左侧菜单是否隐藏
menuShow.value = !menuShow.value
mainWidth.value = menuShow.value ? 87 : 100
sessionStorageIns.setUseStorage('menuShow', menuShow.value);
}
function panelClick() {
//底部信息面板按钮
panelShow.value = !panelShow.value
panelHeight.value = panelShow.value ? 300 : 0
const offsetHeight = sidebar.value?.offsetHeight; //获取侧边栏菜单高度
sidebarHeight.value = offsetHeight === undefined ? 0 : offsetHeight - panelHeight.value
sessionStorageIns.setUseStorage('panelShow', panelShow.value);
}
// function screenClick(){
// if (screenfull.isEnabled) {
// // 控制是否全屏的按钮
// screenfull.toggle(screenRef.value)
// }
// }
2 years ago
</script>
<style lang="scss" scoped>
@import './index.scss';
</style>