feat(统计模式): 添加按月/按期统计切换功能并优化客户阶段显示
- 在CenterOverview组件中添加统计模式切换按钮 - 实现统计模式切换逻辑并触发数据重新加载 - 优化SalesTimelineWithTaskList的客户阶段显示和计算逻辑 - 更新API调用参数以支持不同统计模式 - 调整样式和布局以适应新功能
This commit is contained in:
@@ -18,6 +18,7 @@
|
||||
<CenterOverview
|
||||
style="height: 330px;"
|
||||
:overallTeamPerformance="overallTeamPerformance"
|
||||
@update-check-type="updateCheckType"
|
||||
/>
|
||||
<div class="action-items-compact">
|
||||
<TeamAlerts style="height: 300px;" :abnormalData="teamAlerts" />
|
||||
@@ -175,6 +176,29 @@ const averageResponseTime = ref(15)
|
||||
const timeoutResponseRate = ref(5)
|
||||
const severeTimeoutRate = ref(2)
|
||||
const formCompletionRate = ref(90)
|
||||
const CheckType = ref('month')
|
||||
|
||||
// 更新CheckType的方法
|
||||
const updateCheckType = async (newValue) => {
|
||||
CheckType.value = newValue
|
||||
console.log('CheckType已更新为:', newValue)
|
||||
|
||||
// 重新获取所有使用CheckType的数据
|
||||
try {
|
||||
isLoading.value = true
|
||||
await fetchOverallTeamPerformance()
|
||||
await fetchActiveGroups()
|
||||
await fetchConversionRate()
|
||||
await fetchTotalCallCount()
|
||||
await fetchNewCustomers()
|
||||
await fetchDepositConversions()
|
||||
console.log('数据已根据新的统计模式重新加载')
|
||||
} catch (error) {
|
||||
console.error('重新加载数据失败:', error)
|
||||
} finally {
|
||||
isLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
const userStore = useUserStore()
|
||||
// 路由实例
|
||||
@@ -216,7 +240,10 @@ async function fetchOverallTeamPerformance() {
|
||||
const hasParams = params.user_name
|
||||
// 团队总业绩
|
||||
try {
|
||||
const response = await getOverallTeamPerformance(hasParams ? params : undefined)
|
||||
const response = await getOverallTeamPerformance(hasParams ? {
|
||||
...params,
|
||||
check_type: CheckType.value
|
||||
} : {check_type: CheckType.value})
|
||||
overallTeamPerformance.value.totalPerformance = response.data
|
||||
} catch (error) {
|
||||
console.error('获取整体概览数据失败:', error)
|
||||
@@ -227,7 +254,10 @@ async function fetchActiveGroups() {
|
||||
const params = getRequestParams()
|
||||
const hasParams = params.user_name
|
||||
try {
|
||||
const response = await getTotalGroupCount(hasParams ? params : undefined)
|
||||
const response = await getTotalGroupCount(hasParams ? {
|
||||
...params,
|
||||
check_type: CheckType.value
|
||||
} : {check_type: CheckType.value})
|
||||
overallTeamPerformance.value.activeGroups = response.data
|
||||
console.log('活跃组数:', response.data)
|
||||
|
||||
@@ -240,7 +270,10 @@ async function fetchConversionRate() {
|
||||
const params = getRequestParams()
|
||||
const hasParams = params.user_name
|
||||
try {
|
||||
const response = await getConversionRate(hasParams ? params : undefined)
|
||||
const response = await getConversionRate(hasParams ? {
|
||||
...params,
|
||||
check_type: CheckType.value
|
||||
} : {check_type: CheckType.value})
|
||||
overallTeamPerformance.value.conversionRate = response.data
|
||||
} catch (error) {
|
||||
console.error('获取团队转化率失败:', error)
|
||||
@@ -251,7 +284,10 @@ async function fetchTotalCallCount() {
|
||||
const params = getRequestParams()
|
||||
const hasParams = params.user_name
|
||||
try {
|
||||
const response = await getTotalCallCount(hasParams ? params : undefined)
|
||||
const response = await getTotalCallCount(hasParams ? {
|
||||
...params,
|
||||
check_type: CheckType.value
|
||||
} : {check_type: CheckType.value})
|
||||
overallTeamPerformance.value.totalCalls = response.data
|
||||
} catch (error) {
|
||||
console.error('获取通话次数失败:', error)
|
||||
@@ -262,7 +298,10 @@ async function fetchNewCustomers() {
|
||||
const params = getRequestParams()
|
||||
const hasParams = params.user_name
|
||||
try {
|
||||
const response = await getNewCustomer(hasParams ? params : undefined)
|
||||
const response = await getNewCustomer(hasParams ? {
|
||||
...params,
|
||||
check_type: CheckType.value
|
||||
} : {check_type: CheckType.value})
|
||||
overallTeamPerformance.value.newCustomers = response.data
|
||||
} catch (error) {
|
||||
console.error('获取新增客户失败:', error)
|
||||
@@ -273,7 +312,10 @@ async function fetchDepositConversions() {
|
||||
const params = getRequestParams()
|
||||
const hasParams = params.user_name
|
||||
try {
|
||||
const response = await getDepositConversionRate(hasParams ? params : undefined)
|
||||
const response = await getDepositConversionRate(hasParams ? {
|
||||
...params,
|
||||
check_type: CheckType.value
|
||||
} : {check_type: CheckType.value})
|
||||
overallTeamPerformance.value.depositConversions = response.data
|
||||
console.log(99888999,response.data)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user