This commit is contained in:
‘937886381’
2025-11-12 16:56:14 +08:00
commit 1ea62af1d6
1135 changed files with 109385 additions and 0 deletions

View File

@@ -0,0 +1,337 @@
<template>
<header class="report-header" :class="['report-header__' + size]">
<!-- 左侧区域logo + 标题 -->
<div class="left-content">
<!-- <img style="height: 36px;" src="../../../assets/img/cnbm.png" alt="benmaLogo" class="logo"> -->
<div class="top-title">{{ topTitle }}</div>
</div>
<!--
<div class="center-content">
<div class="item" v-for="(text, index) in ['营业收入', '利润分析', '产销率库存分析', '成本分析', '驾驶舱报表']" :key="index"
@click="activeIndex = index" :class="{ 'no-skew': activeIndex === index }">
<span class="item-text">{{ text }}</span>
</div>
</div> -->
<!-- 右侧区域全屏按钮 -->
<div class="right-content">
<el-button type="text" class="screen-btn" :title="isFullScreen ? '退出全屏' : '全屏'" @click="changeFullScreen">
<svg-icon style="color: #0B58FF;" v-if="isFullScreen" icon-class="unFullScreenView" />
<svg-icon style="color: #0B58FF;" v-else icon-class="fullScreenView" />
</el-button>
</div>
<!-- 时间选择区域//年按钮 + label + 日期选择器 -->
<div class="timeType">
<!-- //年按钮点击更新activeTime关联选择器类型 -->
<div class="item" v-for="(item, index) in timeTypes" :key="index" @click="activeTime = index"
:class="{ 'no-skew': activeTime === index }">
<span class="item-text">{{ item.text }}</span>
</div>
<div class="dateP">
<div class="label">
<span class="label-text">日期选择</span> <!-- 补充span抵消倾斜 -->
</div>
<!-- 日期选择器type和placeholder通过activeTime动态切换 -->
<el-date-picker v-model="date" :type="getPickerType" :placeholder="getPickerPlaceholder"
class="custom-date-picker" style="width: 132px;height: 29px;"></el-date-picker>
</div>
</div>
</header>
</template>
<script>
export default {
name: 'Header',
props: {
isFullScreen: { type: Boolean, default: false },
topTitle: { type: String, default: '' },
size: { type: String, default: 'basic' },
},
data() {
return {
currentTime: '',
timeTimer: null,
date: undefined,
activeIndex: -1,
activeTime: 0, // 0=日1=月2=年(默认选中“日”)
// 定义时间类型配置text=按钮文字pickerType=选择器类型placeholder=占位符
timeTypes: [
{ text: '日', pickerType: 'date', placeholder: '选择日期' },
{ text: '月', pickerType: 'month', placeholder: '选择月份' },
{ text: '年', pickerType: 'year', placeholder: '选择年份' }
]
}
},
computed: {
// 动态获取日期选择器类型
getPickerType() {
return this.timeTypes[this.activeTime].pickerType;
},
// 动态获取日期选择器占位符
getPickerPlaceholder() {
return this.timeTypes[this.activeTime].placeholder;
}
},
methods: {
changeFullScreen() { this.$emit('screenfullChange') },
exportPDF() { this.$emit('exportPDF') },
updateTime() {
const now = new Date()
const hours = this.padZero(now.getHours())
const minutes = this.padZero(now.getMinutes())
const year = now.getFullYear()
const month = this.padZero(now.getMonth() + 1)
const day = this.padZero(now.getDate())
const weekdays = ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六']
this.currentTime = `${hours}:${minutes} | ${year}.${month}.${day} | ${weekdays[now.getDay()]}`
},
padZero(num) { return num < 10 ? '0' + num : num }
},
mounted() {
this.updateTime()
this.timeTimer = setInterval(this.updateTime, 1000)
},
beforeDestroy() {
if (this.timeTimer) clearInterval(this.timeTimer)
}
}
</script>
<style scoped lang="scss">
/* 原有样式不变仅补充label文字的倾斜抵消样式 */
@font-face {
font-family: "YouSheBiaoTiHei";
src: url('../../../assets/fonts/YouSheBiaoTiHe.ttf') format('truetype');
}
.report-header {
height: 117px;
width: 100%;
display: flex;
justify-content: space-between;
&__basic {
// width: 547px;
background: url(../../../assets/img/topBg.png) no-repeat;
background-size: cover;
background-position: 0 0;
}
&__psi {
// width: 547px;
background: url(../../../assets/img/psiTopTitle.png) no-repeat;
background-size: 100% 100%;
background-position: 0 0;
}
box-sizing: border-box;
position: relative;
/* 确保timeType绝对定位生效 */
.left-content {
margin-top: 11px;
margin-left: 350px;
height: 55px;
display: flex;
align-items: center;
gap: 16px;
}
.top-title {
height: 55px;
font-family: "YouSheBiaoTiHei", sans-serif;
font-size: 42px;
color: #1E1651;
line-height: 55px;
letter-spacing: 6px;
text-align: left;
}
.center-content {
display: flex;
gap: 8px;
margin-top: 18px;
margin-left: 30px;
.item {
width: 180px;
height: 50px;
background: #E1EEFC;
transform: skew(-20deg);
font-family: PingFangSC, PingFang SC;
font-weight: 400;
font-size: 20px;
color: #1E1651;
line-height: 50px;
letter-spacing: 2px;
text-align: center;
cursor: pointer;
overflow: hidden;
box-shadow: 0px 13px 16px 0px rgba(179, 217, 255, 0.43),
0px 2px 4px 0px rgba(92, 140, 255, 0.25),
inset 0px -43px 13px 0px rgba(255, 255, 255, 0.51);
.item-text {
display: inline-block;
transform: skew(20deg);
}
}
.item.no-skew {
background: none !important;
transform: none !important;
box-shadow: none !important;
color: #1E1651;
.item-text {
transform: none !important;
}
}
}
.timeType {
position: absolute;
display: flex;
align-items: center;
/* 垂直居中,避免元素高低错位 */
top: 42px;
right: 10px;
margin-top: 18px;
gap: 0;
/* 清除间隙,让按钮与选择器紧密连接 */
}
.timeType .item {
width: 50px;
height: 28px;
background: rgba(236, 244, 254, 1);
transform: skew(-25deg);
font-family: PingFangSC, PingFang SC;
font-weight: 400;
font-size: 14px;
color: rgba(11, 88, 255, 1);
line-height: 28px;
letter-spacing: 2px;
text-align: center;
cursor: pointer;
overflow: hidden;
/* 选中按钮与未选中按钮倾斜角度统一,避免切换时跳动 */
}
.timeType .item .item-text {
display: inline-block;
transform: skew(25deg);
transition: all 0.2s ease;
}
.timeType .item.no-skew {
background: rgba(11, 88, 255, 1);
color: rgba(249, 252, 255, 1);
transform: skew(-25deg) !important;
/* 统一倾斜角度修复原30deg的错位 */
box-shadow: 0 2px 8px rgba(11, 88, 255, 0.3);
}
.timeType .item.no-skew .item-text {
transform: skew(25deg) !important;
/* 同步统一文字倾斜角度 */
}
.dateP {
margin-left: 10px;
display: flex;
align-items: center;
gap: 0;
}
.dateP .label {
width: 62px;
height: 28px;
background: rgba(236, 244, 254, 1);
transform: skew(-25deg);
/* 与按钮倾斜角度统一原30deg改为25deg避免视觉错位 */
font-family: PingFangSC, PingFang SC;
font-weight: 400;
font-size: 14px;
color: #0B58FF;
line-height: 28px;
text-align: center;
overflow: hidden;
}
/* 补充label文字抵消倾斜原代码遗漏导致文字倾斜 */
.dateP .label-text {
display: inline-block;
transform: skew(25deg);
/* 与label倾斜角度相反确保文字正立 */
}
.right-content {
display: flex;
flex-direction: column;
margin-top: 12px;
margin-right: 40px;
gap: 20px;
}
.current-time {
color: #FFFFFF;
font-family: PingFangSC, PingFang SC;
font-weight: 500;
font-size: 22px;
line-height: 24px;
letter-spacing: 1px;
}
.screen-btn {
width: 26px;
margin-left: 300px;
color: #00fff0;
font-size: 26px;
padding: 0;
}
}
/* 日期选择器样式保持不变 */
::v-deep .custom-date-picker {
width: 132px !important;
height: 28px !important;
position: relative;
margin: 0 !important;
}
::v-deep .custom-date-picker .el-input--medium .el-input__inner,
::v-deep .custom-date-picker .el-input__inner {
height: 28px !important;
width: 132px !important;
text-align: center;
padding-left: 15px !important;
padding-right: 32px !important;
font-size: 14px !important;
line-height: 28px !important;
color: #fff !important;
clip-path: polygon(20px 0, 100% 0, 100% 100%, 0 100%);
border: none !important;
box-shadow: none !important;
background-color: rgba(11, 88, 255, 1) !important;
border-left: 1px solid rgba(255, 255, 255, 0.2);
}
::v-deep .custom-date-picker .el-input__prefix {
left: auto !important;
right: 8px !important;
top: 40% !important;
transform: translateY(-50%) !important;
}
::v-deep .custom-date-picker .el-input__prefix .el-icon {
color: #fff !important;
font-size: 16px !important;
}
::v-deep .custom-date-picker .el-input__inner:hover,
::v-deep .custom-date-picker .el-input__inner:focus {
background-color: rgba(11, 88, 255, 0.9) !important;
clip-path: polygon(20px 0, 100% 0, 100% 100%, 0 100%) !important;
}
</style>