feat(统计模式): 添加按月/按期统计切换功能并优化客户阶段显示

- 在CenterOverview组件中添加统计模式切换按钮
- 实现统计模式切换逻辑并触发数据重新加载
- 优化SalesTimelineWithTaskList的客户阶段显示和计算逻辑
- 更新API调用参数以支持不同统计模式
- 调整样式和布局以适应新功能
This commit is contained in:
2025-08-26 11:34:50 +08:00
parent 87cc0e4976
commit 58c6ec1c53
7 changed files with 394 additions and 36 deletions

View File

@@ -1,6 +1,22 @@
<template>
<div class="center-overview">
<h2>整体概览</h2>
<div class="overview-header">
<h2>整体概览</h2>
<div class="stats-toggle">
<button
:class="['toggle-btn', { active: statsMode === 'monthly' }]"
@click="switchStatsMode('monthly')"
>
按月统计
</button>
<button
:class="['toggle-btn', { active: statsMode === 'period' }]"
@click="switchStatsMode('period')"
>
按期统计
</button>
</div>
</div>
<div class="overview-grid">
<div class="overview-card primary">
<div class="card-header">
@@ -87,9 +103,24 @@
</template>
<script setup>
import { computed, reactive } from 'vue'
import { computed, reactive, ref } from 'vue'
import Tooltip from '@/components/Tooltip.vue'
// 统计模式状态
const statsMode = ref('monthly') // 默认按月统计
// 定义emit事件
const emit = defineEmits(['update-check-type'])
// 切换统计模式
const switchStatsMode = (mode) => {
statsMode.value = mode
// 向父组件发送事件修改CheckType的值
const checkTypeValue = mode === 'monthly' ? 'month' : 'period'
emit('update-check-type', checkTypeValue)
console.log('切换统计模式:', mode, '发送CheckType值:', checkTypeValue)
}
// 中心整体概览组件
const props = defineProps({
overallTeamPerformance: {
@@ -193,6 +224,44 @@ const hideTooltip = () => {
padding: 0.5rem;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
.overview-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 1rem;
.stats-toggle {
display: flex;
background: #f8fafc;
border-radius: 8px;
padding: 4px;
gap: 2px;
.toggle-btn {
padding: 8px 16px;
border: none;
background: transparent;
border-radius: 6px;
font-size: 0.875rem;
font-weight: 500;
color: #64748b;
cursor: pointer;
transition: all 0.2s ease;
&:hover {
background: #e2e8f0;
color: #475569;
}
&.active {
background: #3b82f6;
color: white;
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}
}
}
}
h2 {
font-size: 1.3rem;
font-weight: 600;
@@ -365,6 +434,19 @@ const hideTooltip = () => {
.center-overview {
padding: 1rem;
.overview-header {
flex-direction: column;
align-items: flex-start;
gap: 1rem;
.stats-toggle {
.toggle-btn {
padding: 6px 12px;
font-size: 0.8rem;
}
}
}
.overview-grid {
grid-template-columns: repeat(2, 1fr);
gap: 0.75rem;