|
|
@@ -1,97 +1,143 @@
|
|
|
<template>
|
|
|
<div class="vent-custom-header">
|
|
|
+ <!-- 顶部标题插槽 -->
|
|
|
<div class="vent-home-header">
|
|
|
<div class="header-text"><slot></slot></div>
|
|
|
</div>
|
|
|
+
|
|
|
+ <!-- 左侧导航菜单 -->
|
|
|
<div class="nav">
|
|
|
- <div
|
|
|
- v-for="(item, index) in menuList"
|
|
|
- :key="index"
|
|
|
- @click="handleNavClick(item)"
|
|
|
- style="cursor: pointer"
|
|
|
- class="nav-item"
|
|
|
- :class="{ active: isActive(item.path) }"
|
|
|
- >
|
|
|
+ <div v-for="(item, index) in menuList" :key="index" @click="handleNavClick(item)" class="nav-item" :class="{ active: isActive(item.path) }">
|
|
|
<span>{{ item.name }}</span>
|
|
|
</div>
|
|
|
</div>
|
|
|
- <div class="container-title" v-if="fieldNames">
|
|
|
+ <!-- 右侧历史数据 -->
|
|
|
+ <div class="history-nav">
|
|
|
+ <div @click="openModel()" class="nav-item" :class="{ active: visible }">
|
|
|
+ <span>历史数据</span>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <!-- 下拉选择器 -->
|
|
|
+ <div class="container-title" v-if="fieldNames && options.length">
|
|
|
<a-select
|
|
|
class="title-select"
|
|
|
- ref="select"
|
|
|
+ ref="selectRef"
|
|
|
v-model:value="currentTitleValue"
|
|
|
@change="handleTitleChange"
|
|
|
- dropdownClassName="drop"
|
|
|
+ dropdown-class-name="drop"
|
|
|
:field-names="fieldNames"
|
|
|
:options="options"
|
|
|
- :dropdownStyle="{ background: 'transparent', borderBottom: '1px solid #ececec66', backdropFilter: 'blur(50px)', color: '#fff' }"
|
|
|
- >
|
|
|
- </a-select>
|
|
|
+ :dropdown-style="dropdownStyle"
|
|
|
+ />
|
|
|
</div>
|
|
|
</div>
|
|
|
+
|
|
|
+ <!-- 历史数据弹窗 -->
|
|
|
+ <!-- <History v-model:visible="visible" /> -->
|
|
|
</template>
|
|
|
-<script lang="ts">
|
|
|
-import { defineComponent, computed, ref } from 'vue';
|
|
|
-import { Decoration5 } from '@kjgl77/datav-vue3';
|
|
|
+
|
|
|
+<script lang="ts" setup>
|
|
|
+import { computed, ref, watch } from 'vue';
|
|
|
import { router } from '/@/router';
|
|
|
-export default defineComponent({
|
|
|
- name: 'CustomHeader',
|
|
|
- components: { Decoration5 },
|
|
|
- props: {
|
|
|
- optionValue: {
|
|
|
- type: String,
|
|
|
- },
|
|
|
- fieldNames: {
|
|
|
- type: Object,
|
|
|
- default: () => {},
|
|
|
- },
|
|
|
- options: {
|
|
|
- type: Array,
|
|
|
- default: () => [],
|
|
|
- },
|
|
|
- Type: {
|
|
|
- type: String,
|
|
|
- },
|
|
|
+import History from './detail/history.vue';
|
|
|
+
|
|
|
+// 类型定义
|
|
|
+interface MenuItem {
|
|
|
+ name: string;
|
|
|
+ path: string;
|
|
|
+}
|
|
|
+interface FieldNames {
|
|
|
+ label?: string;
|
|
|
+ value?: string;
|
|
|
+ children?: string;
|
|
|
+}
|
|
|
+
|
|
|
+// Props
|
|
|
+const props = defineProps({
|
|
|
+ optionValue: {
|
|
|
+ type: String,
|
|
|
+ default: '',
|
|
|
},
|
|
|
- emits: ['change'],
|
|
|
- setup(props, { emit }) {
|
|
|
- const currentTitleValue = computed(() => props.optionValue);
|
|
|
- const menuList = ref([
|
|
|
- {
|
|
|
- name: '首页',
|
|
|
- path: '/micro-vent-3dModal/configurable/belt/fireS/home',
|
|
|
- },
|
|
|
- {
|
|
|
- name: '详情监控页',
|
|
|
- path: '/belt/fireS/home',
|
|
|
- },
|
|
|
- {
|
|
|
- name: '灾变模拟分析',
|
|
|
- path: '/micro-vent-3dModal/dashboard/analysis?type=sysMonitor&deviceType=sysfireTunnel&sysID=2028657172566073346&deviceid=2028650091184177153&sysType=leather',
|
|
|
- },
|
|
|
- ]);
|
|
|
- function isActive(menuPath) {
|
|
|
- const currentRoutePath = router.currentRoute.value.path;
|
|
|
- const menuRoutePath = menuPath.split('?')[0];
|
|
|
- return currentRoutePath.startsWith(menuRoutePath);
|
|
|
- }
|
|
|
- function handleNavClick(item) {
|
|
|
- console.log('✅️点击', item.path);
|
|
|
- router.push(item.path);
|
|
|
- }
|
|
|
- // 标题选择
|
|
|
- function handleTitleChange(value) {
|
|
|
- emit('change', value);
|
|
|
- }
|
|
|
- return {
|
|
|
- currentTitleValue,
|
|
|
- handleTitleChange,
|
|
|
- menuList,
|
|
|
- handleNavClick,
|
|
|
- isActive,
|
|
|
- };
|
|
|
+ fieldNames: {
|
|
|
+ type: Object as () => FieldNames,
|
|
|
+ default: () => ({}),
|
|
|
+ },
|
|
|
+ options: {
|
|
|
+ type: Array,
|
|
|
+ default: () => [],
|
|
|
+ },
|
|
|
+ Type: {
|
|
|
+ type: String,
|
|
|
+ default: '',
|
|
|
},
|
|
|
});
|
|
|
+
|
|
|
+// 自定义事件
|
|
|
+const emit = defineEmits<{
|
|
|
+ change: [value: string];
|
|
|
+ 'open-history': [];
|
|
|
+}>();
|
|
|
+
|
|
|
+// 响应式数据
|
|
|
+const currentTitleValue = ref(props.optionValue);
|
|
|
+const visible = ref(false);
|
|
|
+const selectRef = ref(); // 选择器实例
|
|
|
+
|
|
|
+// 导航菜单配置
|
|
|
+const menuList: MenuItem[] = [
|
|
|
+ {
|
|
|
+ name: '首页',
|
|
|
+ path: '/micro-vent-3dModal/configurable/belt/fireS/home',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name: '详情监控页',
|
|
|
+ path: '/belt/fireS/home',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name: '灾变模拟分析',
|
|
|
+ path: '/micro-vent-3dModal/dashboard/analysis?type=sysMonitor&deviceType=sysfireTunnel&sysID=2028657172566073346&deviceid=2028650091184177153&sysType=leather',
|
|
|
+ },
|
|
|
+];
|
|
|
+// 下拉框样式
|
|
|
+const dropdownStyle = {
|
|
|
+ background: 'transparent',
|
|
|
+ borderBottom: '1px solid #ececec66',
|
|
|
+ backdropFilter: 'blur(50px)',
|
|
|
+ color: '#fff',
|
|
|
+};
|
|
|
+
|
|
|
+// 当前路由(计算属性)
|
|
|
+const currentPath = computed(() => {
|
|
|
+ return router.currentRoute.value.fullPath.split('?')[0];
|
|
|
+});
|
|
|
+// 监听父组件传入的 optionValue 同步更新
|
|
|
+watch(
|
|
|
+ () => props.optionValue,
|
|
|
+ (val) => {
|
|
|
+ currentTitleValue.value = val;
|
|
|
+ }
|
|
|
+);
|
|
|
+// 判断导航是否选中
|
|
|
+const isActive = (menuPath: string): boolean => {
|
|
|
+ if (!menuPath) return false;
|
|
|
+ const menuRoutePath = menuPath.split('?')[0];
|
|
|
+ return currentPath.value.startsWith(menuRoutePath);
|
|
|
+};
|
|
|
+
|
|
|
+// 导航点击跳转
|
|
|
+const handleNavClick = (item: MenuItem) => {
|
|
|
+ router.push(item.path);
|
|
|
+};
|
|
|
+// 打开/关闭历史数据弹窗
|
|
|
+const openModel = () => {
|
|
|
+ visible.value = !visible.value;
|
|
|
+ emit('open-history');
|
|
|
+};
|
|
|
+// 下拉选择器变化
|
|
|
+const handleTitleChange = (value: string) => {
|
|
|
+ currentTitleValue.value = value;
|
|
|
+ emit('change', value);
|
|
|
+};
|
|
|
</script>
|
|
|
<style lang="less">
|
|
|
@import '/@/design/vent/modal.less';
|
|
|
@@ -119,6 +165,7 @@ export default defineComponent({
|
|
|
}
|
|
|
}
|
|
|
</style>
|
|
|
+
|
|
|
<style lang="less" scoped>
|
|
|
@import '/@/design/theme.less';
|
|
|
@ventSpace: zxm;
|
|
|
@@ -131,6 +178,7 @@ export default defineComponent({
|
|
|
z-index: 9999;
|
|
|
height: 60px;
|
|
|
pointer-events: auto;
|
|
|
+
|
|
|
.vent-home-header {
|
|
|
width: 100%;
|
|
|
position: fixed;
|
|
|
@@ -140,6 +188,7 @@ export default defineComponent({
|
|
|
background-size: contain;
|
|
|
display: flex;
|
|
|
justify-content: center;
|
|
|
+
|
|
|
.header-icon {
|
|
|
margin-top: 45px;
|
|
|
}
|
|
|
@@ -154,27 +203,27 @@ export default defineComponent({
|
|
|
color: transparent;
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
.container-title {
|
|
|
width: 380px;
|
|
|
height: 34px;
|
|
|
left: 20px;
|
|
|
- // background: url('/@/assets/images/vent/new-home/container-title-bg.png') no-repeat;
|
|
|
background: var(--image-select-bg) no-repeat;
|
|
|
background-size: contain;
|
|
|
padding: 0 0 0 20px;
|
|
|
- // padding: 0 0 0 180px;
|
|
|
font-size: 20px;
|
|
|
pointer-events: auto;
|
|
|
position: relative;
|
|
|
z-index: 9999;
|
|
|
top: 70px;
|
|
|
+
|
|
|
.title-select {
|
|
|
width: 340px;
|
|
|
position: absolute;
|
|
|
top: 0;
|
|
|
- // left: 160px;
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
.nav {
|
|
|
width: 100%;
|
|
|
position: fixed;
|
|
|
@@ -184,6 +233,7 @@ export default defineComponent({
|
|
|
gap: 30px;
|
|
|
top: 15px;
|
|
|
pointer-events: auto;
|
|
|
+
|
|
|
.nav-item {
|
|
|
flex: 1;
|
|
|
max-width: 120px;
|
|
|
@@ -195,6 +245,33 @@ export default defineComponent({
|
|
|
text-align: center;
|
|
|
background: url('/@/assets/images/beltFire/titleNav.png') no-repeat center center;
|
|
|
background-size: 100% 90%;
|
|
|
+ cursor: pointer;
|
|
|
+ color: #fff;
|
|
|
+ }
|
|
|
+ .nav-item.active {
|
|
|
+ background: url('/@/assets/images/beltFire/titleNavActive.png') no-repeat center center !important;
|
|
|
+ background-size: 100% 190% !important;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ .history-nav {
|
|
|
+ position: fixed;
|
|
|
+ top: 15px;
|
|
|
+ right: 230px;
|
|
|
+ pointer-events: auto;
|
|
|
+
|
|
|
+ .nav-item {
|
|
|
+ width: 120px;
|
|
|
+ height: 35px;
|
|
|
+ line-height: 35px;
|
|
|
+ padding: 0;
|
|
|
+ box-sizing: border-box;
|
|
|
+ padding-bottom: 10px;
|
|
|
+ text-align: center;
|
|
|
+ background: url('/@/assets/images/beltFire/titleNav.png') no-repeat center center;
|
|
|
+ background-size: 100% 90%;
|
|
|
+ cursor: pointer;
|
|
|
+ color: #fff;
|
|
|
}
|
|
|
.nav-item.active {
|
|
|
background: url('/@/assets/images/beltFire/titleNavActive.png') no-repeat center center !important;
|
|
|
@@ -202,20 +279,24 @@ export default defineComponent({
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
:deep(.zxm-select) {
|
|
|
width: 400px;
|
|
|
+
|
|
|
.@{ventSpace}-select-selector {
|
|
|
background: transparent !important;
|
|
|
border: none !important;
|
|
|
box-shadow: none !important;
|
|
|
+
|
|
|
.zxm-select-selection-item {
|
|
|
color: #fff !important;
|
|
|
font-size: 20px;
|
|
|
margin-left: 20px !important;
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
.@{ventSpace}-select-arrow {
|
|
|
color: #fff !important;
|
|
|
}
|
|
|
}
|
|
|
-</style>
|
|
|
+</style>
|