feat(销售页面): 添加模块显示控制功能及周期分析组件
refactor(StatisticData): 简化指标名称显示 style(UserDropdown): 添加显示设置弹窗样式
This commit is contained in:
@@ -25,6 +25,13 @@
|
||||
</svg>
|
||||
修改密码
|
||||
</div>
|
||||
<div class="dropdown-item" @click="handleDisplaySettings">
|
||||
<svg width="16" height="16" viewBox="0 0 16 16" style="margin-right: 8px;">
|
||||
<path d="M8 4.754a3.246 3.246 0 1 0 0 6.492 3.246 3.246 0 0 0 0-6.492zM5.754 8a2.246 2.246 0 1 1 4.492 0 2.246 2.246 0 0 1-4.492 0z" fill="currentColor"/>
|
||||
<path d="M9.796 1.343c-.527-1.79-3.065-1.79-3.592 0l-.094.319a.873.873 0 0 1-1.255.52l-.292-.16c-1.64-.892-3.433.902-2.54 2.541l.159.292a.873.873 0 0 1-.52 1.255l-.319.094c-1.79.527-1.79 3.065 0 3.592l.319.094a.873.873 0 0 1 .52 1.255l-.16.292c-.892 1.64.901 3.434 2.541 2.54l.292-.159a.873.873 0 0 1 1.255.52l.094.319c.527 1.79 3.065 1.79 3.592 0l.094-.319a.873.873 0 0 1 1.255-.52l.292.16c1.64.893 3.434-.902 2.54-2.541l-.159-.292a.873.873 0 0 1 .52-1.255l.319-.094c1.79-.527 1.79-3.065 0-3.592l-.319-.094a.873.873 0 0 1-.52-1.255l.16-.292c.893-1.64-.902-3.433-2.541-2.54l-.292.159a.873.873 0 0 1-1.255-.52l-.094-.319zm-2.633.283c.246-.835 1.428-.835 1.674 0l.094.319a1.873 1.873 0 0 0 2.693 1.115l.291-.16c.764-.415 1.6.42 1.184 1.185l-.159.292a1.873 1.873 0 0 0 1.116 2.692l.318.094c.835.246.835 1.428 0 1.674l-.319.094a1.873 1.873 0 0 0-1.115 2.693l.16.291c.415.764-.42 1.6-1.185 1.184l-.291-.159a1.873 1.873 0 0 0-2.693 1.116l-.094.318c-.246.835-1.428.835-1.674 0l-.094-.319a1.873 1.873 0 0 0-2.692-1.115l-.292.16c-.764.415-1.6-.42-1.184-1.185l.159-.291A1.873 1.873 0 0 0 1.945 8.93l-.319-.094c-.835-.246-.835-1.428 0-1.674l.319-.094A1.873 1.873 0 0 0 3.06 4.377l-.16-.292c-.415-.764.42-1.6 1.185-1.184l.292.159a1.873 1.873 0 0 0 2.692-1.115l.094-.319z" fill="currentColor"/>
|
||||
</svg>
|
||||
显示设置
|
||||
</div>
|
||||
<div class="dropdown-item logout-item" @click="handleLogout">
|
||||
<svg width="16" height="16" viewBox="0 0 16 16" style="margin-right: 8px;">
|
||||
<path d="M6 2a1 1 0 0 0-1 1v10a1 1 0 0 0 1 1h4a1 1 0 0 0 1-1V3a1 1 0 0 0-1-1H6zM5 3a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V3z" fill="currentColor"/>
|
||||
@@ -148,6 +155,49 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 显示设置弹窗 -->
|
||||
<div v-if="showDisplayModal" class="display-modal-overlay" @click="cancelDisplaySettings">
|
||||
<div class="display-modal" @click.stop>
|
||||
<div class="display-modal-header">
|
||||
<h2>显示设置</h2>
|
||||
<p>选择要显示的模块</p>
|
||||
</div>
|
||||
|
||||
<div class="display-modal-body">
|
||||
<div class="checkbox-group">
|
||||
<label v-for="(visible, key) in localCardVisibility" :key="key" class="checkbox-item">
|
||||
<input
|
||||
type="checkbox"
|
||||
v-model="localCardVisibility[key]"
|
||||
:disabled="displayLoading"
|
||||
/>
|
||||
<span class="checkbox-label">{{ getCardDisplayName(key) }}</span>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="display-modal-footer">
|
||||
<button
|
||||
type="button"
|
||||
class="btn-cancel"
|
||||
@click="cancelDisplaySettings"
|
||||
:disabled="displayLoading"
|
||||
>
|
||||
取消
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
class="btn-confirm"
|
||||
@click="handleDisplaySubmit"
|
||||
:disabled="displayLoading"
|
||||
>
|
||||
<span v-if="displayLoading" class="loading-spinner"></span>
|
||||
{{ displayLoading ? '应用中...' : '确认应用' }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 退出登录确认弹窗 -->
|
||||
<div v-if="showLogoutModal" class="logout-modal-overlay" @click="cancelLogout">
|
||||
<div class="logout-modal" @click.stop>
|
||||
@@ -166,11 +216,28 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, onMounted, onUnmounted } from 'vue'
|
||||
import { ref, reactive, onMounted, onUnmounted, watch } from 'vue'
|
||||
import { useRouter } from 'vue-router'
|
||||
import { useUserStore } from '@/stores/user'
|
||||
import http from '@/utils/https'
|
||||
|
||||
// Props
|
||||
const props = defineProps({
|
||||
cardVisibility: {
|
||||
type: Object,
|
||||
default: () => ({
|
||||
timeline: true,
|
||||
rawData: true,
|
||||
customerDetail: true,
|
||||
analytics: true,
|
||||
weekAnalysis: true
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
// Emits
|
||||
const emit = defineEmits(['update-card-visibility'])
|
||||
|
||||
// 路由实例
|
||||
const router = useRouter()
|
||||
|
||||
@@ -192,6 +259,26 @@ const passwordForm = ref({
|
||||
newPassword: ''
|
||||
}) // 修改密码表单数据
|
||||
const passwordLoading = ref(false) // 修改密码加载状态
|
||||
const showDisplayModal = ref(false) // 显示设置弹窗显示状态
|
||||
const displayLoading = ref(false) // 显示设置加载状态
|
||||
const localCardVisibility = reactive({}) // 本地卡片显示状态
|
||||
|
||||
// 监听props变化,同步到本地状态
|
||||
watch(() => props.cardVisibility, (newVal) => {
|
||||
Object.assign(localCardVisibility, newVal)
|
||||
}, { immediate: true, deep: true })
|
||||
|
||||
// 获取卡片显示名称
|
||||
const getCardDisplayName = (key) => {
|
||||
const nameMap = {
|
||||
timeline: '销售时间线',
|
||||
rawData: '原始数据',
|
||||
customerDetail: '客户详情',
|
||||
analytics: '数据分析',
|
||||
weekAnalysis: '周期分析'
|
||||
}
|
||||
return nameMap[key] || key
|
||||
}
|
||||
|
||||
// 切换下拉菜单显示状态
|
||||
const toggleDropdown = () => {
|
||||
@@ -309,6 +396,39 @@ const cancelPasswordChange = () => {
|
||||
passwordForm.value.newPassword = ''
|
||||
}
|
||||
|
||||
// 显示设置
|
||||
const handleDisplaySettings = () => {
|
||||
console.log('显示设置')
|
||||
showDropdown.value = false
|
||||
showDisplayModal.value = true
|
||||
}
|
||||
|
||||
// 显示设置处理函数
|
||||
const handleDisplaySubmit = async () => {
|
||||
displayLoading.value = true
|
||||
|
||||
try {
|
||||
// 发送事件给父组件更新卡片显示状态
|
||||
emit('update-card-visibility', { ...localCardVisibility })
|
||||
|
||||
// 模拟异步操作
|
||||
await new Promise(resolve => setTimeout(resolve, 300))
|
||||
|
||||
showDisplayModal.value = false
|
||||
} catch (error) {
|
||||
console.error('显示设置失败:', error)
|
||||
} finally {
|
||||
displayLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
// 取消显示设置
|
||||
const cancelDisplaySettings = () => {
|
||||
showDisplayModal.value = false
|
||||
// 恢复到原始状态
|
||||
Object.assign(localCardVisibility, props.cardVisibility)
|
||||
}
|
||||
|
||||
// 退出登录
|
||||
const handleLogout = () => {
|
||||
showDropdown.value = false
|
||||
@@ -655,6 +775,142 @@ const cancelLogout = () => {
|
||||
}
|
||||
}
|
||||
|
||||
/* 显示设置弹窗样式 */
|
||||
.display-modal-overlay {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background: rgba(0, 0, 0, 0.5);
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
z-index: 9999;
|
||||
backdrop-filter: blur(4px);
|
||||
}
|
||||
|
||||
.display-modal {
|
||||
background: white;
|
||||
border-radius: 12px;
|
||||
box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
|
||||
min-width: 400px;
|
||||
max-width: 500px;
|
||||
animation: modalSlideIn 0.3s ease-out;
|
||||
}
|
||||
|
||||
.display-modal-header {
|
||||
padding: 24px 24px 16px;
|
||||
border-bottom: 1px solid #f1f5f9;
|
||||
}
|
||||
|
||||
.display-modal-header h2 {
|
||||
font-size: 20px;
|
||||
font-weight: 600;
|
||||
color: #1e293b;
|
||||
margin: 0 0 8px 0;
|
||||
}
|
||||
|
||||
.display-modal-header p {
|
||||
font-size: 14px;
|
||||
color: #64748b;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.display-modal-body {
|
||||
padding: 24px;
|
||||
}
|
||||
|
||||
.checkbox-group {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 16px;
|
||||
}
|
||||
|
||||
.checkbox-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
cursor: pointer;
|
||||
padding: 8px;
|
||||
border-radius: 6px;
|
||||
transition: background-color 0.2s;
|
||||
}
|
||||
|
||||
.checkbox-item:hover {
|
||||
background-color: #f8fafc;
|
||||
}
|
||||
|
||||
.checkbox-item input[type="checkbox"] {
|
||||
width: 18px;
|
||||
height: 18px;
|
||||
margin-right: 12px;
|
||||
cursor: pointer;
|
||||
accent-color: #667eea;
|
||||
}
|
||||
|
||||
.checkbox-item input[type="checkbox"]:disabled {
|
||||
cursor: not-allowed;
|
||||
opacity: 0.6;
|
||||
}
|
||||
|
||||
.checkbox-label {
|
||||
font-size: 14px;
|
||||
color: #374151;
|
||||
font-weight: 500;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.display-modal-footer {
|
||||
padding: 16px 24px 24px 24px;
|
||||
display: flex;
|
||||
gap: 12px;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
|
||||
.display-modal-footer .btn-cancel,
|
||||
.display-modal-footer .btn-confirm {
|
||||
padding: 12px 24px;
|
||||
border-radius: 8px;
|
||||
font-size: 14px;
|
||||
font-weight: 500;
|
||||
cursor: pointer;
|
||||
transition: all 0.2s;
|
||||
border: none;
|
||||
min-width: 80px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.display-modal-footer .btn-cancel {
|
||||
background: #f8fafc;
|
||||
color: #64748b;
|
||||
border: 1px solid #e2e8f0;
|
||||
}
|
||||
|
||||
.display-modal-footer .btn-cancel:hover:not(:disabled) {
|
||||
background: #f1f5f9;
|
||||
transform: translateY(-1px);
|
||||
}
|
||||
|
||||
.display-modal-footer .btn-confirm {
|
||||
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
||||
color: white;
|
||||
}
|
||||
|
||||
.display-modal-footer .btn-confirm:hover:not(:disabled) {
|
||||
transform: translateY(-1px);
|
||||
box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
|
||||
}
|
||||
|
||||
.display-modal-footer .btn-cancel:disabled,
|
||||
.display-modal-footer .btn-confirm:disabled {
|
||||
opacity: 0.6;
|
||||
cursor: not-allowed;
|
||||
transform: none;
|
||||
}
|
||||
|
||||
/* 修改密码弹窗样式 */
|
||||
.password-modal-overlay {
|
||||
position: fixed;
|
||||
|
||||
@@ -6,12 +6,12 @@
|
||||
<div class="kpi-item stat-item" >
|
||||
<div class="stat-icon customer-rate"><i class="el-icon-chat-dot-round"></i></div>
|
||||
<div class="kpi-value">{{ customerCommunicationRate }}</div>
|
||||
<p>活跃客户沟通率 <i class="info-icon" @mouseenter="showTooltip('customerCommunicationRate', $event)" @mouseleave="hideTooltip">ⓘ</i></p>
|
||||
<p>客户沟通率 <i class="info-icon" @mouseenter="showTooltip('customerCommunicationRate', $event)" @mouseleave="hideTooltip">ⓘ</i></p>
|
||||
</div>
|
||||
<div class="kpi-item stat-item" >
|
||||
<div class="stat-icon response-time"><i class="el-icon-timer"></i></div>
|
||||
<div class="kpi-value">{{ averageResponseTime }}<span class="kpi-unit">分钟</span></div>
|
||||
<p>平均应答时间 <i class="info-icon" @mouseenter="showTooltip('averageResponseTime', $event)" @mouseleave="hideTooltip">ⓘ</i></p>
|
||||
<div class="kpi-value">{{ averageResponseTime }}<span class="kpi-unit">分</span></div>
|
||||
<p>均响应时间 <i class="info-icon" @mouseenter="showTooltip('averageResponseTime', $event)" @mouseleave="hideTooltip">ⓘ</i></p>
|
||||
</div>
|
||||
<div class="kpi-item stat-item" >
|
||||
<div class="stat-icon timeout-rate"><i class="el-icon-warning"></i></div>
|
||||
@@ -21,7 +21,7 @@
|
||||
<div class="kpi-item stat-item">
|
||||
<div class="stat-icon severe-timeout-rate"><i class="el-icon-warning-outline"></i></div>
|
||||
<div class="kpi-value">{{ severeTimeoutRate }}</div>
|
||||
<p>严重超时应答率 <i class="info-icon" @mouseenter="showTooltip('severeTimeoutRate', $event)" @mouseleave="hideTooltip">ⓘ</i></p>
|
||||
<p>严重超时率 <i class="info-icon" @mouseenter="showTooltip('severeTimeoutRate', $event)" @mouseleave="hideTooltip">ⓘ</i></p>
|
||||
</div>
|
||||
<div class="kpi-item stat-item">
|
||||
<div class="stat-icon form-rate"><i class="el-icon-document"></i></div>
|
||||
|
||||
475
my-vue-app/src/views/person/components/WeekAnalize.vue
Normal file
475
my-vue-app/src/views/person/components/WeekAnalize.vue
Normal file
@@ -0,0 +1,475 @@
|
||||
<template>
|
||||
<div class="week-analyze">
|
||||
<div class="analyze-header">
|
||||
<h3>本周综合表现分析</h3>
|
||||
<p class="analyze-subtitle">基于本周销售数据的综合分析报告</p>
|
||||
</div>
|
||||
|
||||
<div class="analyze-content">
|
||||
<!-- 周期表现概览 -->
|
||||
<div class="performance-overview">
|
||||
<div class="overview-card">
|
||||
<div class="card-icon">
|
||||
<svg width="24" height="24" viewBox="0 0 24 24" fill="none">
|
||||
<path d="M12 2L15.09 8.26L22 9L17 14L18.18 21L12 17.77L5.82 21L7 14L2 9L8.91 8.26L12 2Z" fill="#FFD700"/>
|
||||
</svg>
|
||||
</div>
|
||||
<div class="card-content">
|
||||
<h4>综合评分</h4>
|
||||
<div class="score">{{ overallScore }}<span class="score-unit">/100</span></div>
|
||||
<div class="score-trend" :class="scoreTrend.type">
|
||||
{{ scoreTrend.text }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="overview-card">
|
||||
<div class="card-icon">
|
||||
<svg width="24" height="24" viewBox="0 0 24 24" fill="none">
|
||||
<path d="M16 6L18.29 8.29L13.41 13.17L9.41 9.17L2 16.59L3.41 18L9.41 12L13.41 16L19.71 9.71L22 12V6H16Z" fill="#4CAF50"/>
|
||||
</svg>
|
||||
</div>
|
||||
<div class="card-content">
|
||||
<h4>目标完成率</h4>
|
||||
<div class="score">{{ targetCompletion }}<span class="score-unit">%</span></div>
|
||||
<div class="progress-bar">
|
||||
<div class="progress-fill" :style="{ width: targetCompletion + '%' }"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="overview-card">
|
||||
<div class="card-icon">
|
||||
<svg width="24" height="24" viewBox="0 0 24 24" fill="none">
|
||||
<path d="M12 2C6.48 2 2 6.48 2 12S6.48 22 12 22 22 17.52 22 12 17.52 2 12 2ZM13 17H11V15H13V17ZM13 13H11V7H13V13Z" fill="#FF9800"/>
|
||||
</svg>
|
||||
</div>
|
||||
<div class="card-content">
|
||||
<h4>改进建议</h4>
|
||||
<div class="suggestions-count">{{ suggestions.length }}项</div>
|
||||
<div class="suggestions-preview">{{ suggestions[0]?.title || '暂无建议' }}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 详细分析 -->
|
||||
<div class="detailed-analysis">
|
||||
<div class="analysis-section">
|
||||
<h4>关键指标表现</h4>
|
||||
<div class="metrics-grid">
|
||||
<div v-for="metric in keyMetrics" :key="metric.name" class="metric-item">
|
||||
<div class="metric-header">
|
||||
<span class="metric-name">{{ metric.name }}</span>
|
||||
<span class="metric-trend" :class="metric.trend">
|
||||
{{ metric.trendText }}
|
||||
</span>
|
||||
</div>
|
||||
<div class="metric-value">
|
||||
<span class="current-value">{{ metric.current }}</span>
|
||||
<span class="target-value">/ {{ metric.target }}</span>
|
||||
</div>
|
||||
<div class="metric-progress">
|
||||
<div class="progress-bar">
|
||||
<div class="progress-fill" :style="{ width: (metric.current / metric.target * 100) + '%' }"></div>
|
||||
</div>
|
||||
<span class="progress-text">{{ Math.round(metric.current / metric.target * 100) }}%</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="analysis-section">
|
||||
<h4>改进建议</h4>
|
||||
<div class="suggestions-list">
|
||||
<div v-for="suggestion in suggestions" :key="suggestion.id" class="suggestion-item">
|
||||
<div class="suggestion-priority" :class="suggestion.priority"></div>
|
||||
<div class="suggestion-content">
|
||||
<h5>{{ suggestion.title }}</h5>
|
||||
<p>{{ suggestion.description }}</p>
|
||||
<div class="suggestion-actions">
|
||||
<span class="action-tag" v-for="action in suggestion.actions" :key="action">{{ action }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, computed, onMounted } from 'vue'
|
||||
|
||||
// Props
|
||||
const props = defineProps({
|
||||
weekData: {
|
||||
type: Object,
|
||||
default: () => ({})
|
||||
}
|
||||
})
|
||||
|
||||
// 响应式数据
|
||||
const overallScore = ref(78)
|
||||
const targetCompletion = ref(65)
|
||||
|
||||
const scoreTrend = computed(() => {
|
||||
const score = overallScore.value
|
||||
if (score >= 80) {
|
||||
return { type: 'positive', text: '表现优秀' }
|
||||
} else if (score >= 60) {
|
||||
return { type: 'neutral', text: '表现良好' }
|
||||
} else {
|
||||
return { type: 'negative', text: '需要改进' }
|
||||
}
|
||||
})
|
||||
|
||||
const keyMetrics = ref([
|
||||
{
|
||||
name: '通话量',
|
||||
current: 85,
|
||||
target: 100,
|
||||
trend: 'positive',
|
||||
trendText: '↗ +12%'
|
||||
},
|
||||
{
|
||||
name: '接通率',
|
||||
current: 68,
|
||||
target: 80,
|
||||
trend: 'neutral',
|
||||
trendText: '→ 持平'
|
||||
},
|
||||
{
|
||||
name: '转化率',
|
||||
current: 12,
|
||||
target: 15,
|
||||
trend: 'negative',
|
||||
trendText: '↘ -3%'
|
||||
},
|
||||
{
|
||||
name: '客户满意度',
|
||||
current: 4.2,
|
||||
target: 4.5,
|
||||
trend: 'positive',
|
||||
trendText: '↗ +0.2'
|
||||
}
|
||||
])
|
||||
|
||||
const suggestions = ref([
|
||||
{
|
||||
id: 1,
|
||||
title: '提升通话转化率',
|
||||
description: '当前转化率低于目标,建议优化话术和跟进策略',
|
||||
priority: 'high',
|
||||
actions: ['话术优化', '跟进策略', '客户画像分析']
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
title: '增加客户互动频次',
|
||||
description: '客户响应时间较长,建议增加主动联系频次',
|
||||
priority: 'medium',
|
||||
actions: ['主动联系', '内容营销', '社群运营']
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
title: '优化时间管理',
|
||||
description: '通话时长分布不均,建议优化时间分配',
|
||||
priority: 'low',
|
||||
actions: ['时间规划', '效率工具', '任务优先级']
|
||||
}
|
||||
])
|
||||
|
||||
// 生命周期
|
||||
onMounted(() => {
|
||||
// 可以在这里根据传入的数据计算分析结果
|
||||
console.log('WeekAnalize组件已挂载', props.weekData)
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.week-analyze {
|
||||
background: #fff;
|
||||
border-radius: 12px;
|
||||
padding: 24px;
|
||||
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
.analyze-header {
|
||||
margin-bottom: 24px;
|
||||
}
|
||||
|
||||
.analyze-header h3 {
|
||||
font-size: 20px;
|
||||
font-weight: 600;
|
||||
color: #1a1a1a;
|
||||
margin: 0 0 8px 0;
|
||||
}
|
||||
|
||||
.analyze-subtitle {
|
||||
color: #666;
|
||||
font-size: 14px;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.performance-overview {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
|
||||
gap: 20px;
|
||||
margin-bottom: 32px;
|
||||
}
|
||||
|
||||
.overview-card {
|
||||
background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
|
||||
border-radius: 12px;
|
||||
padding: 20px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 16px;
|
||||
border: 1px solid #e9ecef;
|
||||
}
|
||||
|
||||
.card-icon {
|
||||
width: 48px;
|
||||
height: 48px;
|
||||
background: #fff;
|
||||
border-radius: 12px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
.card-content h4 {
|
||||
font-size: 14px;
|
||||
color: #666;
|
||||
margin: 0 0 8px 0;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.score {
|
||||
font-size: 28px;
|
||||
font-weight: 700;
|
||||
color: #1a1a1a;
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
.score-unit {
|
||||
font-size: 16px;
|
||||
color: #666;
|
||||
font-weight: 400;
|
||||
}
|
||||
|
||||
.score-trend {
|
||||
font-size: 12px;
|
||||
margin-top: 4px;
|
||||
}
|
||||
|
||||
.score-trend.positive {
|
||||
color: #4CAF50;
|
||||
}
|
||||
|
||||
.score-trend.neutral {
|
||||
color: #FF9800;
|
||||
}
|
||||
|
||||
.score-trend.negative {
|
||||
color: #f44336;
|
||||
}
|
||||
|
||||
.progress-bar {
|
||||
width: 100%;
|
||||
height: 6px;
|
||||
background: #e9ecef;
|
||||
border-radius: 3px;
|
||||
overflow: hidden;
|
||||
margin-top: 8px;
|
||||
}
|
||||
|
||||
.progress-fill {
|
||||
height: 100%;
|
||||
background: linear-gradient(90deg, #4CAF50 0%, #8BC34A 100%);
|
||||
border-radius: 3px;
|
||||
transition: width 0.3s ease;
|
||||
}
|
||||
|
||||
.suggestions-count {
|
||||
font-size: 24px;
|
||||
font-weight: 700;
|
||||
color: #FF9800;
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
.suggestions-preview {
|
||||
font-size: 12px;
|
||||
color: #666;
|
||||
margin-top: 4px;
|
||||
}
|
||||
|
||||
.detailed-analysis {
|
||||
display: grid;
|
||||
gap: 32px;
|
||||
}
|
||||
|
||||
.analysis-section h4 {
|
||||
font-size: 16px;
|
||||
font-weight: 600;
|
||||
color: #1a1a1a;
|
||||
margin: 0 0 16px 0;
|
||||
}
|
||||
|
||||
.metrics-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
|
||||
gap: 16px;
|
||||
}
|
||||
|
||||
.metric-item {
|
||||
background: #f8f9fa;
|
||||
border-radius: 8px;
|
||||
padding: 16px;
|
||||
border: 1px solid #e9ecef;
|
||||
}
|
||||
|
||||
.metric-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
|
||||
.metric-name {
|
||||
font-size: 14px;
|
||||
color: #1a1a1a;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.metric-trend {
|
||||
font-size: 12px;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.metric-trend.positive {
|
||||
color: #4CAF50;
|
||||
}
|
||||
|
||||
.metric-trend.neutral {
|
||||
color: #FF9800;
|
||||
}
|
||||
|
||||
.metric-trend.negative {
|
||||
color: #f44336;
|
||||
}
|
||||
|
||||
.metric-value {
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
|
||||
.current-value {
|
||||
font-size: 20px;
|
||||
font-weight: 700;
|
||||
color: #1a1a1a;
|
||||
}
|
||||
|
||||
.target-value {
|
||||
font-size: 14px;
|
||||
color: #666;
|
||||
margin-left: 4px;
|
||||
}
|
||||
|
||||
.metric-progress {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.metric-progress .progress-bar {
|
||||
flex: 1;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.progress-text {
|
||||
font-size: 12px;
|
||||
color: #666;
|
||||
min-width: 35px;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.suggestions-list {
|
||||
display: grid;
|
||||
gap: 16px;
|
||||
}
|
||||
|
||||
.suggestion-item {
|
||||
display: flex;
|
||||
gap: 12px;
|
||||
padding: 16px;
|
||||
background: #f8f9fa;
|
||||
border-radius: 8px;
|
||||
border: 1px solid #e9ecef;
|
||||
}
|
||||
|
||||
.suggestion-priority {
|
||||
width: 4px;
|
||||
border-radius: 2px;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.suggestion-priority.high {
|
||||
background: #f44336;
|
||||
}
|
||||
|
||||
.suggestion-priority.medium {
|
||||
background: #FF9800;
|
||||
}
|
||||
|
||||
.suggestion-priority.low {
|
||||
background: #4CAF50;
|
||||
}
|
||||
|
||||
.suggestion-content h5 {
|
||||
font-size: 14px;
|
||||
font-weight: 600;
|
||||
color: #1a1a1a;
|
||||
margin: 0 0 8px 0;
|
||||
}
|
||||
|
||||
.suggestion-content p {
|
||||
font-size: 13px;
|
||||
color: #666;
|
||||
margin: 0 0 12px 0;
|
||||
line-height: 1.4;
|
||||
}
|
||||
|
||||
.suggestion-actions {
|
||||
display: flex;
|
||||
gap: 8px;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.action-tag {
|
||||
background: #e3f2fd;
|
||||
color: #1976d2;
|
||||
font-size: 11px;
|
||||
padding: 4px 8px;
|
||||
border-radius: 12px;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
@media (max-width: 768px) {
|
||||
.week-analyze {
|
||||
padding: 16px;
|
||||
}
|
||||
|
||||
.performance-overview {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
|
||||
.metrics-grid {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
|
||||
.overview-card {
|
||||
padding: 16px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -4,7 +4,7 @@
|
||||
<Loading :visible="isPageLoading" text="正在加载数据..." />
|
||||
<!-- 顶部导航栏 -->
|
||||
<!-- 销售时间线区域 -->
|
||||
<section class="timeline-section">
|
||||
<section v-if="cardVisibility.timeline" class="timeline-section">
|
||||
<div class="section-header">
|
||||
<!-- 动态顶栏:根据是否有路由参数显示不同内容 -->
|
||||
<!-- 路由跳转时的顶栏:面包屑 + 姓名 -->
|
||||
@@ -13,8 +13,14 @@
|
||||
<span class="breadcrumb-item" @click="goBack">团队管理 >{{ routeUserName }}</span>
|
||||
<span class="breadcrumb-item current"> 数据驾驶舱</span>
|
||||
</div>
|
||||
<div class="user-name">
|
||||
{{ routeUserName }}
|
||||
<div style="display: flex; align-items: center; gap: 20px;">
|
||||
<div class="user-name">
|
||||
{{ routeUserName }}
|
||||
</div>
|
||||
<UserDropdown
|
||||
:card-visibility="cardVisibility"
|
||||
@update-card-visibility="updateCardVisibility"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -27,7 +33,10 @@
|
||||
style="display: flex; align-items: center; gap: 30px"
|
||||
>
|
||||
</div>
|
||||
<UserDropdown />
|
||||
<UserDropdown
|
||||
:card-visibility="cardVisibility"
|
||||
@update-card-visibility="updateCardVisibility"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
@@ -57,7 +66,7 @@
|
||||
</section>
|
||||
|
||||
<!-- 原始数据卡片区域 -->
|
||||
<section class="raw-data-section">
|
||||
<section v-if="cardVisibility.rawData" class="raw-data-section">
|
||||
<div class="section-header">
|
||||
<h2>原始数据</h2>
|
||||
<p class="section-subtitle">客户互动的原始记录和数据</p>
|
||||
@@ -80,7 +89,7 @@
|
||||
<!-- 主要工作区域 -->
|
||||
<main class="main-content">
|
||||
<!-- 客户详情区域 -->
|
||||
<section class="detail-section">
|
||||
<section v-if="cardVisibility.customerDetail" class="detail-section">
|
||||
<div class="section-header">
|
||||
<h2>客户详情</h2>
|
||||
</div>
|
||||
@@ -95,7 +104,7 @@
|
||||
</section>
|
||||
</main>
|
||||
</div>
|
||||
<section class="analytics-section-full" style="width: 100%;">
|
||||
<section v-if="cardVisibility.analytics" class="analytics-section-full" style="width: 100%;">
|
||||
|
||||
<div class="section-content">
|
||||
<!-- 数据分析区域加载状态 -->
|
||||
@@ -114,6 +123,13 @@
|
||||
/>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<!-- 周期分析区域 -->
|
||||
<section v-if="cardVisibility.weekAnalysis" class="week-analysis-section" style="width: 100%; margin-top: 24px;">
|
||||
<div class="section-content">
|
||||
<WeekAnalize :week-data="weekAnalysisData" />
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -125,6 +141,7 @@ import CustomerDetail from "./components/CustomerDetail.vue";
|
||||
import PersonalDashboard from "./components/PersonalDashboard.vue";
|
||||
import SalesTimelineWithTaskList from "./components/SalesTimelineWithTaskList.vue";
|
||||
import RawDataCards from "./components/RawDataCards.vue";
|
||||
import WeekAnalize from "./components/WeekAnalize.vue";
|
||||
import UserDropdown from "@/components/UserDropdown.vue";
|
||||
import Loading from "@/components/Loading.vue";
|
||||
import {getCustomerAttendance,getTodayCall,getProblemDistribution,getTableFillingRate,getAverageResponseTime,
|
||||
@@ -238,6 +255,37 @@ const isStatisticsLoading = ref(false); // 统计数据加载状态
|
||||
const isUrgentProblemLoading = ref(false); // 紧急问题数据加载状态
|
||||
const isTimelineLoading = ref(false); // 时间线数据加载状态
|
||||
|
||||
// 卡片显示隐藏控制
|
||||
const cardVisibility = reactive({
|
||||
timeline: true, // 销售时间线
|
||||
rawData: true, // 原始数据卡片
|
||||
customerDetail: true, // 客户详情
|
||||
analytics: true, // 数据分析
|
||||
weekAnalysis: true // 周期分析
|
||||
});
|
||||
|
||||
// 切换卡片显示状态
|
||||
const toggleCardVisibility = (cardName) => {
|
||||
cardVisibility[cardName] = !cardVisibility[cardName];
|
||||
};
|
||||
|
||||
// 更新卡片显示状态(从UserDropdown组件接收)
|
||||
const updateCardVisibility = (newVisibility) => {
|
||||
Object.assign(cardVisibility, newVisibility);
|
||||
};
|
||||
|
||||
// 获取卡片显示名称
|
||||
const getCardDisplayName = (key) => {
|
||||
const nameMap = {
|
||||
timeline: '销售时间线',
|
||||
rawData: '原始数据',
|
||||
customerDetail: '客户详情',
|
||||
analytics: '数据分析',
|
||||
weekAnalysis: '周期分析'
|
||||
};
|
||||
return nameMap[key] || key;
|
||||
};
|
||||
|
||||
// KPI数据
|
||||
const kpiDataState = reactive({
|
||||
totalCalls: 85,
|
||||
@@ -263,6 +311,9 @@ const urgentProblemData = ref([]);
|
||||
// 时间线数据
|
||||
const timelineData = ref({});
|
||||
|
||||
// 周期分析数据
|
||||
const weekAnalysisData = ref({});
|
||||
|
||||
// 客户列表数据
|
||||
const customersList = ref([]);
|
||||
|
||||
@@ -428,7 +479,6 @@ async function getTimeline() {
|
||||
if(classRes.code === 200) {
|
||||
// 处理课1-4阶段的客户数据
|
||||
if (classRes.data.class_customers_list) {
|
||||
console.log(8888999,courseCustomers.value)
|
||||
// 存储课1-4阶段的原始数据,根据pay_status设置正确的type
|
||||
courseCustomers.value['课1-4'] = classRes.data.class_customers_list.map(customer => {
|
||||
let customerType = ''; // 默认类型
|
||||
@@ -542,7 +592,6 @@ async function getCustomerForm() {
|
||||
// 聊天记录
|
||||
async function getCustomerChat() {
|
||||
if (!selectedContact.value || !selectedContact.value.name) {
|
||||
console.warn('无法获取客户聊天记录:客户信息不完整');
|
||||
return;
|
||||
}
|
||||
const routeParams = getRequestParams()
|
||||
@@ -554,8 +603,6 @@ async function getCustomerChat() {
|
||||
const res = await withCache('getCustomerChatInfo', () => getCustomerChatInfo(params), params)
|
||||
if(res.code === 200) {
|
||||
chatRecords.value = res.data
|
||||
console.log('聊天数据获取成功:', res.data)
|
||||
console.log('chatRecords.value:', chatRecords.value)
|
||||
} else {
|
||||
console.log('聊天数据获取失败:', res)
|
||||
}
|
||||
@@ -566,7 +613,6 @@ async function getCustomerChat() {
|
||||
// 通话记录
|
||||
async function getCustomerCall() {
|
||||
if (!selectedContact.value || !selectedContact.value.name) {
|
||||
console.warn('无法获取客户通话记录:客户信息不完整');
|
||||
return;
|
||||
}
|
||||
const routeParams = getRequestParams()
|
||||
@@ -580,15 +626,6 @@ async function getCustomerCall() {
|
||||
callRecords.value = res.data
|
||||
console.log('Call Records Data from API:', res.data)
|
||||
console.log('callRecords.value after assignment:', callRecords.value)
|
||||
/**
|
||||
* "data": {
|
||||
"user_name": "常琳",
|
||||
"customer_name": "191桐桐爸爸高一男(婧)",
|
||||
"record_file_addr_list": [
|
||||
"http://192.168.3.112:5000/api/record/download/杨振彦-20分钟通话-25-08-19_07-23-37-744009-835.mp3"
|
||||
]
|
||||
}
|
||||
*/
|
||||
}
|
||||
} catch (error) {
|
||||
// 静默处理错误
|
||||
@@ -779,8 +816,6 @@ const handleStageSelect = (stage, extraData = null) => {
|
||||
|
||||
// 处理子时间轴阶段选择
|
||||
const handleSubStageSelect = (eventData) => {
|
||||
console.log('子时间轴选择事件:', eventData);
|
||||
|
||||
// 将筛选后的客户数据转换为contacts格式
|
||||
const filteredContacts = eventData.filteredCustomers.map(customer => ({
|
||||
id: customer.customer_name || customer.id,
|
||||
@@ -812,21 +847,17 @@ const handleSubStageSelect = (eventData) => {
|
||||
// 更新当前筛选的客户数据,但保持selectedStage不变(保持子时间轴显示)
|
||||
currentFilteredCustomers.value = filteredContacts;
|
||||
|
||||
console.log(`已筛选出${eventData.originalStageType}阶段的${filteredContacts.length}位客户`);
|
||||
};
|
||||
|
||||
const handleViewFormData = async (contact) => {
|
||||
// 获取客户表单数据
|
||||
await getCustomerForm();
|
||||
console.log('表单数据已加载:', formInfo.value);
|
||||
};
|
||||
|
||||
const handleViewChatData = async (contact) => {
|
||||
console.log('查看聊天数据:', contact)
|
||||
await getCustomerChatInfo({
|
||||
customerId: selectedContact.value?.customerId || 1
|
||||
})
|
||||
console.log('聊天数据已更新:', chatRecords.value)
|
||||
};
|
||||
|
||||
const handleViewCallData = (contact) => {
|
||||
@@ -835,7 +866,6 @@ const handleViewCallData = (contact) => {
|
||||
|
||||
// 处理SOP分析事件
|
||||
const handleAnalyzeSop = (analyzeData) => {
|
||||
console.log('收到SOP分析请求:', analyzeData);
|
||||
if (customerDetailRef.value && analyzeData.content) {
|
||||
customerDetailRef.value.startSopAnalysis(analyzeData.content);
|
||||
}
|
||||
@@ -878,7 +908,6 @@ async function CenterGetGoldContactTime() {
|
||||
// 清除所有缓存
|
||||
function clearCache() {
|
||||
cache.clear()
|
||||
console.log('所有缓存已清除')
|
||||
}
|
||||
|
||||
// 清除特定缓存
|
||||
@@ -907,9 +936,6 @@ function getCacheInfo() {
|
||||
}
|
||||
}
|
||||
|
||||
console.log('有效缓存:', validCaches)
|
||||
console.log('已清理过期缓存:', expiredCaches)
|
||||
|
||||
return {
|
||||
validCount: validCaches.length,
|
||||
expiredCount: expiredCaches.length,
|
||||
@@ -937,16 +963,12 @@ async function forceRefreshAllData() {
|
||||
selectedContact.value ? getCustomerChat() : Promise.resolve(),
|
||||
selectedContact.value ? getCustomerCall() : Promise.resolve()
|
||||
])
|
||||
|
||||
console.log('所有数据刷新完成')
|
||||
}
|
||||
|
||||
// LIFECYCLE HOOKS
|
||||
onMounted(async () => {
|
||||
try {
|
||||
// 输出缓存状态信息
|
||||
console.log('Sale页面缓存系统已初始化,缓存时长:', CACHE_DURATION / (1000 * 60), '分钟')
|
||||
|
||||
try {
|
||||
isPageLoading.value = true
|
||||
await getStatisticsData()
|
||||
await getCoreKpi()
|
||||
@@ -971,7 +993,6 @@ onMounted(async () => {
|
||||
forceRefreshAllData,
|
||||
cache
|
||||
}
|
||||
console.log('开发模式:缓存管理函数已暴露到 window.saleCache')
|
||||
}
|
||||
|
||||
// 等待数据加载完成后选择默认客户
|
||||
|
||||
Reference in New Issue
Block a user