<template>
<div class="areaReport2 page">
<el-container class="scrollable-content">
<el-main>
<h1>{{}}区教师发展区域报告</h1>
<div v-for="(item,index) in treeList" :id="item.id" class="itemBox">
<h2>{{ item.name }}</h2>
<component :is="item.com" :regionData="regionData"/>
<div v-for="(it,ind) in item.children" :id="it.id" class="itBox">
<h3>{{ it.name }}</h3>
<component :is="it.com" :chartData="it.chartData" :regionData="regionData" v-if="isReduce"/>
</div>
</div>
</el-main>
<el-aside width="320px" class="fixed-sidebar">
<el-tree
:data="treeList"
default-expand-all
:props="defaultProps"
@node-click="handleNodeClick"/>
</el-aside>
</el-container>
</div>
</template>
<script setup>
import {ref, onUnmounted, nextTick} from "vue";
import {post, postJson} from "@/frame/request/http";
import temp1 from './component/temp1'
import temp2 from './component/temp2'
import temp3 from './component/temp3'
import temp4 from './component/temp4'
import temp5 from './component/temp5'
import temp6 from './component/temp6'
import temp7 from './component/temp7'
import temp8 from './component/temp8'
import temp9 from './component/temp9'
import temp10 from './component/temp10'
import temp11 from './component/temp11'
import temp12 from './component/temp12'
import temp13 from './component/temp13'
import temp14 from './component/temp14'
import bar3Com from './component/bar3Com'
import bar4Com from './component/bar4Com'
import useGetters from "@/frame/store/useGetters";
const user = useGetters("user");
const defaultProps = {
children: 'children',
label: 'name',
}
let treeList = ref([
{
name: '一、基本信息1',
id: 'id1',
com: temp1,
},
{
name: '二、教师年龄结构统计',
id: 'id2',
children: [
{name: '1.年龄段数量情况', id: 'id2-1', com: temp2, chartData: {title: '年龄段校占比与区占比对比'}},
{name: '2.各校年龄平均值(从低到高)前5所', id: 'id2-2', com: temp3,},
{name: '3.各校年龄平均值(从高到低)前5所', id: 'id2-3', com: temp3},
{name: '4.35岁一下教师占比', id: 'id2-4', com: bar3Com},
{name: '5.未来五年建退休教师占比', id: 'id2-5', com: bar4Com},
{name: '6.未来五年退休人数超10人', id: 'id2-6', com: temp4},
{name: '7.2025年退休人数校', id: 'id2-7', com: temp4},
]
},
{
name: '三、教师职称结构统计',
id: 'id3',
children: [
{name: '1.教师职称结构统计1', id: 'id3', com: temp5, chartData: {title: '得分趋势图'}},
]
},
{
name: '四、教学工作情况',
id: 'id4',
children: [
{name: '1.教学获奖1', id: 'id4', com: temp6, chartData: {title: '得分趋势图'}},
]
},
{
name: '五、科研工作情况',
id: 'id5',
children: [
{name: '1.论文发表1', id: 'id5-1', com: temp7, chartData: {title: '年份得分趋势图'}},
{name: '2.主持课题1', id: 'id5-2', com: temp8, chartData: {title: '年份得分趋势图'}},
{name: '3.刊物发表1', id: 'id5-3', com: temp9, chartData: {title: '年份得分趋势图'}},
]
},
{
name: '六、教师发展情况统计',
id: 'id6',
children: [
{name: '1.综合荣誉统计1', id: 'id6-1', com: temp10, chartData: {title: '年份得分趋势图'}},
{name: '2.名师、名校长称号获取情况统计1', id: 'id6-2', com: temp11},
{name: '3.名师、名校长累计及人均统计', id: 'id6-2', com: ''},
{name: '4.名师工作室各级别统计1', id: 'id6-3', com: temp12},
{name: '4.名师工作室累计及人均统计', id: 'id6-3', com: ''},
]
},
{
name: '七、总结',
id: 'id7',
com: temp13
},
{
name: '八、建议',
id: 'id7',
com: temp14
}
])
let regionData = ref({})
let isReduce = ref(false)
function getAreaRegionData() {
postJson('/server/regionId/report/areaRegionData', {regionId: user.value.regionId, fileYear: '2025'}).then(res => {
regionData.value = res
isReduce.value = true
})
}
getAreaRegionData()
const currentNodeKey = ref(null);
const handleNodeClick = (data) => {
currentNodeKey.value = data.id;
nextTick(() => {
const targetElement = document.getElementById(data.id);
if (targetElement) {
// 平滑滚动到目标元素
targetElement.scrollIntoView({
behavior: 'smooth',
block: 'start'
});
// 为了增强用户体验,添加一个临时的高亮效果
targetElement.classList.add('highlight');
setTimeout(() => {
targetElement.classList.remove('highlight');
}, 1500);
}
});
}
// 监听滚动事件,更新当前激活的菜单项
const handleScroll = () => {
const sections = document.querySelectorAll('.main-section, .sub-section');
let current = '';
sections.forEach(section => {
const sectionTop = section.offsetTop;
const sectionHeight = section.clientHeight;
if (window.pageYOffset >= (sectionTop - sectionHeight / 3)) {
current = section.getAttribute('id');
}
});
if (current && currentNodeKey.value !== current) {
currentNodeKey.value = current;
}
};
// 添加滚动事件监听
window.addEventListener('scroll', handleScroll);
// 组件卸载时移除事件监听
onUnmounted(() => {
window.removeEventListener('scroll', handleScroll);
});
</script>
<style scoped>
.areaReport2.page {
overflow: hidden;
display: flex;
}
.itemBox {
width: 100%;
min-height: 100px;
margin-bottom: 50px;
}
.itBox {
width: 100%;
min-height: 100px;
margin: 5px 0px;
}
el-container {
height: 100%;
display: flex;
flex: 1;
}
.scrollable-content {
flex: 1;
overflow-y: auto;
height: 100vh;
}
.fixed-sidebar {
background-color: #f9fafc;
border-right: 1px solid #ebeef5;
padding: 10px;
overflow-y: auto; /* 当菜单内容超出时显示滚动条 */
}
.main-section {
margin-bottom: 30px;
padding: 20px;
border-radius: 8px;
transition: all 0.3s ease;
}
.sub-section {
margin-top: 20px;
margin-bottom: 20px;
padding: 20px;
border-radius: 8px;
transition: all 0.3s ease;
}
h1 {
text-align: center;
}
h2 {
font-size: 22px;
color: #333;
margin-bottom: 15px;
padding-bottom: 10px;
}
h3 {
font-size: 18px;
color: #333;
margin: 10px 0px;
padding: 8px 0px;
}
.content-placeholder {
padding: 15px;
border-radius: 4px;
min-height: 150px;
color: #909399;
}
.highlight {
animation: highlightAnimation 1.5s ease-in-out;
}
</style>
<style lang="less">
.areaReport2 {
h4 {
font-size: 16px;
color: #333;
text-indent: 2em;
padding: 30px 0px;
line-height: 32px
}
h1 {
color: #333
}
.el-table__header th {
background-color: #4874cb !important;
color: white;
}
.el-tree {
height: 100%;
padding: 20px 0px;
box-sizing: border-box;
}
.el-main {
padding: 0px 120px;
}
}
</style> 左边滚动,右边tree对应高亮
最新发布