feat(api): 添加获取平均通话时长和有效通话时长的接口

添加了获取平均通话时长的接口 getAvgCallTime 和获取有效通话时长的接口 getGroupCallDuration
更新了相关视图组件以使用新接口数据
This commit is contained in:
2025-08-27 15:35:54 +08:00
parent ecf63b74cb
commit 152f5c2b4a
5 changed files with 34 additions and 10 deletions

View File

@@ -12,9 +12,9 @@
<div class="report-card">
<div class="card-header">
<span class="card-title">有效通话时长 <i class="info-icon" @mouseenter="showTooltip('callDuration', $event)" @mouseleave="hideTooltip"></i></span>
<span class="card-trend negative">{{ weekTotalData.week_total_call?.team_data?.current_rate_last_current || '0%' }} vs 上期</span>
<span class="card-trend negative">{{ weekTotalData.group_call_duration?.group_data?.current_rate_last_current || '0%' }} vs 上期</span>
</div>
<div class="card-value">{{ formatDuration(weekTotalData.week_total_call?.team_data?.total_call_duration)||0 }} 小时</div>
<div class="card-value">{{ formatDuration(weekTotalData.group_call_duration.group_data?.current_total_call_time_hour)||0 }} 小时</div>
</div>
<div class="report-card">
<div class="card-header">
@@ -70,7 +70,8 @@ const props = defineProps({
week_add_customer_total: {},
week_add_deal_total: {},
week_add_fee_total: {},
pay_deposit_to_money_rate: {}
pay_deposit_to_money_rate: {},
group_call_duration: {}
})
}
})

View File

@@ -80,7 +80,8 @@ import RawDataCards from "../person/components/RawDataCards.vue";
import CustomerDetail from "../person/components/CustomerDetail.vue";
import { useUserStore } from "@/stores/user";
import { useRouter } from "vue-router";
import {getGroupAbnormalResponse, getWeekTotalCall, getWeekAddCustomerTotal, getWeekAddDealTotal, getWeekAddFeeTotal, getGroupFunnel,getPayDepositToMoneyRate,getGroupRanking } from "@/api/manager.js";
import {getGroupAbnormalResponse, getWeekTotalCall, getWeekAddCustomerTotal, getWeekAddDealTotal,
getWeekAddFeeTotal, getGroupFunnel,getPayDepositToMoneyRate,getGroupRanking, getGroupCallDuration} from "@/api/manager.js";
// 缓存系统
const cache = new Map()
@@ -189,7 +190,7 @@ const weekTotalData = ref({
week_add_fee_total: {},
pay_deposit_to_money_rate: {},
group_funnel: {},
week_add_fee_total: {},
group_call_duration: {},
});
// 团队异常预警
const groupAbnormalResponse = ref({})
@@ -248,6 +249,16 @@ async function TeamGetWeekTotalCall() {
weekTotalData.value.week_total_call = res.data
}
}
// 有效通话时长
async function TeamGetGroupCallDuration() {
const params = getRequestParams()
const hasParams = params.user_name
const res = await withCache('getGroupCallDuration', () => getGroupCallDuration(hasParams ? params : undefined), hasParams ? params : {})
console.log(res)
if (res.code === 200) {
weekTotalData.value.group_call_duration = res.data
}
}
// 新增客户
async function TeamGetWeekAddCustomerTotal() {
const params = getRequestParams()
@@ -381,6 +392,7 @@ async function forceRefreshAllData() {
await Promise.all([
TeamGetGroupAbnormalResponse(),
TeamGetWeekTotalCall(),
TeamGetGroupCallDuration(),
TeamGetWeekAddCustomerTotal(),
TeamGetWeekAddDealTotal(),
TeamGetWeekAddFeeTotal(),
@@ -399,6 +411,7 @@ onMounted(async () => {
await TeamGetGroupAbnormalResponse()
await TeamGetWeekTotalCall()
await TeamGetGroupCallDuration()
await TeamGetWeekAddCustomerTotal()
await TeamGetWeekAddDealTotal()
await TeamGetWeekAddFeeTotal()

View File

@@ -128,7 +128,7 @@ import UserDropdown from "@/components/UserDropdown.vue";
import Loading from "@/components/Loading.vue";
import {getCustomerAttendance,getTodayCall,getProblemDistribution,getTableFillingRate,getAverageResponseTime,
getWeeklyActiveCommunicationRate,getTimeoutResponseRate,getCustomerCallInfo,getCustomerChatInfo,getCustomerFormInfo,
getConversionRateAndAllocatedData,getCustomerAttendanceAfterClass4,getPayMoneyCustomers,getSalesFunnel,getGoldContactTime} from "@/api/api.js"
getConversionRateAndAllocatedData,getCustomerAttendanceAfterClass4,getPayMoneyCustomers,getSalesFunnel,getGoldContactTime,getAvgCallTime} from "@/api/api.js"
// 缓存系统
const cache = new Map();
@@ -330,7 +330,12 @@ async function getCoreKpi() {
kpiDataState.assignedData = conversionRes.data.all_count || 0
kpiDataState.wechatAddRate = conversionRes.data.plus_v_conversion_rate || 0
}
// 平均通话时长
const avgCallTimeRes = await withCache('getAvgCallTime', () => getAvgCallTime(hasParams ? params : undefined), hasParams ? params : {})
if (avgCallTimeRes.code === 200) {
kpiDataState.avgDuration = avgCallTimeRes.data.call_time || 0
}
} catch (error) {
console.error('获取核心KPI数据失败:', error)
} finally {